|
@@ -8354,7 +8354,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
FileStatus resultingStat = null;
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
FSPermissionChecker.setOperationType(operationName);
|
|
|
- writeLock();
|
|
|
+ writeLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
checkNameNodeSafeMode("Cannot set erasure coding policy on " + srcArg);
|
|
@@ -8364,7 +8364,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
logAuditEvent(false, operationName, srcArg);
|
|
|
throw ace;
|
|
|
} finally {
|
|
|
- writeUnlock(operationName,
|
|
|
+ writeUnlock(FSNamesystemLockMode.FS, operationName,
|
|
|
getLockReportInfoSupplier(srcArg, null, resultingStat));
|
|
|
}
|
|
|
getEditLog().logSync();
|
|
@@ -8387,7 +8387,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
checkErasureCodingSupported(operationName);
|
|
|
List<AddErasureCodingPolicyResponse> responses =
|
|
|
new ArrayList<>(policies.length);
|
|
|
- writeLock();
|
|
|
+ writeLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
checkNameNodeSafeMode("Cannot add erasure coding policy");
|
|
@@ -8403,7 +8403,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
}
|
|
|
}
|
|
|
} finally {
|
|
|
- writeUnlock(operationName,
|
|
|
+ writeUnlock(FSNamesystemLockMode.FS, operationName,
|
|
|
getLockReportInfoSupplier(addECPolicyNames.toString()));
|
|
|
}
|
|
|
getEditLog().logSync();
|
|
@@ -8423,7 +8423,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
final String operationName = "removeErasureCodingPolicy";
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
checkErasureCodingSupported(operationName);
|
|
|
- writeLock();
|
|
|
+ writeLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
checkNameNodeSafeMode("Cannot remove erasure coding policy "
|
|
@@ -8431,7 +8431,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
FSDirErasureCodingOp.removeErasureCodingPolicy(this, ecPolicyName,
|
|
|
logRetryCache);
|
|
|
} finally {
|
|
|
- writeUnlock(operationName, getLockReportInfoSupplier(ecPolicyName));
|
|
|
+ writeUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(ecPolicyName));
|
|
|
}
|
|
|
getEditLog().logSync();
|
|
|
logAuditEvent(true, operationName, ecPolicyName, null, null);
|
|
@@ -8452,7 +8452,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
checkErasureCodingSupported(operationName);
|
|
|
boolean success = false;
|
|
|
try {
|
|
|
- writeLock();
|
|
|
+ writeLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
checkNameNodeSafeMode("Cannot enable erasure coding policy "
|
|
@@ -8460,7 +8460,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
success = FSDirErasureCodingOp.enableErasureCodingPolicy(this,
|
|
|
ecPolicyName, logRetryCache);
|
|
|
} finally {
|
|
|
- writeUnlock(operationName, getLockReportInfoSupplier(ecPolicyName));
|
|
|
+ writeUnlock(FSNamesystemLockMode.FS, operationName,
|
|
|
+ getLockReportInfoSupplier(ecPolicyName));
|
|
|
}
|
|
|
} catch (AccessControlException ace) {
|
|
|
logAuditEvent(false, operationName, ecPolicyName);
|
|
@@ -8487,7 +8488,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
checkErasureCodingSupported(operationName);
|
|
|
boolean success = false;
|
|
|
try {
|
|
|
- writeLock();
|
|
|
+ writeLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
checkNameNodeSafeMode("Cannot disable erasure coding policy "
|
|
@@ -8495,7 +8496,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
success = FSDirErasureCodingOp.disableErasureCodingPolicy(this,
|
|
|
ecPolicyName, logRetryCache);
|
|
|
} finally {
|
|
|
- writeUnlock(operationName, getLockReportInfoSupplier(ecPolicyName));
|
|
|
+ writeUnlock(FSNamesystemLockMode.FS, operationName,
|
|
|
+ getLockReportInfoSupplier(ecPolicyName));
|
|
|
}
|
|
|
} catch (AccessControlException ace) {
|
|
|
logAuditEvent(false, operationName, ecPolicyName);
|
|
@@ -8524,14 +8526,14 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
FileStatus resultingStat = null;
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
FSPermissionChecker.setOperationType(operationName);
|
|
|
- writeLock();
|
|
|
+ writeLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
checkNameNodeSafeMode("Cannot unset erasure coding policy on " + srcArg);
|
|
|
resultingStat = FSDirErasureCodingOp.unsetErasureCodingPolicy(this,
|
|
|
srcArg, pc, logRetryCache);
|
|
|
} finally {
|
|
|
- writeUnlock(operationName,
|
|
|
+ writeUnlock(FSNamesystemLockMode.FS, operationName,
|
|
|
getLockReportInfoSupplier(srcArg, null, resultingStat));
|
|
|
}
|
|
|
getEditLog().logSync();
|
|
@@ -8551,7 +8553,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
checkSuperuserPrivilege(operationName);
|
|
|
checkOperation(OperationCategory.UNCHECKED);
|
|
|
ECTopologyVerifierResult result;
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.UNCHECKED);
|
|
|
// If no policy name is specified return the result
|
|
@@ -8574,7 +8576,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
.getECTopologyVerifierResult(numOfRacks, numOfDataNodes, policies);
|
|
|
}
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(null));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(null));
|
|
|
}
|
|
|
logAuditEvent(true, operationName, null);
|
|
|
return result;
|
|
@@ -8591,7 +8593,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
checkErasureCodingSupported(operationName);
|
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
|
FSPermissionChecker.setOperationType(operationName);
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
final ErasureCodingPolicy ret =
|
|
@@ -8599,7 +8601,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
success = true;
|
|
|
return ret;
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(src));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(src));
|
|
|
logAuditEvent(success, operationName, src);
|
|
|
}
|
|
|
}
|
|
@@ -8612,7 +8614,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
boolean success = false;
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
checkErasureCodingSupported(operationName);
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
final ErasureCodingPolicyInfo[] ret =
|
|
@@ -8620,7 +8622,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
success = true;
|
|
|
return ret;
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(null));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(null));
|
|
|
logAuditEvent(success, operationName, null);
|
|
|
}
|
|
|
}
|
|
@@ -8633,7 +8635,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
boolean success = false;
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
checkErasureCodingSupported(operationName);
|
|
|
- readLock();
|
|
|
+ readLock(FSNamesystemLockMode.FS);
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
final Map<String, String> ret =
|
|
@@ -8641,7 +8643,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
success = true;
|
|
|
return ret;
|
|
|
} finally {
|
|
|
- readUnlock(operationName, getLockReportInfoSupplier(null));
|
|
|
+ readUnlock(FSNamesystemLockMode.FS, operationName, getLockReportInfoSupplier(null));
|
|
|
logAuditEvent(success, operationName, null);
|
|
|
}
|
|
|
}
|