@@ -2618,9 +2618,10 @@ void unsetStoragePolicy(String src) throws IOException {
26182618 * @throws IOException
26192619 */
26202620 BlockStoragePolicy getStoragePolicy (String src ) throws IOException {
2621+ final String operationName = "getStoragePolicy" ;
26212622 checkOperation (OperationCategory .READ );
26222623 final FSPermissionChecker pc = getPermissionChecker ();
2623- FSPermissionChecker .setOperationType (null );
2624+ FSPermissionChecker .setOperationType (operationName );
26242625 readLock ();
26252626 try {
26262627 checkOperation (OperationCategory .READ );
@@ -2646,9 +2647,10 @@ BlockStoragePolicy[] getStoragePolicies() throws IOException {
26462647 }
26472648
26482649 long getPreferredBlockSize (String src ) throws IOException {
2650+ final String operationName = "getPreferredBlockSize" ;
26492651 checkOperation (OperationCategory .READ );
26502652 final FSPermissionChecker pc = getPermissionChecker ();
2651- FSPermissionChecker .setOperationType (null );
2653+ FSPermissionChecker .setOperationType (operationName );
26522654 readLock ();
26532655 try {
26542656 checkOperation (OperationCategory .READ );
@@ -2709,6 +2711,8 @@ HdfsFileStatus startFile(String src, PermissionStatus permissions,
27092711 String storagePolicy , boolean logRetryCache ) throws IOException {
27102712
27112713 HdfsFileStatus status ;
2714+ final String operationName = "create" ;
2715+ FSPermissionChecker .setOperationType (operationName );
27122716 try {
27132717 status = startFileInt (src , permissions , holder , clientMachine , flag ,
27142718 createParent , replication , blockSize , supportedVersions , ecPolicyName ,
@@ -2764,7 +2768,6 @@ private HdfsFileStatus startFileInt(String src,
27642768
27652769 checkOperation (OperationCategory .WRITE );
27662770 final FSPermissionChecker pc = getPermissionChecker ();
2767- FSPermissionChecker .setOperationType (null );
27682771 writeLock ();
27692772 try {
27702773 checkOperation (OperationCategory .WRITE );
@@ -2857,9 +2860,10 @@ private HdfsFileStatus startFileInt(String src,
28572860 boolean recoverLease (String src , String holder , String clientMachine )
28582861 throws IOException {
28592862 boolean skipSync = false ;
2863+ final String operationName = "recoverLease" ;
28602864 checkOperation (OperationCategory .WRITE );
28612865 final FSPermissionChecker pc = getPermissionChecker ();
2862- FSPermissionChecker .setOperationType (null );
2866+ FSPermissionChecker .setOperationType (operationName );
28632867 writeLock ();
28642868 try {
28652869 checkOperation (OperationCategory .WRITE );
@@ -3105,9 +3109,10 @@ LocatedBlock getAdditionalDatanode(String src, long fileId,
31053109 final byte storagePolicyID ;
31063110 final List <DatanodeStorageInfo > chosen ;
31073111 final BlockType blockType ;
3112+ final String operationName = "getAdditionalDatanode" ;
31083113 checkOperation (OperationCategory .WRITE );
31093114 final FSPermissionChecker pc = getPermissionChecker ();
3110- FSPermissionChecker .setOperationType (null );
3115+ FSPermissionChecker .setOperationType (operationName );
31113116 readLock ();
31123117 try {
31133118 // Changing this operation category to WRITE instead of making getAdditionalDatanode as a
@@ -3155,10 +3160,11 @@ LocatedBlock getAdditionalDatanode(String src, long fileId,
31553160 */
31563161 void abandonBlock (ExtendedBlock b , long fileId , String src , String holder )
31573162 throws IOException {
3163+ final String operationName = "abandonBlock" ;
31583164 NameNode .stateChangeLog .debug ("BLOCK* NameSystem.abandonBlock: {} of file {}" , b , src );
31593165 checkOperation (OperationCategory .WRITE );
31603166 final FSPermissionChecker pc = getPermissionChecker ();
3161- FSPermissionChecker .setOperationType (null );
3167+ FSPermissionChecker .setOperationType (operationName );
31623168 writeLock ();
31633169 try {
31643170 checkOperation (OperationCategory .WRITE );
@@ -3222,9 +3228,10 @@ boolean completeFile(final String src, String holder,
32223228 ExtendedBlock last , long fileId )
32233229 throws IOException {
32243230 boolean success = false ;
3231+ final String operationName = "completeFile" ;
32253232 checkOperation (OperationCategory .WRITE );
32263233 final FSPermissionChecker pc = getPermissionChecker ();
3227- FSPermissionChecker .setOperationType (null );
3234+ FSPermissionChecker .setOperationType (operationName );
32283235 writeLock ();
32293236 try {
32303237 checkOperation (OperationCategory .WRITE );
@@ -3666,10 +3673,11 @@ void setQuota(String src, long nsQuota, long ssQuota, StorageType type)
36663673 */
36673674 void fsync (String src , long fileId , String clientName , long lastBlockLength )
36683675 throws IOException {
3676+ final String operationName = "fsync" ;
36693677 NameNode .stateChangeLog .info ("BLOCK* fsync: " + src + " for " + clientName );
36703678 checkOperation (OperationCategory .WRITE );
36713679 final FSPermissionChecker pc = getPermissionChecker ();
3672- FSPermissionChecker .setOperationType (null );
3680+ FSPermissionChecker .setOperationType (operationName );
36733681 writeLock ();
36743682 try {
36753683 checkOperation (OperationCategory .WRITE );
0 commit comments