[SPARK-2325] Utils.getLocalDir had better check the directory and choose a good one instead of choosing the first one directly