HDFS-8335. FSNamesystem should construct FSPermissionChecker only if permission is enabled. Contributed by Gabor Liptak.
This commit is contained in:
parent
fe5624b85d
commit
977e0b3c4c
@ -1734,6 +1734,9 @@ Release 2.8.0 - UNRELEASED
|
|||||||
|
|
||||||
HDFS-9318. considerLoad factor can be improved. (Kuhu Shukla via kihwal)
|
HDFS-9318. considerLoad factor can be improved. (Kuhu Shukla via kihwal)
|
||||||
|
|
||||||
|
HDFS-8335. FSNamesystem should construct FSPermissionChecker only if
|
||||||
|
permission is enabled. (Gabor Liptak via wheat9)
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
||||||
HDFS-7501. TransactionsSinceLastCheckpoint can be negative on SBNs.
|
HDFS-7501. TransactionsSinceLastCheckpoint can be negative on SBNs.
|
||||||
@ -2376,6 +2379,9 @@ Release 2.8.0 - UNRELEASED
|
|||||||
HDFS-8855. Webhdfs client leaks active NameNode connections.
|
HDFS-8855. Webhdfs client leaks active NameNode connections.
|
||||||
(Xiaobing Zhou via xyao)
|
(Xiaobing Zhou via xyao)
|
||||||
|
|
||||||
|
HDFS-8335. FSNamesystem should construct FSPermissionChecker only if
|
||||||
|
permission is enabled. (Gabor Liptak via wheat9)
|
||||||
|
|
||||||
Release 2.7.3 - UNRELEASED
|
Release 2.7.3 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -52,12 +52,17 @@
|
|||||||
class FSDirStatAndListingOp {
|
class FSDirStatAndListingOp {
|
||||||
static DirectoryListing getListingInt(FSDirectory fsd, final String srcArg,
|
static DirectoryListing getListingInt(FSDirectory fsd, final String srcArg,
|
||||||
byte[] startAfter, boolean needLocation) throws IOException {
|
byte[] startAfter, boolean needLocation) throws IOException {
|
||||||
FSPermissionChecker pc = fsd.getPermissionChecker();
|
|
||||||
byte[][] pathComponents = FSDirectory
|
byte[][] pathComponents = FSDirectory
|
||||||
.getPathComponentsForReservedPath(srcArg);
|
.getPathComponentsForReservedPath(srcArg);
|
||||||
final String startAfterString = new String(startAfter, Charsets.UTF_8);
|
final String startAfterString = new String(startAfter, Charsets.UTF_8);
|
||||||
final String src = fsd.resolvePath(pc, srcArg, pathComponents);
|
String src = null;
|
||||||
final INodesInPath iip = fsd.getINodesInPath(src, true);
|
|
||||||
|
if (fsd.isPermissionEnabled()) {
|
||||||
|
FSPermissionChecker pc = fsd.getPermissionChecker();
|
||||||
|
src = fsd.resolvePath(pc, srcArg, pathComponents);
|
||||||
|
} else {
|
||||||
|
src = FSDirectory.resolvePath(srcArg, pathComponents, fsd);
|
||||||
|
}
|
||||||
|
|
||||||
// Get file name when startAfter is an INodePath
|
// Get file name when startAfter is an INodePath
|
||||||
if (FSDirectory.isReservedName(startAfterString)) {
|
if (FSDirectory.isReservedName(startAfterString)) {
|
||||||
@ -74,8 +79,10 @@ static DirectoryListing getListingInt(FSDirectory fsd, final String srcArg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final INodesInPath iip = fsd.getINodesInPath(src, true);
|
||||||
boolean isSuperUser = true;
|
boolean isSuperUser = true;
|
||||||
if (fsd.isPermissionEnabled()) {
|
if (fsd.isPermissionEnabled()) {
|
||||||
|
FSPermissionChecker pc = fsd.getPermissionChecker();
|
||||||
if (iip.getLastINode() != null && iip.getLastINode().isDirectory()) {
|
if (iip.getLastINode() != null && iip.getLastINode().isDirectory()) {
|
||||||
fsd.checkPathAccess(pc, iip, FsAction.READ_EXECUTE);
|
fsd.checkPathAccess(pc, iip, FsAction.READ_EXECUTE);
|
||||||
} else {
|
} else {
|
||||||
@ -103,15 +110,17 @@ static HdfsFileStatus getFileInfo(
|
|||||||
if (!DFSUtil.isValidName(src)) {
|
if (!DFSUtil.isValidName(src)) {
|
||||||
throw new InvalidPathException("Invalid file name: " + src);
|
throw new InvalidPathException("Invalid file name: " + src);
|
||||||
}
|
}
|
||||||
FSPermissionChecker pc = fsd.getPermissionChecker();
|
|
||||||
byte[][] pathComponents = FSDirectory.getPathComponentsForReservedPath(src);
|
byte[][] pathComponents = FSDirectory.getPathComponentsForReservedPath(src);
|
||||||
|
if (fsd.isPermissionEnabled()) {
|
||||||
|
FSPermissionChecker pc = fsd.getPermissionChecker();
|
||||||
src = fsd.resolvePath(pc, src, pathComponents);
|
src = fsd.resolvePath(pc, src, pathComponents);
|
||||||
final INodesInPath iip = fsd.getINodesInPath(src, resolveLink);
|
final INodesInPath iip = fsd.getINodesInPath(src, resolveLink);
|
||||||
if (fsd.isPermissionEnabled()) {
|
|
||||||
fsd.checkPermission(pc, iip, false, null, null, null, null, false);
|
fsd.checkPermission(pc, iip, false, null, null, null, null, false);
|
||||||
|
} else {
|
||||||
|
src = FSDirectory.resolvePath(src, pathComponents, fsd);
|
||||||
}
|
}
|
||||||
return getFileInfo(fsd, src, resolveLink,
|
return getFileInfo(fsd, src, FSDirectory.isReservedRawName(srcArg),
|
||||||
FSDirectory.isReservedRawName(srcArg));
|
resolveLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user