HADOOP-18109. Ensure that default permissions of directories under internal ViewFS directories are the same as directories on target filesystems. Contributed by Chentao Yu. (3953)
(cherry picked from commit 19d90e62fb
)
This commit is contained in:
parent
db67952f9f
commit
d14a7c6ee5
@ -1579,11 +1579,6 @@ public boolean mkdirs(Path dir, FsPermission permission)
|
|||||||
throw readOnlyMountTable("mkdirs", dir);
|
throw readOnlyMountTable("mkdirs", dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean mkdirs(Path dir) throws IOException {
|
|
||||||
return mkdirs(dir, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FSDataInputStream open(Path f, int bufferSize)
|
public FSDataInputStream open(Path f, int bufferSize)
|
||||||
throws AccessControlException, FileNotFoundException, IOException {
|
throws AccessControlException, FileNotFoundException, IOException {
|
||||||
|
@ -479,4 +479,23 @@ public Object run() throws IOException {
|
|||||||
assertEquals("The owner did not match ", owner, userUgi.getShortUserName());
|
assertEquals("The owner did not match ", owner, userUgi.getShortUserName());
|
||||||
otherfs.delete(user1Path, false);
|
otherfs.delete(user1Path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInternalDirectoryPermissions() throws IOException {
|
||||||
|
LOG.info("Starting testInternalDirectoryPermissions!");
|
||||||
|
Configuration localConf = new Configuration(conf);
|
||||||
|
ConfigUtil.addLinkFallback(
|
||||||
|
localConf, new Path(targetTestRoot, "fallbackDir").toUri());
|
||||||
|
FileSystem fs = FileSystem.get(FsConstants.VIEWFS_URI, localConf);
|
||||||
|
// check that the default permissions on a sub-folder of an internal
|
||||||
|
// directory are the same as those created on non-internal directories.
|
||||||
|
Path subDirOfInternalDir = new Path("/internalDir/dir1");
|
||||||
|
fs.mkdirs(subDirOfInternalDir);
|
||||||
|
|
||||||
|
Path subDirOfRealDir = new Path("/internalDir/linkToDir2/dir1");
|
||||||
|
fs.mkdirs(subDirOfRealDir);
|
||||||
|
|
||||||
|
assertEquals(fs.getFileStatus(subDirOfInternalDir).getPermission(),
|
||||||
|
fs.getFileStatus(subDirOfRealDir).getPermission());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user