HDFS-13602. Add checkOperation(WRITE) checks in FSNamesystem. Contributed by Chao Sun.
(cherry picked from commit ff013d2c95
)
This commit is contained in:
parent
a468400bad
commit
2bbdf362cf
|
@ -1952,6 +1952,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
|
|
||||||
if (!isInSafeMode() && res.updateAccessTime()) {
|
if (!isInSafeMode() && res.updateAccessTime()) {
|
||||||
String src = srcArg;
|
String src = srcArg;
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
final long now = now();
|
final long now = now();
|
||||||
try {
|
try {
|
||||||
|
@ -2034,6 +2035,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
FileStatus stat = null;
|
FileStatus stat = null;
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
final FSPermissionChecker pc = getPermissionChecker();
|
final FSPermissionChecker pc = getPermissionChecker();
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
|
@ -2137,6 +2139,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
throw new UnsupportedOperationException("Symlinks not supported");
|
throw new UnsupportedOperationException("Symlinks not supported");
|
||||||
}
|
}
|
||||||
FileStatus auditStat = null;
|
FileStatus auditStat = null;
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
|
@ -5306,6 +5309,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
String clientName, ExtendedBlock oldBlock, ExtendedBlock newBlock,
|
String clientName, ExtendedBlock oldBlock, ExtendedBlock newBlock,
|
||||||
DatanodeID[] newNodes, String[] newStorageIDs, boolean logRetryCache)
|
DatanodeID[] newNodes, String[] newStorageIDs, boolean logRetryCache)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
LOG.info("updatePipeline(" + oldBlock.getLocalBlock()
|
LOG.info("updatePipeline(" + oldBlock.getLocalBlock()
|
||||||
+ ", newGS=" + newBlock.getGenerationStamp()
|
+ ", newGS=" + newBlock.getGenerationStamp()
|
||||||
+ ", newLength=" + newBlock.getNumBytes()
|
+ ", newLength=" + newBlock.getNumBytes()
|
||||||
|
@ -6605,6 +6609,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
String rootPath = null;
|
String rootPath = null;
|
||||||
BlocksMapUpdateInfo blocksToBeDeleted = null;
|
BlocksMapUpdateInfo blocksToBeDeleted = null;
|
||||||
final FSPermissionChecker pc = getPermissionChecker();
|
final FSPermissionChecker pc = getPermissionChecker();
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
|
@ -6645,6 +6650,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
checkOperation(OperationCategory.READ);
|
checkOperation(OperationCategory.READ);
|
||||||
readLock();
|
readLock();
|
||||||
try {
|
try {
|
||||||
|
checkOperation(OperationCategory.READ);
|
||||||
if (!isRollingUpgrade()) {
|
if (!isRollingUpgrade()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -6897,6 +6903,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
if (!flags.contains(CacheFlag.FORCE)) {
|
if (!flags.contains(CacheFlag.FORCE)) {
|
||||||
cacheManager.waitForRescanIfNeeded();
|
cacheManager.waitForRescanIfNeeded();
|
||||||
}
|
}
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
|
@ -6928,6 +6935,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
if (!flags.contains(CacheFlag.FORCE)) {
|
if (!flags.contains(CacheFlag.FORCE)) {
|
||||||
cacheManager.waitForRescanIfNeeded();
|
cacheManager.waitForRescanIfNeeded();
|
||||||
}
|
}
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
|
@ -6953,6 +6961,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
final String operationName = "removeCacheDirective";
|
final String operationName = "removeCacheDirective";
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
String idStr = "{id: " + Long.toString(id) + "}";
|
String idStr = "{id: " + Long.toString(id) + "}";
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
|
@ -6997,6 +7006,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
void addCachePool(CachePoolInfo req, boolean logRetryCache)
|
void addCachePool(CachePoolInfo req, boolean logRetryCache)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final String operationName = "addCachePool";
|
final String operationName = "addCachePool";
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
String poolInfoStr = null;
|
String poolInfoStr = null;
|
||||||
|
@ -7021,6 +7031,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
void modifyCachePool(CachePoolInfo req, boolean logRetryCache)
|
void modifyCachePool(CachePoolInfo req, boolean logRetryCache)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final String operationName = "modifyCachePool";
|
final String operationName = "modifyCachePool";
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
String poolNameStr = "{poolName: " +
|
String poolNameStr = "{poolName: " +
|
||||||
|
@ -7047,6 +7058,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
void removeCachePool(String cachePoolName, boolean logRetryCache)
|
void removeCachePool(String cachePoolName, boolean logRetryCache)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final String operationName = "removeCachePool";
|
final String operationName = "removeCachePool";
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
String poolNameStr = "{poolName: " + cachePoolName + "}";
|
String poolNameStr = "{poolName: " + cachePoolName + "}";
|
||||||
|
|
Loading…
Reference in New Issue