HDFS-9273. ACLs on root directory may be lost after NN restart. Contributed by Xiao Chen.
(cherry picked from commit 1b525a9c32fabd8919c80717a58afbfa7fdce27e) (cherry picked from commit faf1c608990408e2aa59a5e676f86d0c82dbd7f3)
This commit is contained in:
parent
b345ffd7df
commit
339714baa0
@ -21,6 +21,9 @@ Release 2.6.4 - UNRELEASED
|
|||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
||||||
|
HDFS-9273. ACLs on root directory may be lost after NN restart.
|
||||||
|
(Xiao Chen via cnauroth)
|
||||||
|
|
||||||
Release 2.6.3 - UNRELEASED
|
Release 2.6.3 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -338,6 +338,10 @@ private void loadRootINode(INodeSection.INode p) {
|
|||||||
}
|
}
|
||||||
dir.rootDir.cloneModificationTime(root);
|
dir.rootDir.cloneModificationTime(root);
|
||||||
dir.rootDir.clonePermissionStatus(root);
|
dir.rootDir.clonePermissionStatus(root);
|
||||||
|
final AclFeature af = root.getFeature(AclFeature.class);
|
||||||
|
if (af != null) {
|
||||||
|
dir.rootDir.addAclFeature(af);
|
||||||
|
}
|
||||||
// root dir supports having extended attributes according to POSIX
|
// root dir supports having extended attributes according to POSIX
|
||||||
final XAttrFeature f = root.getXAttrFeature();
|
final XAttrFeature f = root.getXAttrFeature();
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
|
@ -206,6 +206,35 @@ public void testEditLogDefaultAclNewChildren() throws IOException {
|
|||||||
doTestDefaultAclNewChildren(false);
|
doTestDefaultAclNewChildren(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRootACLAfterLoadingFsImage() throws IOException {
|
||||||
|
DistributedFileSystem fs = cluster.getFileSystem();
|
||||||
|
Path rootdir = new Path("/");
|
||||||
|
AclEntry e1 = new AclEntry.Builder().setName("foo")
|
||||||
|
.setPermission(ALL).setScope(ACCESS).setType(GROUP).build();
|
||||||
|
AclEntry e2 = new AclEntry.Builder().setName("bar")
|
||||||
|
.setPermission(READ).setScope(ACCESS).setType(GROUP).build();
|
||||||
|
fs.modifyAclEntries(rootdir, Lists.newArrayList(e1, e2));
|
||||||
|
|
||||||
|
AclStatus s = cluster.getNamesystem().getAclStatus(rootdir.toString());
|
||||||
|
AclEntry[] returned =
|
||||||
|
Lists.newArrayList(s.getEntries()).toArray(new AclEntry[0]);
|
||||||
|
Assert.assertArrayEquals(
|
||||||
|
new AclEntry[] { aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
||||||
|
aclEntry(ACCESS, GROUP, "bar", READ),
|
||||||
|
aclEntry(ACCESS, GROUP, "foo", ALL) }, returned);
|
||||||
|
|
||||||
|
// restart - hence save and load from fsimage
|
||||||
|
restart(fs, true);
|
||||||
|
|
||||||
|
s = cluster.getNamesystem().getAclStatus(rootdir.toString());
|
||||||
|
returned = Lists.newArrayList(s.getEntries()).toArray(new AclEntry[0]);
|
||||||
|
Assert.assertArrayEquals(
|
||||||
|
new AclEntry[] { aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
||||||
|
aclEntry(ACCESS, GROUP, "bar", READ),
|
||||||
|
aclEntry(ACCESS, GROUP, "foo", ALL) }, returned);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restart the NameNode, optionally saving a new checkpoint.
|
* Restart the NameNode, optionally saving a new checkpoint.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user