MAPREDUCE-2289. Permissions race can make getStagingDir fail on local filesystem (ahmed via tucu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1353750 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
60f4f25afa
commit
5b36106934
|
@ -189,6 +189,9 @@ Branch-2 ( Unreleased changes )
|
||||||
MAPREDUCE-4290. Fix Yarn Applicaiton Status to MR JobState conversion.
|
MAPREDUCE-4290. Fix Yarn Applicaiton Status to MR JobState conversion.
|
||||||
(Devaraj K via sseth)
|
(Devaraj K via sseth)
|
||||||
|
|
||||||
|
MAPREDUCE-2289. Permissions race can make getStagingDir fail on local filesystem
|
||||||
|
(ahmed via tucu)
|
||||||
|
|
||||||
Release 2.0.0-alpha - 05-23-2012
|
Release 2.0.0-alpha - 05-23-2012
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -27,12 +27,18 @@ import org.apache.hadoop.fs.permission.FsPermission;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A utility to manage job submission files.
|
* A utility to manage job submission files.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class JobSubmissionFiles {
|
public class JobSubmissionFiles {
|
||||||
|
|
||||||
|
private final static Log LOG = LogFactory.getLog(JobSubmissionFiles.class);
|
||||||
|
|
||||||
// job submission directory is private!
|
// job submission directory is private!
|
||||||
final public static FsPermission JOB_DIR_PERMISSION =
|
final public static FsPermission JOB_DIR_PERMISSION =
|
||||||
FsPermission.createImmutable((short) 0700); // rwx--------
|
FsPermission.createImmutable((short) 0700); // rwx--------
|
||||||
|
@ -102,14 +108,18 @@ public class JobSubmissionFiles {
|
||||||
if (fs.exists(stagingArea)) {
|
if (fs.exists(stagingArea)) {
|
||||||
FileStatus fsStatus = fs.getFileStatus(stagingArea);
|
FileStatus fsStatus = fs.getFileStatus(stagingArea);
|
||||||
String owner = fsStatus.getOwner();
|
String owner = fsStatus.getOwner();
|
||||||
if (!(owner.equals(currentUser) || owner.equals(realUser)) ||
|
if (!(owner.equals(currentUser) || owner.equals(realUser))) {
|
||||||
!fsStatus.getPermission().equals(JOB_DIR_PERMISSION)) {
|
throw new IOException("The ownership on the staging directory " +
|
||||||
throw new IOException("The ownership/permissions on the staging " +
|
stagingArea + " is not as expected. " +
|
||||||
"directory " + stagingArea + " is not as expected. " +
|
"It is owned by " + owner + ". The directory must " +
|
||||||
"It is owned by " + owner + " and permissions are "+
|
|
||||||
fsStatus.getPermission() + ". The directory must " +
|
|
||||||
"be owned by the submitter " + currentUser + " or " +
|
"be owned by the submitter " + currentUser + " or " +
|
||||||
"by " + realUser + " and permissions must be rwx------");
|
"by " + realUser);
|
||||||
|
}
|
||||||
|
if (!fsStatus.getPermission().equals(JOB_DIR_PERMISSION)) {
|
||||||
|
LOG.info("Permissions on staging directory " + stagingArea + " are " +
|
||||||
|
"incorrect: " + fsStatus.getPermission() + ". Fixing permissions " +
|
||||||
|
"to correct value " + JOB_DIR_PERMISSION);
|
||||||
|
fs.setPermission(stagingArea, JOB_DIR_PERMISSION);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fs.mkdirs(stagingArea,
|
fs.mkdirs(stagingArea,
|
||||||
|
|
Loading…
Reference in New Issue