From 4ca49fcd444dcd2c49161ac5f25ddf0e3d91e8eb Mon Sep 17 00:00:00 2001 From: litao Date: Thu, 24 Jun 2021 18:29:42 +0800 Subject: [PATCH] HDFS-16085. Move the getPermissionChecker out of the read lock (#3134). Contributed by tomscut. Signed-off-by: Takanobu Asanuma Signed-off-by: Ayush Saxena --- .../org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java index 9b498b2c4e4..c52c9eddc92 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java @@ -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) {