|
@@ -2047,7 +2047,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
BatchedListEntries<OpenFileEntry> batchedListEntries;
|
|
|
String normalizedPath = new Path(path).toString(); // normalize path.
|
|
|
try {
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
if (openFilesTypes.contains(OpenFilesType.ALL_OPEN_FILES)) {
|
|
@@ -2062,7 +2062,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
}
|
|
|
}
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(null));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(null));
|
|
|
}
|
|
|
} catch (AccessControlException e) {
|
|
|
logAuditEvent(false, operationName, null);
|
|
@@ -2074,7 +2074,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
|
|
|
public BatchedListEntries<OpenFileEntry> getFilesBlockingDecom(long prevId,
|
|
|
String path) {
|
|
|
- assert hasReadLock();
|
|
|
+ assert hasReadLock(FSNamesystemLockMode.FS);
|
|
|
final List<OpenFileEntry> openFileEntries = Lists.newArrayList();
|
|
|
LightWeightHashSet<Long> openFileIds = new LightWeightHashSet<>();
|
|
|
for (DatanodeDescriptor dataNode :
|
|
@@ -2214,7 +2214,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
FSPermissionChecker.setOperationType(operationName);
|
|
|
final INode inode;
|
|
|
try {
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.GLOBAL);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
res = FSDirStatAndListingOp.getBlockLocations(
|
|
@@ -2239,7 +2239,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
checkBlockLocationsWhenObserver(res.blocks, srcArg);
|
|
|
}
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(srcArg));
|
|
|
+ readUnlock(FSNamesystemLockMode.GLOBAL, operationName, getLockReportInfoSupplier(srcArg));
|
|
|
}
|
|
|
} catch (AccessControlException e) {
|
|
|
logAuditEvent(false, operationName, srcArg);
|
|
@@ -2252,7 +2252,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
String src = srcArg;
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
try {
|
|
|
- writeLock();
|
|
|
+ writeLock(FSNamesystemLockMode.FS);
|
|
|
final long now = now();
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
@@ -2269,7 +2269,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
}
|
|
|
}
|
|
|
} finally {
|
|
|
- writeUnlock(operationName, getLockReportInfoSupplier(srcArg));
|
|
|
+ writeUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(srcArg));
|
|
|
}
|
|
|
} catch (Throwable e) {
|
|
|
LOG.warn("Failed to update the access time of " + src, e);
|
|
@@ -2671,12 +2671,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
FSPermissionChecker.setOperationType(null);
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
return FSDirAttrOp.getPreferredBlockSize(dir, pc, src);
|
|
|
} finally {
|
|
|
- readUnlock("getPreferredBlockSize");
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, "getPreferredBlockSize");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3490,13 +3490,13 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
FSPermissionChecker.setOperationType(operationName);
|
|
|
try {
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
stat = FSDirStatAndListingOp.getFileInfo(
|
|
|
dir, pc, src, resolveLink, needLocation, needBlockToken);
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(src));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(src));
|
|
|
}
|
|
|
} catch (AccessControlException e) {
|
|
|
logAuditEvent(false, operationName, src);
|
|
@@ -3520,12 +3520,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
FSPermissionChecker.setOperationType(operationName);
|
|
|
boolean success = false;
|
|
|
try {
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
success = FSDirStatAndListingOp.isFileClosed(dir, pc, src);
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(src));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(src));
|
|
|
}
|
|
|
} catch (AccessControlException e) {
|
|
|
logAuditEvent(false, operationName, src);
|
|
@@ -3588,12 +3588,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
FSPermissionChecker.setOperationType(operationName);
|
|
|
try {
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
cs = FSDirStatAndListingOp.getContentSummary(dir, pc, src);
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(src));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(src));
|
|
|
}
|
|
|
} catch (AccessControlException ace) {
|
|
|
logAuditEvent(false, operationName, src);
|
|
@@ -4221,12 +4221,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
FSPermissionChecker.setOperationType(operationName);
|
|
|
try {
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(NameNode.OperationCategory.READ);
|
|
|
dl = getListingInt(dir, pc, src, startAfter, needLocation);
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(src));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(src));
|
|
|
}
|
|
|
} catch (AccessControlException e) {
|
|
|
logAuditEvent(false, operationName, src);
|
|
@@ -4292,7 +4292,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
BatchedDirectoryListing bdl;
|
|
|
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(NameNode.OperationCategory.READ);
|
|
|
|
|
@@ -4379,7 +4379,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
returnedStartAfter);
|
|
|
}
|
|
|
} finally {
|
|
|
- readUnlock(operationName,
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName,
|
|
|
getLockReportInfoSupplier(Arrays.toString(srcs)));
|
|
|
}
|
|
|
for (int i = startSrcsIndex; i < srcsIndex; i++) {
|
|
@@ -6229,7 +6229,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
return corruptFiles;
|
|
|
}
|
|
|
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.GLOBAL);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
if (!blockManager.isPopulatingReplQueues()) {
|
|
@@ -6278,7 +6278,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
LOG.debug("list corrupt file blocks returned: {}", count);
|
|
|
return corruptFiles;
|
|
|
} finally {
|
|
|
- readUnlock("listCorruptFileBlocks");
|
|
|
+ readUnlock(FSNamesystemLockMode.GLOBAL, "listCorruptFileBlocks");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -8155,14 +8155,14 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
keyName, src);
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
- writeLock();
|
|
|
+ writeLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
checkNameNodeSafeMode("Cannot create encryption zone on " + src);
|
|
|
resultingStat = FSDirEncryptionZoneOp.createEncryptionZone(dir, src,
|
|
|
pc, metadata.getCipher(), keyName, logRetryCache);
|
|
|
} finally {
|
|
|
- writeUnlock(operationName,
|
|
|
+ writeUnlock(FSNamesystemLockMode.FS, operationName,
|
|
|
getLockReportInfoSupplier(src, null, resultingStat));
|
|
|
}
|
|
|
} catch (AccessControlException e) {
|
|
@@ -8760,7 +8760,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
FSPermissionChecker.setOperationType(operationName);
|
|
|
try {
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
final INodesInPath iip = dir.resolvePath(pc, src, DirOp.READ);
|
|
@@ -8773,7 +8773,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
dir.checkPathAccess(pc, iip, mode);
|
|
|
}
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(src));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(src));
|
|
|
}
|
|
|
} catch (AccessControlException e) {
|
|
|
logAuditEvent(false, operationName, src);
|