@Override public boolean canTraverseDir(INode inode) throws IOException { if (ezManager.isEncryptionZoneRoot(inode, inode.getFullPathName())) { // nested EZ, ignore. LOG.info("{}({}) is a nested EZ, skipping for re-encryption", inode.getFullPathName(), inode.getId()); return false; } return true; }
/** * Returns the full path from an INode id. * <p/> * Called while holding the FSDirectory lock. */ String getFullPathName(Long nodeId) { assert dir.hasReadLock(); INode inode = dir.getInode(nodeId); if (inode == null) { return null; } return inode.getFullPathName(); }
assert dir.hasWriteLock(); final long zoneId = zoneNode.getId(); final String zonePath = zoneNode.getFullPathName(); final ZoneReencryptionStatus status = handler.getReencryptionStatus().getZoneStatus(zoneId);
assert dir.hasReadLock(); if (LOG.isTraceEnabled()) { LOG.trace("Processing {} for re-encryption", inode.getFullPathName()); if (LOG.isDebugEnabled()) { LOG.debug("File {} skipped re-encryption because edek's key version" + " name is not changed.", inode.getFullPathName());
static void removeSPSXattr(FSDirectory fsd, INode inode, XAttr spsXAttr) throws IOException { try { fsd.writeLock(); List<XAttr> existingXAttrs = XAttrStorage.readINodeXAttrs(inode); existingXAttrs.remove(spsXAttr); XAttrStorage.updateINodeXAttrs(inode, existingXAttrs, INodesInPath .fromINode(inode).getLatestSnapshotId()); List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1); xAttrs.add(spsXAttr); fsd.getEditLog().logRemoveXAttrs(inode.getFullPathName(), xAttrs, false); } finally { fsd.writeUnlock(); } } }
List<XAttr> completeReencryption(final INode zoneNode) throws IOException { assert dir.hasWriteLock(); assert dir.getFSNamesystem().hasWriteLock(); final Long zoneId = zoneNode.getId(); ZoneReencryptionStatus zs = getReencryptionStatus().getZoneStatus(zoneId); assert zs != null; LOG.info("Re-encryption completed on zone {}. Re-encrypted {} files," + " failures encountered: {}.", zoneNode.getFullPathName(), zs.getFilesReencrypted(), zs.getNumReencryptionFailures()); synchronized (this) { submissions.remove(zoneId); } return FSDirEncryptionZoneOp .updateReencryptionFinish(dir, INodesInPath.fromINode(zoneNode), zs); }
/** * Save the batch's edeks to file xattrs. */ static void saveFileXAttrsForBatch(FSDirectory fsd, List<FileEdekInfo> batch) { assert fsd.getFSNamesystem().hasWriteLock(); assert !fsd.hasWriteLock(); if (batch != null && !batch.isEmpty()) { for (FileEdekInfo entry : batch) { final INode inode = fsd.getInode(entry.getInodeId()); // no dir lock, so inode could be removed. no-op if so. if (inode == null) { NameNode.LOG.info("Cannot find inode {}, skip saving xattr for" + " re-encryption", entry.getInodeId()); continue; } fsd.getEditLog().logSetXAttrs(inode.getFullPathName(), inode.getXAttrFeature().getXAttrs(), false); } } }
Preconditions.checkPositionIndex(groupEntryIndex, featureEntries.size(), "Invalid group entry index after binary-searching inode: " + inode.getFullPathName() + "(" + inode.getId() + ") " + "with featureEntries:" + featureEntries); FsAction groupPerm = featureEntries.get(groupEntryIndex).getPermission();
} catch (AccessControlException ace) { throw new AccessControlException( toAccessControlString(inode, inode.getFullPathName(), access));
"Skipping satisfy storage policy on path:{} as " + "this file doesn't have any blocks!", inode.getFullPathName()); + inode.getFullPathName() + ", as this file/dir was already called for satisfying " + "storage policy.");
assert zs != null; LOG.info("Re-encrypting zone {}(id={})", zoneNode.getFullPathName(), zoneId); if (zs.getLastCheckpointFile() == null) {
zonePath = zoneNode.getFullPathName(); LOG.info("Processing returned re-encryption task for zone {}({}), " + "batch size {}, start:{}", zonePath, task.zoneId,
+ inode.getFullPathName(), ioe); return "";
"Dangling child pointer found. Missing INode in " + "inodeMap: id=" + inode.getId() + "; path=" + inode.getFullPathName() + "; parent=" + (inode.getParent() == null ? "null" : inode.getParent().getFullPathName()));
throw new AclException( "Invalid ACL: only directories may have a default ACL. " + "Path: " + inode.getFullPathName());
/** * To check if the request id is the same as saved id. Don't check fileId * with GRANDFATHER_INODE_ID for backward compatibility. */ public static void checkId(long requestId, INode inode) throws FileNotFoundException { if (requestId != GRANDFATHER_INODE_ID && requestId != inode.getId()) { throw new FileNotFoundException( "ID mismatch. Request id and saved id: " + requestId + " , " + inode.getId() + " for file " + inode.getFullPathName()); } }
/** * To check if the request id is the same as saved id. Don't check fileId * with GRANDFATHER_INODE_ID for backward compatibility. */ public static void checkId(long requestId, INode inode) throws FileNotFoundException { if (requestId != GRANDFATHER_INODE_ID && requestId != inode.getId()) { throw new FileNotFoundException( "ID mismatch. Request id and saved id: " + requestId + " , " + inode.getId() + " for file " + inode.getFullPathName()); } }
/** * Returns the path of the EncryptionZoneInt. * <p/> * Called while holding the FSDirectory lock. */ private String getFullPathName(EncryptionZoneInt ezi) { assert dir.hasReadLock(); return dir.getInode(ezi.getINodeId()).getFullPathName(); }
/** * Returns the path of the EncryptionZoneInt. * <p/> * Called while holding the FSDirectory lock. */ private String getFullPathName(EncryptionZoneInt ezi) { assert dir.hasReadLock(); return dir.getInode(ezi.getINodeId()).getFullPathName(); }
assertEquals(nodesInPath.getINode(components.length - 1).getFullPathName(), file1.toString()); assertEquals(nodesInPath.getINode(components.length - 2).getFullPathName(), sub1.toString()); assertEquals(nodesInPath.getINode(components.length - 3).getFullPathName(), dir.toString()); assertEquals(nodesInPath.length(), components.length); assertSnapshot(nodesInPath, false, null, -1); assertEquals(nodesInPath.getLastINode().getFullPathName(), file1.toString());