static List<AclEntry> unprotectedSetAcl(FSDirectory fsd, INodesInPath iip, List<AclEntry> aclSpec, boolean fromEdits) throws IOException { assert fsd.hasWriteLock(); // ACL removal is logged to edits as OP_SET_ACL with an empty list. if (aclSpec.isEmpty()) { unprotectedRemoveAcl(fsd, iip); return AclFeature.EMPTY_ENTRY_LIST; } INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> newAcl = aclSpec; if (!fromEdits) { List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); newAcl = AclTransformation.replaceAclEntries(existingAcl, aclSpec); } AclStorage.updateINodeAcl(inode, newAcl, snapshotId); return newAcl; }
/** * Add create directory record to edit log */ public void logMkDir(String path, INode newNode) { PermissionStatus permissions = newNode.getPermissionStatus(); MkdirOp op = MkdirOp.getInstance(cache.get()) .setInodeId(newNode.getId()) .setPath(path) .setTimestamp(newNode.getModificationTime()) .setPermissionStatus(permissions); AclFeature f = newNode.getAclFeature(); if (f != null) { op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode)); } XAttrFeature x = newNode.getXAttrFeature(); if (x != null) { op.setXAttrs(x.getXAttrs()); } logEdit(op); }
static FileStatus removeAclEntries( FSDirectory fsd, FSPermissionChecker pc, final String srcArg, List<AclEntry> aclSpec) throws IOException { String src = srcArg; checkAclsConfigFlag(fsd); INodesInPath iip; fsd.writeLock(); try { iip = fsd.resolvePath(pc, src, DirOp.WRITE); src = iip.getPath(); fsd.checkOwner(pc, iip); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); List<AclEntry> newAcl = AclTransformation.filterAclEntriesByAclSpec( existingAcl, aclSpec); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); } catch (AclException e){ throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.writeUnlock(); } return fsd.getAuditFileInfo(iip); }
static FileStatus removeDefaultAcl(FSDirectory fsd, FSPermissionChecker pc, final String srcArg) throws IOException { String src = srcArg; checkAclsConfigFlag(fsd); INodesInPath iip; fsd.writeLock(); try { iip = fsd.resolvePath(pc, src, DirOp.WRITE); src = iip.getPath(); fsd.checkOwner(pc, iip); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); List<AclEntry> newAcl = AclTransformation.filterDefaultAclEntries( existingAcl); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); } catch (AclException e){ throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.writeUnlock(); } return fsd.getAuditFileInfo(iip); }
static FileStatus modifyAclEntries( FSDirectory fsd, FSPermissionChecker pc, final String srcArg, List<AclEntry> aclSpec) throws IOException { String src = srcArg; checkAclsConfigFlag(fsd); INodesInPath iip; fsd.writeLock(); try { iip = fsd.resolvePath(pc, src, DirOp.WRITE); src = iip.getPath(); fsd.checkOwner(pc, iip); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); List<AclEntry> newAcl = AclTransformation.mergeAclEntries( existingAcl, aclSpec); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); } catch (AclException e){ throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.writeUnlock(); } return fsd.getAuditFileInfo(iip); }
op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode));
static List<AclEntry> unprotectedSetAcl( FSDirectory fsd, String src, List<AclEntry> aclSpec, boolean fromEdits) throws IOException { assert fsd.hasWriteLock(); final INodesInPath iip = fsd.getINodesInPath4Write( FSDirectory.normalizePath(src), true); // ACL removal is logged to edits as OP_SET_ACL with an empty list. if (aclSpec.isEmpty()) { unprotectedRemoveAcl(fsd, iip); return AclFeature.EMPTY_ENTRY_LIST; } INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> newAcl = aclSpec; if (!fromEdits) { List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); newAcl = AclTransformation.replaceAclEntries(existingAcl, aclSpec); } AclStorage.updateINodeAcl(inode, newAcl, snapshotId); return newAcl; }
static List<AclEntry> unprotectedSetAcl( FSDirectory fsd, String src, List<AclEntry> aclSpec, boolean fromEdits) throws IOException { assert fsd.hasWriteLock(); final INodesInPath iip = fsd.getINodesInPath4Write( FSDirectory.normalizePath(src), true); // ACL removal is logged to edits as OP_SET_ACL with an empty list. if (aclSpec.isEmpty()) { unprotectedRemoveAcl(fsd, iip); return AclFeature.EMPTY_ENTRY_LIST; } INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> newAcl = aclSpec; if (!fromEdits) { List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); newAcl = AclTransformation.replaceAclEntries(existingAcl, aclSpec); } AclStorage.updateINodeAcl(inode, newAcl, snapshotId); return newAcl; }
/** * Add create directory record to edit log */ public void logMkDir(String path, INode newNode) { PermissionStatus permissions = newNode.getPermissionStatus(); MkdirOp op = MkdirOp.getInstance(cache.get()) .setInodeId(newNode.getId()) .setPath(path) .setTimestamp(newNode.getModificationTime()) .setPermissionStatus(permissions); AclFeature f = newNode.getAclFeature(); if (f != null) { op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode)); } XAttrFeature x = newNode.getXAttrFeature(); if (x != null) { op.setXAttrs(x.getXAttrs()); } logEdit(op); }
/** * Add create directory record to edit log */ public void logMkDir(String path, INode newNode) { PermissionStatus permissions = newNode.getPermissionStatus(); MkdirOp op = MkdirOp.getInstance(cache.get()) .setInodeId(newNode.getId()) .setPath(path) .setTimestamp(newNode.getModificationTime()) .setPermissionStatus(permissions); AclFeature f = newNode.getAclFeature(); if (f != null) { op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode)); } XAttrFeature x = newNode.getXAttrFeature(); if (x != null) { op.setXAttrs(x.getXAttrs()); } logEdit(op); }
static HdfsFileStatus removeDefaultAcl(FSDirectory fsd, final String srcArg) throws IOException { String src = srcArg; checkAclsConfigFlag(fsd); FSPermissionChecker pc = fsd.getPermissionChecker(); INodesInPath iip; fsd.writeLock(); try { iip = fsd.resolvePathForWrite(pc, src); src = iip.getPath(); fsd.checkOwner(pc, iip); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); List<AclEntry> newAcl = AclTransformation.filterDefaultAclEntries( existingAcl); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); } finally { fsd.writeUnlock(); } return fsd.getAuditFileInfo(iip); }
static HdfsFileStatus modifyAclEntries( FSDirectory fsd, final String srcArg, List<AclEntry> aclSpec) throws IOException { String src = srcArg; checkAclsConfigFlag(fsd); FSPermissionChecker pc = fsd.getPermissionChecker(); INodesInPath iip; fsd.writeLock(); try { iip = fsd.resolvePathForWrite(pc, src); src = iip.getPath(); fsd.checkOwner(pc, iip); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); List<AclEntry> newAcl = AclTransformation.mergeAclEntries( existingAcl, aclSpec); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); } finally { fsd.writeUnlock(); } return fsd.getAuditFileInfo(iip); }
static HdfsFileStatus removeAclEntries( FSDirectory fsd, final String srcArg, List<AclEntry> aclSpec) throws IOException { String src = srcArg; checkAclsConfigFlag(fsd); FSPermissionChecker pc = fsd.getPermissionChecker(); INodesInPath iip; fsd.writeLock(); try { iip = fsd.resolvePathForWrite(pc, src); src = iip.getPath(); fsd.checkOwner(pc, iip); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); List<AclEntry> newAcl = AclTransformation.filterAclEntriesByAclSpec( existingAcl, aclSpec); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); } finally { fsd.writeUnlock(); } return fsd.getAuditFileInfo(iip); }
static HdfsFileStatus removeDefaultAcl(FSDirectory fsd, final String srcArg) throws IOException { String src = srcArg; checkAclsConfigFlag(fsd); FSPermissionChecker pc = fsd.getPermissionChecker(); INodesInPath iip; fsd.writeLock(); try { iip = fsd.resolvePathForWrite(pc, src); src = iip.getPath(); fsd.checkOwner(pc, iip); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); List<AclEntry> newAcl = AclTransformation.filterDefaultAclEntries( existingAcl); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); } finally { fsd.writeUnlock(); } return fsd.getAuditFileInfo(iip); }
static HdfsFileStatus modifyAclEntries( FSDirectory fsd, final String srcArg, List<AclEntry> aclSpec) throws IOException { String src = srcArg; checkAclsConfigFlag(fsd); FSPermissionChecker pc = fsd.getPermissionChecker(); INodesInPath iip; fsd.writeLock(); try { iip = fsd.resolvePathForWrite(pc, src); src = iip.getPath(); fsd.checkOwner(pc, iip); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); List<AclEntry> newAcl = AclTransformation.mergeAclEntries( existingAcl, aclSpec); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); } finally { fsd.writeUnlock(); } return fsd.getAuditFileInfo(iip); }
static HdfsFileStatus removeAclEntries( FSDirectory fsd, final String srcArg, List<AclEntry> aclSpec) throws IOException { String src = srcArg; checkAclsConfigFlag(fsd); FSPermissionChecker pc = fsd.getPermissionChecker(); INodesInPath iip; fsd.writeLock(); try { iip = fsd.resolvePathForWrite(pc, src); src = iip.getPath(); fsd.checkOwner(pc, iip); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); List<AclEntry> existingAcl = AclStorage.readINodeLogicalAcl(inode); List<AclEntry> newAcl = AclTransformation.filterAclEntriesByAclSpec( existingAcl, aclSpec); AclStorage.updateINodeAcl(inode, newAcl, snapshotId); fsd.getEditLog().logSetAcl(src, newAcl); } finally { fsd.writeUnlock(); } return fsd.getAuditFileInfo(iip); }
op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode));
op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode));