void checkSuperuserPrivilege(FSPermissionChecker pc) throws AccessControlException { if (isPermissionEnabled) { pc.checkSuperuserPrivilege(); } }
void checkSuperuserPrivilege() throws AccessControlException { if (isPermissionEnabled) { FSPermissionChecker pc = getPermissionChecker(); pc.checkSuperuserPrivilege(); } }
static CachePoolInfo addCachePool( FSNamesystem fsn, CacheManager cacheManager, CachePoolInfo req, boolean logRetryCache) throws IOException { final FSPermissionChecker pc = getFsPermissionChecker(fsn); if (pc != null) { pc.checkSuperuserPrivilege(); } CachePoolInfo info = cacheManager.addCachePool(req); fsn.getEditLog().logAddCachePool(info, logRetryCache); return info; }
static void modifyCachePool( FSNamesystem fsn, CacheManager cacheManager, CachePoolInfo req, boolean logRetryCache) throws IOException { final FSPermissionChecker pc = getFsPermissionChecker(fsn); if (pc != null) { pc.checkSuperuserPrivilege(); } cacheManager.modifyCachePool(req); fsn.getEditLog().logModifyCachePool(req, logRetryCache); }
static void removeCachePool( FSNamesystem fsn, CacheManager cacheManager, String cachePoolName, boolean logRetryCache) throws IOException { final FSPermissionChecker pc = getFsPermissionChecker(fsn); if (pc != null) { pc.checkSuperuserPrivilege(); } cacheManager.removeCachePool(cachePoolName); fsn.getEditLog().logRemoveCachePool(cachePoolName, logRetryCache); }
break; default: pc.checkSuperuserPrivilege(); break;
@Override public void checkSuperuserPrivilege() throws AccessControlException { if (isPermissionEnabled) { FSPermissionChecker pc = getPermissionChecker(); pc.checkSuperuserPrivilege(); } }
/** * Set the namespace, storagespace and typespace quota for a directory. * * Note: This does not support ".inodes" relative path. */ static void setQuota(FSDirectory fsd, FSPermissionChecker pc, String src, long nsQuota, long ssQuota, StorageType type) throws IOException { if (fsd.isPermissionEnabled()) { pc.checkSuperuserPrivilege(); } fsd.writeLock(); try { INodesInPath iip = fsd.resolvePath(pc, src, DirOp.WRITE); INodeDirectory changed = unprotectedSetQuota(fsd, iip, nsQuota, ssQuota, type); if (changed != null) { final QuotaCounts q = changed.getQuotaCounts(); if (type == null) { fsd.getEditLog().logSetQuota(src, q.getNameSpace(), q.getStorageSpace()); } else { fsd.getEditLog().logSetQuotaByStorageType( src, q.getTypeSpaces().get(type), type); } } } finally { fsd.writeUnlock(); } }
@Override public void checkSuperuserPrivilege() throws AccessControlException { if (isPermissionEnabled) { FSPermissionChecker pc = getPermissionChecker(); pc.checkSuperuserPrivilege(); } }
INodesInPath resolvePath(FSPermissionChecker pc, String src, boolean resolveLink) throws UnresolvedLinkException, FileNotFoundException, AccessControlException { byte[][] components = INode.getPathComponents(src); if (isPermissionEnabled && pc != null && isReservedRawName(components)) { pc.checkSuperuserPrivilege(); } components = resolveComponents(components, this); return INodesInPath.resolve(rootDir, components, resolveLink); }
static void modifyCachePool( FSNamesystem fsn, CacheManager cacheManager, CachePoolInfo req, boolean logRetryCache) throws IOException { final FSPermissionChecker pc = getFsPermissionChecker(fsn); if (pc != null) { pc.checkSuperuserPrivilege(); } cacheManager.modifyCachePool(req); fsn.getEditLog().logModifyCachePool(req, logRetryCache); }
static void removeCachePool( FSNamesystem fsn, CacheManager cacheManager, String cachePoolName, boolean logRetryCache) throws IOException { final FSPermissionChecker pc = getFsPermissionChecker(fsn); if (pc != null) { pc.checkSuperuserPrivilege(); } cacheManager.removeCachePool(cachePoolName); fsn.getEditLog().logRemoveCachePool(cachePoolName, logRetryCache); }
static void removeCachePool( FSNamesystem fsn, CacheManager cacheManager, String cachePoolName, boolean logRetryCache) throws IOException { final FSPermissionChecker pc = getFsPermissionChecker(fsn); if (pc != null) { pc.checkSuperuserPrivilege(); } cacheManager.removeCachePool(cachePoolName); fsn.getEditLog().logRemoveCachePool(cachePoolName, logRetryCache); }
static CachePoolInfo addCachePool( FSNamesystem fsn, CacheManager cacheManager, CachePoolInfo req, boolean logRetryCache) throws IOException { final FSPermissionChecker pc = getFsPermissionChecker(fsn); if (pc != null) { pc.checkSuperuserPrivilege(); } CachePoolInfo info = cacheManager.addCachePool(req); fsn.getEditLog().logAddCachePool(info, logRetryCache); return info; }
static CachePoolInfo addCachePool( FSNamesystem fsn, CacheManager cacheManager, CachePoolInfo req, boolean logRetryCache) throws IOException { final FSPermissionChecker pc = getFsPermissionChecker(fsn); if (pc != null) { pc.checkSuperuserPrivilege(); } CachePoolInfo info = cacheManager.addCachePool(req); fsn.getEditLog().logAddCachePool(info, logRetryCache); return info; }
static void modifyCachePool( FSNamesystem fsn, CacheManager cacheManager, CachePoolInfo req, boolean logRetryCache) throws IOException { final FSPermissionChecker pc = getFsPermissionChecker(fsn); if (pc != null) { pc.checkSuperuserPrivilege(); } cacheManager.modifyCachePool(req); fsn.getEditLog().logModifyCachePool(req, logRetryCache); }
INodesInPath resolvePath(FSPermissionChecker pc, String src, boolean resolveLink) throws UnresolvedLinkException, FileNotFoundException, AccessControlException { byte[][] components = INode.getPathComponents(src); if (isPermissionEnabled && pc != null && isReservedRawName(components)) { pc.checkSuperuserPrivilege(); } components = resolveComponents(components, this); return INodesInPath.resolve(rootDir, components, resolveLink); }
/** * Set the namespace, storagespace and typespace quota for a directory. * * Note: This does not support ".inodes" relative path. */ static void setQuota(FSDirectory fsd, String src, long nsQuota, long ssQuota, StorageType type) throws IOException { if (fsd.isPermissionEnabled()) { FSPermissionChecker pc = fsd.getPermissionChecker(); pc.checkSuperuserPrivilege(); } fsd.writeLock(); try { INodeDirectory changed = unprotectedSetQuota(fsd, src, nsQuota, ssQuota, type); if (changed != null) { final QuotaCounts q = changed.getQuotaCounts(); if (type == null) { fsd.getEditLog().logSetQuota(src, q.getNameSpace(), q.getStorageSpace()); } else { fsd.getEditLog().logSetQuotaByStorageType( src, q.getTypeSpaces().get(type), type); } } } finally { fsd.writeUnlock(); } }
/** * Set the namespace, storagespace and typespace quota for a directory. * * Note: This does not support ".inodes" relative path. */ static void setQuota(FSDirectory fsd, String src, long nsQuota, long ssQuota, StorageType type) throws IOException { if (fsd.isPermissionEnabled()) { FSPermissionChecker pc = fsd.getPermissionChecker(); pc.checkSuperuserPrivilege(); } fsd.writeLock(); try { INodeDirectory changed = unprotectedSetQuota(fsd, src, nsQuota, ssQuota, type); if (changed != null) { final QuotaCounts q = changed.getQuotaCounts(); if (type == null) { fsd.getEditLog().logSetQuota(src, q.getNameSpace(), q.getStorageSpace()); } else { fsd.getEditLog().logSetQuotaByStorageType( src, q.getTypeSpaces().get(type), type); } } } finally { fsd.writeUnlock(); } }