|
@@ -1740,8 +1740,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
* HDFS-7463. A better fix is to change the edit log of SetTime to
|
|
* HDFS-7463. A better fix is to change the edit log of SetTime to
|
|
* use inode id instead of a path.
|
|
* use inode id instead of a path.
|
|
*/
|
|
*/
|
|
- src = dir.resolvePath(pc, srcArg);
|
|
|
|
- final INodesInPath iip = dir.getINodesInPath(src, true);
|
|
|
|
|
|
+ final INodesInPath iip = dir.resolvePath(pc, src);
|
|
|
|
+ src = iip.getPath();
|
|
INode inode = iip.getLastINode();
|
|
INode inode = iip.getLastINode();
|
|
boolean updateAccessTime = inode != null &&
|
|
boolean updateAccessTime = inode != null &&
|
|
now > inode.getAccessTime() + getAccessTimePrecision();
|
|
now > inode.getAccessTime() + getAccessTimePrecision();
|
|
@@ -1817,8 +1817,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
boolean needBlockToken)
|
|
boolean needBlockToken)
|
|
throws IOException {
|
|
throws IOException {
|
|
String src = srcArg;
|
|
String src = srcArg;
|
|
- src = dir.resolvePath(pc, srcArg);
|
|
|
|
- final INodesInPath iip = dir.getINodesInPath(src, true);
|
|
|
|
|
|
+ final INodesInPath iip = dir.resolvePath(pc, src);
|
|
|
|
+ src = iip.getPath();
|
|
final INodeFile inode = INodeFile.valueOf(iip.getLastINode(), src);
|
|
final INodeFile inode = INodeFile.valueOf(iip.getLastINode(), src);
|
|
if (isPermissionEnabled) {
|
|
if (isPermissionEnabled) {
|
|
dir.checkPathAccess(pc, iip, FsAction.READ);
|
|
dir.checkPathAccess(pc, iip, FsAction.READ);
|
|
@@ -2016,7 +2016,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkNameNodeSafeMode("Cannot truncate for " + src);
|
|
checkNameNodeSafeMode("Cannot truncate for " + src);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
|
|
+ INodesInPath iip = dir.resolvePath(pc, src);
|
|
|
|
+ src = iip.getPath();
|
|
res = truncateInternal(src, newLength, clientName,
|
|
res = truncateInternal(src, newLength, clientName,
|
|
clientMachine, mtime, pc, toRemoveBlocks);
|
|
clientMachine, mtime, pc, toRemoveBlocks);
|
|
stat = dir.getAuditFileInfo(dir.getINodesInPath4Write(src, false));
|
|
stat = dir.getAuditFileInfo(dir.getINodesInPath4Write(src, false));
|
|
@@ -2399,8 +2400,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
if (provider != null) {
|
|
if (provider != null) {
|
|
readLock();
|
|
readLock();
|
|
try {
|
|
try {
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
- INodesInPath iip = dir.getINodesInPath4Write(src);
|
|
|
|
|
|
+ INodesInPath iip = dir.resolvePathForWrite(pc, src);
|
|
|
|
+ src = iip.getPath();
|
|
// Nothing to do if the path is not within an EZ
|
|
// Nothing to do if the path is not within an EZ
|
|
final EncryptionZone zone = dir.getEZForPath(iip);
|
|
final EncryptionZone zone = dir.getEZForPath(iip);
|
|
if (zone != null) {
|
|
if (zone != null) {
|
|
@@ -2437,8 +2438,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
checkNameNodeSafeMode("Cannot create file" + src);
|
|
checkNameNodeSafeMode("Cannot create file" + src);
|
|
dir.writeLock();
|
|
dir.writeLock();
|
|
try {
|
|
try {
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
- final INodesInPath iip = dir.getINodesInPath4Write(src);
|
|
|
|
|
|
+ final INodesInPath iip = dir.resolvePathForWrite(pc, src);
|
|
|
|
+ src = iip.getPath();
|
|
toRemoveBlocks = startFileInternal(
|
|
toRemoveBlocks = startFileInternal(
|
|
pc, iip, permissions, holder,
|
|
pc, iip, permissions, holder,
|
|
clientMachine, create, overwrite,
|
|
clientMachine, create, overwrite,
|
|
@@ -2446,7 +2447,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
isLazyPersist, suite, protocolVersion, edek,
|
|
isLazyPersist, suite, protocolVersion, edek,
|
|
logRetryCache);
|
|
logRetryCache);
|
|
stat = FSDirStatAndListingOp.getFileInfo(
|
|
stat = FSDirStatAndListingOp.getFileInfo(
|
|
- dir, src, false, FSDirectory.isReservedRawName(srcArg), true);
|
|
|
|
|
|
+ dir, src, false, FSDirectory.isReservedRawName(srcArg));
|
|
} finally {
|
|
} finally {
|
|
dir.writeUnlock();
|
|
dir.writeUnlock();
|
|
}
|
|
}
|
|
@@ -2815,8 +2816,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkNameNodeSafeMode("Cannot recover the lease of " + src);
|
|
checkNameNodeSafeMode("Cannot recover the lease of " + src);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
- final INodesInPath iip = dir.getINodesInPath4Write(src);
|
|
|
|
|
|
+ final INodesInPath iip = dir.resolvePathForWrite(pc, src);
|
|
|
|
+ src = iip.getPath();
|
|
final INodeFile inode = INodeFile.valueOf(iip.getLastINode(), src);
|
|
final INodeFile inode = INodeFile.valueOf(iip.getLastINode(), src);
|
|
if (!inode.isUnderConstruction()) {
|
|
if (!inode.isUnderConstruction()) {
|
|
return true;
|
|
return true;
|
|
@@ -2967,12 +2968,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkNameNodeSafeMode("Cannot append to file" + src);
|
|
checkNameNodeSafeMode("Cannot append to file" + src);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
- final INodesInPath iip = dir.getINodesInPath4Write(src);
|
|
|
|
|
|
+ final INodesInPath iip = dir.resolvePathForWrite(pc, src);
|
|
|
|
+ src = iip.getPath();
|
|
lb = appendFileInternal(pc, iip, holder, clientMachine, newBlock,
|
|
lb = appendFileInternal(pc, iip, holder, clientMachine, newBlock,
|
|
logRetryCache);
|
|
logRetryCache);
|
|
stat = FSDirStatAndListingOp.getFileInfo(dir, src, false,
|
|
stat = FSDirStatAndListingOp.getFileInfo(dir, src, false,
|
|
- FSDirectory.isReservedRawName(srcArg), true);
|
|
|
|
|
|
+ FSDirectory.isReservedRawName(srcArg));
|
|
} catch (StandbyException se) {
|
|
} catch (StandbyException se) {
|
|
skipSync = true;
|
|
skipSync = true;
|
|
throw se;
|
|
throw se;
|
|
@@ -3056,9 +3057,10 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
readLock();
|
|
readLock();
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
|
|
+ INodesInPath iip = dir.resolvePath(pc, src, fileId);
|
|
|
|
+ src = iip.getPath();
|
|
FileState fileState = analyzeFileState(
|
|
FileState fileState = analyzeFileState(
|
|
- src, fileId, clientName, previous, onRetryBlock);
|
|
|
|
|
|
+ iip, fileId, clientName, previous, onRetryBlock);
|
|
if (onRetryBlock[0] != null && onRetryBlock[0].getLocations().length > 0) {
|
|
if (onRetryBlock[0] != null && onRetryBlock[0].getLocations().length > 0) {
|
|
// This is a retry. No need to generate new locations.
|
|
// This is a retry. No need to generate new locations.
|
|
// Use the last block if it has locations.
|
|
// Use the last block if it has locations.
|
|
@@ -3117,8 +3119,9 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
// Run the full analysis again, since things could have changed
|
|
// Run the full analysis again, since things could have changed
|
|
// while chooseTarget() was executing.
|
|
// while chooseTarget() was executing.
|
|
LocatedBlock[] onRetryBlock = new LocatedBlock[1];
|
|
LocatedBlock[] onRetryBlock = new LocatedBlock[1];
|
|
|
|
+ final INodesInPath iip = dir.resolvePath(null, src, fileId);
|
|
FileState fileState =
|
|
FileState fileState =
|
|
- analyzeFileState(src, fileId, clientName, previous, onRetryBlock);
|
|
|
|
|
|
+ analyzeFileState(iip, fileId, clientName, previous, onRetryBlock);
|
|
final INodeFile pendingFile = fileState.inode;
|
|
final INodeFile pendingFile = fileState.inode;
|
|
src = fileState.path;
|
|
src = fileState.path;
|
|
|
|
|
|
@@ -3186,14 +3189,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- FileState analyzeFileState(String src,
|
|
|
|
- long fileId,
|
|
|
|
- String clientName,
|
|
|
|
- ExtendedBlock previous,
|
|
|
|
- LocatedBlock[] onRetryBlock)
|
|
|
|
|
|
+ private FileState analyzeFileState(
|
|
|
|
+ INodesInPath iip, long fileId, String clientName,
|
|
|
|
+ ExtendedBlock previous, LocatedBlock[] onRetryBlock)
|
|
throws IOException {
|
|
throws IOException {
|
|
assert hasReadLock();
|
|
assert hasReadLock();
|
|
-
|
|
|
|
|
|
+ String src = iip.getPath();
|
|
checkBlock(previous);
|
|
checkBlock(previous);
|
|
onRetryBlock[0] = null;
|
|
onRetryBlock[0] = null;
|
|
checkNameNodeSafeMode("Cannot add block to " + src);
|
|
checkNameNodeSafeMode("Cannot add block to " + src);
|
|
@@ -3202,24 +3203,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
checkFsObjectLimit();
|
|
checkFsObjectLimit();
|
|
|
|
|
|
Block previousBlock = ExtendedBlock.getLocalBlock(previous);
|
|
Block previousBlock = ExtendedBlock.getLocalBlock(previous);
|
|
- final INode inode;
|
|
|
|
- final INodesInPath iip;
|
|
|
|
- if (fileId == INodeId.GRANDFATHER_INODE_ID) {
|
|
|
|
- // Older clients may not have given us an inode ID to work with.
|
|
|
|
- // In this case, we have to try to resolve the path and hope it
|
|
|
|
- // hasn't changed or been deleted since the file was opened for write.
|
|
|
|
- iip = dir.getINodesInPath4Write(src);
|
|
|
|
- inode = iip.getLastINode();
|
|
|
|
- } else {
|
|
|
|
- // Newer clients pass the inode ID, so we can just get the inode
|
|
|
|
- // directly.
|
|
|
|
- inode = dir.getInode(fileId);
|
|
|
|
- iip = INodesInPath.fromINode(inode);
|
|
|
|
- if (inode != null) {
|
|
|
|
- src = iip.getPath();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- final INodeFile pendingFile = checkLease(src, clientName, inode, fileId);
|
|
|
|
|
|
+ final INodeFile pendingFile = checkLease(iip, clientName, fileId);
|
|
BlockInfoContiguous lastBlockInFile = pendingFile.getLastBlock();
|
|
BlockInfoContiguous lastBlockInFile = pendingFile.getLastBlock();
|
|
if (!Block.matchingIdAndGenStamp(previousBlock, lastBlockInFile)) {
|
|
if (!Block.matchingIdAndGenStamp(previousBlock, lastBlockInFile)) {
|
|
// The block that the client claims is the current last block
|
|
// The block that the client claims is the current last block
|
|
@@ -3317,20 +3301,11 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
//check safe mode
|
|
//check safe mode
|
|
checkNameNodeSafeMode("Cannot add datanode; src=" + src + ", blk=" + blk);
|
|
checkNameNodeSafeMode("Cannot add datanode; src=" + src + ", blk=" + blk);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
|
|
+ final INodesInPath iip = dir.resolvePath(pc, src, fileId);
|
|
|
|
+ src = iip.getPath();
|
|
|
|
|
|
//check lease
|
|
//check lease
|
|
- final INode inode;
|
|
|
|
- if (fileId == INodeId.GRANDFATHER_INODE_ID) {
|
|
|
|
- // Older clients may not have given us an inode ID to work with.
|
|
|
|
- // In this case, we have to try to resolve the path and hope it
|
|
|
|
- // hasn't changed or been deleted since the file was opened for write.
|
|
|
|
- inode = dir.getINode(src);
|
|
|
|
- } else {
|
|
|
|
- inode = dir.getInode(fileId);
|
|
|
|
- if (inode != null) src = inode.getFullPathName();
|
|
|
|
- }
|
|
|
|
- final INodeFile file = checkLease(src, clientName, inode, fileId);
|
|
|
|
|
|
+ final INodeFile file = checkLease(iip, clientName, fileId);
|
|
clientMachine = file.getFileUnderConstructionFeature().getClientMachine();
|
|
clientMachine = file.getFileUnderConstructionFeature().getClientMachine();
|
|
clientnode = blockManager.getDatanodeManager().getDatanodeByHost(clientMachine);
|
|
clientnode = blockManager.getDatanodeManager().getDatanodeByHost(clientMachine);
|
|
preferredblocksize = file.getPreferredBlockSize();
|
|
preferredblocksize = file.getPreferredBlockSize();
|
|
@@ -3369,27 +3344,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
FSPermissionChecker pc = getPermissionChecker();
|
|
FSPermissionChecker pc = getPermissionChecker();
|
|
waitForLoadingFSImage();
|
|
waitForLoadingFSImage();
|
|
writeLock();
|
|
writeLock();
|
|
|
|
+ final INodesInPath iip = dir.resolvePath(pc, src, fileId);
|
|
|
|
+ src = iip.getPath();
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkNameNodeSafeMode("Cannot abandon block " + b + " for file" + src);
|
|
checkNameNodeSafeMode("Cannot abandon block " + b + " for file" + src);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
-
|
|
|
|
- final INode inode;
|
|
|
|
- final INodesInPath iip;
|
|
|
|
- if (fileId == INodeId.GRANDFATHER_INODE_ID) {
|
|
|
|
- // Older clients may not have given us an inode ID to work with.
|
|
|
|
- // In this case, we have to try to resolve the path and hope it
|
|
|
|
- // hasn't changed or been deleted since the file was opened for write.
|
|
|
|
- iip = dir.getINodesInPath(src, true);
|
|
|
|
- inode = iip.getLastINode();
|
|
|
|
- } else {
|
|
|
|
- inode = dir.getInode(fileId);
|
|
|
|
- iip = INodesInPath.fromINode(inode);
|
|
|
|
- if (inode != null) {
|
|
|
|
- src = iip.getPath();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- final INodeFile file = checkLease(src, holder, inode, fileId);
|
|
|
|
|
|
+ final INodeFile file = checkLease(iip, holder, fileId);
|
|
|
|
|
|
// Remove the block from the pending creates list
|
|
// Remove the block from the pending creates list
|
|
boolean removed = dir.removeBlock(src, iip, file,
|
|
boolean removed = dir.removeBlock(src, iip, file,
|
|
@@ -3408,8 +3368,10 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- private INodeFile checkLease(String src, String holder, INode inode,
|
|
|
|
- long fileId) throws LeaseExpiredException, FileNotFoundException {
|
|
|
|
|
|
+ private INodeFile checkLease(INodesInPath iip, String holder, long fileId)
|
|
|
|
+ throws LeaseExpiredException, FileNotFoundException {
|
|
|
|
+ String src = iip.getPath();
|
|
|
|
+ INode inode = iip.getLastINode();
|
|
assert hasReadLock();
|
|
assert hasReadLock();
|
|
final String ident = src + " (inode " + fileId + ")";
|
|
final String ident = src + " (inode " + fileId + ")";
|
|
if (inode == null) {
|
|
if (inode == null) {
|
|
@@ -3463,13 +3425,11 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
checkBlock(last);
|
|
checkBlock(last);
|
|
boolean success = false;
|
|
boolean success = false;
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
- FSPermissionChecker pc = getPermissionChecker();
|
|
|
|
waitForLoadingFSImage();
|
|
waitForLoadingFSImage();
|
|
writeLock();
|
|
writeLock();
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkNameNodeSafeMode("Cannot complete file " + src);
|
|
checkNameNodeSafeMode("Cannot complete file " + src);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
success = completeFileInternal(src, holder,
|
|
success = completeFileInternal(src, holder,
|
|
ExtendedBlock.getLocalBlock(last), fileId);
|
|
ExtendedBlock.getLocalBlock(last), fileId);
|
|
} finally {
|
|
} finally {
|
|
@@ -3487,23 +3447,13 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
long fileId) throws IOException {
|
|
long fileId) throws IOException {
|
|
assert hasWriteLock();
|
|
assert hasWriteLock();
|
|
final INodeFile pendingFile;
|
|
final INodeFile pendingFile;
|
|
- final INodesInPath iip;
|
|
|
|
|
|
+ FSPermissionChecker pc = getPermissionChecker();
|
|
|
|
+ final INodesInPath iip = dir.resolvePath(pc, src, fileId);
|
|
|
|
+ src = iip.getPath();
|
|
INode inode = null;
|
|
INode inode = null;
|
|
try {
|
|
try {
|
|
- if (fileId == INodeId.GRANDFATHER_INODE_ID) {
|
|
|
|
- // Older clients may not have given us an inode ID to work with.
|
|
|
|
- // In this case, we have to try to resolve the path and hope it
|
|
|
|
- // hasn't changed or been deleted since the file was opened for write.
|
|
|
|
- iip = dir.getINodesInPath(src, true);
|
|
|
|
- inode = iip.getLastINode();
|
|
|
|
- } else {
|
|
|
|
- inode = dir.getInode(fileId);
|
|
|
|
- iip = INodesInPath.fromINode(inode);
|
|
|
|
- if (inode != null) {
|
|
|
|
- src = iip.getPath();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- pendingFile = checkLease(src, holder, inode, fileId);
|
|
|
|
|
|
+ inode = iip.getLastINode();
|
|
|
|
+ pendingFile = checkLease(iip, holder, fileId);
|
|
} catch (LeaseExpiredException lee) {
|
|
} catch (LeaseExpiredException lee) {
|
|
if (inode != null && inode.isFile() &&
|
|
if (inode != null && inode.isFile() &&
|
|
!inode.asFile().isUnderConstruction()) {
|
|
!inode.asFile().isUnderConstruction()) {
|
|
@@ -3967,18 +3917,9 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkNameNodeSafeMode("Cannot fsync file " + src);
|
|
checkNameNodeSafeMode("Cannot fsync file " + src);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
- final INode inode;
|
|
|
|
- if (fileId == INodeId.GRANDFATHER_INODE_ID) {
|
|
|
|
- // Older clients may not have given us an inode ID to work with.
|
|
|
|
- // In this case, we have to try to resolve the path and hope it
|
|
|
|
- // hasn't changed or been deleted since the file was opened for write.
|
|
|
|
- inode = dir.getINode(src);
|
|
|
|
- } else {
|
|
|
|
- inode = dir.getInode(fileId);
|
|
|
|
- if (inode != null) src = inode.getFullPathName();
|
|
|
|
- }
|
|
|
|
- final INodeFile pendingFile = checkLease(src, clientName, inode, fileId);
|
|
|
|
|
|
+ INodesInPath iip = dir.resolvePath(pc, src, fileId);
|
|
|
|
+ src = iip.getPath();
|
|
|
|
+ final INodeFile pendingFile = checkLease(iip, clientName, fileId);
|
|
if (lastBlockLength > 0) {
|
|
if (lastBlockLength > 0) {
|
|
pendingFile.getFileUnderConstructionFeature().updateLengthOfLastBlock(
|
|
pendingFile.getFileUnderConstructionFeature().updateLengthOfLastBlock(
|
|
pendingFile, lastBlockLength);
|
|
pendingFile, lastBlockLength);
|
|
@@ -8021,7 +7962,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
checkSuperuserPrivilege();
|
|
checkSuperuserPrivilege();
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkNameNodeSafeMode("Cannot create encryption zone on " + src);
|
|
checkNameNodeSafeMode("Cannot create encryption zone on " + src);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
|
|
+ final INodesInPath iip = dir.resolvePathForWrite(pc, src);
|
|
|
|
+ src = iip.getPath();
|
|
|
|
|
|
final CipherSuite suite = CipherSuite.convert(cipher);
|
|
final CipherSuite suite = CipherSuite.convert(cipher);
|
|
// For now this is hardcoded, as we only support one method.
|
|
// For now this is hardcoded, as we only support one method.
|
|
@@ -8032,7 +7974,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1);
|
|
List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1);
|
|
xAttrs.add(ezXAttr);
|
|
xAttrs.add(ezXAttr);
|
|
getEditLog().logSetXAttrs(src, xAttrs, logRetryCache);
|
|
getEditLog().logSetXAttrs(src, xAttrs, logRetryCache);
|
|
- final INodesInPath iip = dir.getINodesInPath4Write(src, false);
|
|
|
|
resultingStat = dir.getAuditFileInfo(iip);
|
|
resultingStat = dir.getAuditFileInfo(iip);
|
|
} finally {
|
|
} finally {
|
|
writeUnlock();
|
|
writeUnlock();
|
|
@@ -8059,8 +8000,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
readLock();
|
|
readLock();
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
- src = dir.resolvePath(pc, src);
|
|
|
|
- final INodesInPath iip = dir.getINodesInPath(src, true);
|
|
|
|
|
|
+ INodesInPath iip = dir.resolvePath(pc, src);
|
|
if (isPermissionEnabled) {
|
|
if (isPermissionEnabled) {
|
|
dir.checkPathAccess(pc, iip, FsAction.READ);
|
|
dir.checkPathAccess(pc, iip, FsAction.READ);
|
|
}
|
|
}
|
|
@@ -8161,17 +8101,17 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
|
|
|
void checkAccess(String src, FsAction mode) throws IOException {
|
|
void checkAccess(String src, FsAction mode) throws IOException {
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
|
|
+ FSPermissionChecker pc = getPermissionChecker();
|
|
readLock();
|
|
readLock();
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
- src = FSDirectory.resolvePath(src, dir);
|
|
|
|
- final INodesInPath iip = dir.getINodesInPath(src, true);
|
|
|
|
|
|
+ final INodesInPath iip = dir.resolvePath(pc, src);
|
|
|
|
+ src = iip.getPath();
|
|
INode inode = iip.getLastINode();
|
|
INode inode = iip.getLastINode();
|
|
if (inode == null) {
|
|
if (inode == null) {
|
|
throw new FileNotFoundException("Path not found");
|
|
throw new FileNotFoundException("Path not found");
|
|
}
|
|
}
|
|
if (isPermissionEnabled) {
|
|
if (isPermissionEnabled) {
|
|
- FSPermissionChecker pc = getPermissionChecker();
|
|
|
|
dir.checkPathAccess(pc, iip, mode);
|
|
dir.checkPathAccess(pc, iip, mode);
|
|
}
|
|
}
|
|
} catch (AccessControlException e) {
|
|
} catch (AccessControlException e) {
|