HADOOP-13440. FileContext does not react on changing umask via configuration.
This commit is contained in:
parent
ef501b1a0b
commit
3d191cc152
|
@ -215,20 +215,18 @@ public class FileContext {
|
|||
* The FileContext is defined by.
|
||||
* 1) defaultFS (slash)
|
||||
* 2) wd
|
||||
* 3) umask
|
||||
* 3) umask (Obtained by FsPermission.getUMask(conf))
|
||||
*/
|
||||
private final AbstractFileSystem defaultFS; //default FS for this FileContext.
|
||||
private Path workingDir; // Fully qualified
|
||||
private FsPermission umask;
|
||||
private final Configuration conf;
|
||||
private final UserGroupInformation ugi;
|
||||
final boolean resolveSymlinks;
|
||||
private final Tracer tracer;
|
||||
|
||||
private FileContext(final AbstractFileSystem defFs,
|
||||
final FsPermission theUmask, final Configuration aConf) {
|
||||
final Configuration aConf) {
|
||||
defaultFS = defFs;
|
||||
umask = theUmask;
|
||||
conf = aConf;
|
||||
tracer = FsTracer.get(aConf);
|
||||
try {
|
||||
|
@ -354,7 +352,7 @@ public class FileContext {
|
|||
*/
|
||||
public static FileContext getFileContext(final AbstractFileSystem defFS,
|
||||
final Configuration aConf) {
|
||||
return new FileContext(defFS, FsPermission.getUMask(aConf), aConf);
|
||||
return new FileContext(defFS, aConf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -564,7 +562,7 @@ public class FileContext {
|
|||
* @return the umask of this FileContext
|
||||
*/
|
||||
public FsPermission getUMask() {
|
||||
return umask;
|
||||
return FsPermission.getUMask(conf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -572,7 +570,7 @@ public class FileContext {
|
|||
* @param newUmask the new umask
|
||||
*/
|
||||
public void setUMask(final FsPermission newUmask) {
|
||||
umask = newUmask;
|
||||
FsPermission.setUMask(conf, newUmask);
|
||||
}
|
||||
|
||||
|
||||
|
@ -673,7 +671,7 @@ public class FileContext {
|
|||
CreateOpts.Perms permOpt = CreateOpts.getOpt(CreateOpts.Perms.class, opts);
|
||||
FsPermission permission = (permOpt != null) ? permOpt.getValue() :
|
||||
FILE_DEFAULT_PERM;
|
||||
permission = permission.applyUMask(umask);
|
||||
permission = permission.applyUMask(getUMask());
|
||||
|
||||
final CreateOpts[] updatedOpts =
|
||||
CreateOpts.setOpt(CreateOpts.perms(permission), opts);
|
||||
|
@ -720,7 +718,7 @@ public class FileContext {
|
|||
IOException {
|
||||
final Path absDir = fixRelativePart(dir);
|
||||
final FsPermission absFerms = (permission == null ?
|
||||
FsPermission.getDirDefault() : permission).applyUMask(umask);
|
||||
FsPermission.getDirDefault() : permission).applyUMask(getUMask());
|
||||
new FSLinkResolver<Void>() {
|
||||
@Override
|
||||
public Void next(final AbstractFileSystem fs, final Path p)
|
||||
|
|
Loading…
Reference in New Issue