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 GitHub
parent fdef2b4cca
commit f78b6d47f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -574,10 +574,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) {