HDFS-16085. Move the getPermissionChecker out of the read lock (#3134). Contributed by tomscut.

Signed-off-by: Takanobu Asanuma <tasanuma@apache.org>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
litao 2021-06-24 18:29:42 +08:00 committed by Ayush Saxena
parent 5fc61d2e56
commit 4ca49fcd44
1 changed files with 2 additions and 1 deletions

View File

@ -573,10 +573,11 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
final FSNamesystem fsn = namenode.getNamesystem();
final String operationName = "fsckGetBlockLocations";
FSPermissionChecker.setOperationType(operationName);
FSPermissionChecker pc = fsn.getPermissionChecker();
fsn.readLock();
try {
blocks = FSDirStatAndListingOp.getBlockLocations(
fsn.getFSDirectory(), fsn.getPermissionChecker(),
fsn.getFSDirectory(), pc,
path, 0, fileLen, false)
.blocks;
} catch (FileNotFoundException fnfe) {