public static boolean isExactReservedName(byte[][] components) { return CHECK_RESERVED_FILE_NAMES && (components.length == 2) && isReservedName(components); }
static boolean isReservedRawName(byte[][] components) { return (components.length > 2) && isReservedName(components) && Arrays.equals(RAW, components[2]); }
if (isReservedName(dir)) { LOG.error("{} ignoring reserved path {}", errorString, dir); } else {
FSDirectory fsd) throws FileNotFoundException { final int nComponents = pathComponents.length; if (nComponents < 3 || !isReservedName(pathComponents)) {
(FSDirectory.isReservedName(src) && !FSDirectory.isReservedRawName(src) && !FSDirectory.isReservedInodesName(src))) {
private void addToParent(INodeDirectory parent, INode child) { if (parent == dir.rootDir && FSDirectory.isReservedName(child)) { throw new HadoopIllegalArgumentException("File name \"" + child.getLocalName() + "\" is reserved. Please " + " change the name of the existing file or directory to another " + "name before upgrading to this release."); } // NOTE: This does not update space counts for parents if (!parent.addChild(child)) { return; } dir.cacheName(child); if (child.isFile()) { updateBlocksMap(child.asFile(), fsn.getBlockManager()); } }
public static boolean isExactReservedName(byte[][] components) { return CHECK_RESERVED_FILE_NAMES && (components.length == 2) && isReservedName(components); }
public static boolean isExactReservedName(byte[][] components) { return CHECK_RESERVED_FILE_NAMES && (components.length == 2) && isReservedName(components); }
throw new InvalidPathException("Invalid link name: " + link); if (FSDirectory.isReservedName(target) || target.isEmpty() || FSDirectory.isExactReservedName(target)) { throw new InvalidPathException("Invalid target name: " + target);
static boolean isReservedRawName(byte[][] components) { return (components.length > 2) && isReservedName(components) && Arrays.equals(RAW, components[2]); }
static boolean isReservedRawName(byte[][] components) { return (components.length > 2) && isReservedName(components) && Arrays.equals(RAW, components[2]); }
static DirectoryListing getListingInt(FSDirectory fsd, FSPermissionChecker pc, final String srcArg, byte[] startAfter, boolean needLocation) throws IOException { final INodesInPath iip = fsd.resolvePath(pc, srcArg, DirOp.READ); // Get file name when startAfter is an INodePath. This is not the // common case so avoid any unnecessary processing unless required. if (startAfter.length > 0 && startAfter[0] == Path.SEPARATOR_CHAR) { final String startAfterString = DFSUtil.bytes2String(startAfter); if (FSDirectory.isReservedName(startAfterString)) { try { byte[][] components = INode.getPathComponents(startAfterString); components = FSDirectory.resolveComponents(components, fsd); startAfter = components[components.length - 1]; } catch (IOException e) { // Possibly the inode is deleted throw new DirectoryListingStartAfterNotFoundException( "Can't find startAfter " + startAfterString); } } } boolean isSuperUser = true; if (fsd.isPermissionEnabled()) { if (iip.getLastINode() != null && iip.getLastINode().isDirectory()) { fsd.checkPathAccess(pc, iip, FsAction.READ_EXECUTE); } isSuperUser = pc.isSuperUser(); } return getListing(fsd, iip, startAfter, needLocation, isSuperUser); }
INodeFile oldnode = null; boolean inSnapshot = false; if (path != null && FSDirectory.isReservedName(path) && NameNodeLayoutVersion.supports( LayoutVersion.Feature.ADD_INODE_ID, getLayoutVersion())) {
if (pos == 1 && existing.getINode(0) == rootDir && isReservedName(inode)) { throw new HadoopIllegalArgumentException( "File name \"" + inode.getLocalName() + "\" is reserved and cannot "
private void addToParent(INodeDirectory parent, INode child) { if (parent == dir.rootDir && FSDirectory.isReservedName(child)) { throw new HadoopIllegalArgumentException("File name \"" + child.getLocalName() + "\" is reserved. Please " + " change the name of the existing file or directory to another " + "name before upgrading to this release."); } // NOTE: This does not update space counts for parents if (!parent.addChild(child)) { return; } dir.cacheName(child); if (child.isFile()) { updateBlocksMap(child.asFile(), fsn.getBlockManager()); } }
private void addToParent(INodeDirectory parent, INode child) { if (parent == dir.rootDir && FSDirectory.isReservedName(child)) { throw new HadoopIllegalArgumentException("File name \"" + child.getLocalName() + "\" is reserved. Please " + " change the name of the existing file or directory to another " + "name before upgrading to this release."); } // NOTE: This does not update space counts for parents if (!parent.addChild(child)) { return; } dir.cacheName(child); if (child.isFile()) { updateBlocksMap(child.asFile(), fsn.getBlockManager()); } }
throw new InvalidPathException("Invalid link name: " + link); if (FSDirectory.isReservedName(target) || target.isEmpty()) { throw new InvalidPathException("Invalid target name: " + target);
static DirectoryListing getListingInt(FSDirectory fsd, final String srcArg, byte[] startAfter, boolean needLocation) throws IOException { FSPermissionChecker pc = fsd.getPermissionChecker(); final String startAfterString = DFSUtil.bytes2String(startAfter); final INodesInPath iip = fsd.resolvePath(pc, srcArg); final String src = iip.getPath(); // Get file name when startAfter is an INodePath if (FSDirectory.isReservedName(startAfterString)) { try { String tmp = FSDirectory.resolvePath(startAfterString, fsd); byte[][] regularPath = INode.getPathComponents(tmp); startAfter = regularPath[regularPath.length - 1]; } catch (IOException e) { // Possibly the inode is deleted throw new DirectoryListingStartAfterNotFoundException( "Can't find startAfter " + startAfterString); } } boolean isSuperUser = true; if (fsd.isPermissionEnabled()) { if (iip.getLastINode() != null && iip.getLastINode().isDirectory()) { fsd.checkPathAccess(pc, iip, FsAction.READ_EXECUTE); } else { fsd.checkTraverse(pc, iip); } isSuperUser = pc.isSuperUser(); } return getListing(fsd, iip, src, startAfter, needLocation, isSuperUser); }
static DirectoryListing getListingInt(FSDirectory fsd, final String srcArg, byte[] startAfter, boolean needLocation) throws IOException { FSPermissionChecker pc = fsd.getPermissionChecker(); final String startAfterString = DFSUtil.bytes2String(startAfter); final INodesInPath iip = fsd.resolvePath(pc, srcArg); final String src = iip.getPath(); // Get file name when startAfter is an INodePath if (FSDirectory.isReservedName(startAfterString)) { try { String tmp = FSDirectory.resolvePath(startAfterString, fsd); byte[][] regularPath = INode.getPathComponents(tmp); startAfter = regularPath[regularPath.length - 1]; } catch (IOException e) { // Possibly the inode is deleted throw new DirectoryListingStartAfterNotFoundException( "Can't find startAfter " + startAfterString); } } boolean isSuperUser = true; if (fsd.isPermissionEnabled()) { if (iip.getLastINode() != null && iip.getLastINode().isDirectory()) { fsd.checkPathAccess(pc, iip, FsAction.READ_EXECUTE); } else { fsd.checkTraverse(pc, iip); } isSuperUser = pc.isSuperUser(); } return getListing(fsd, iip, src, startAfter, needLocation, isSuperUser); }
INodeFile oldnode = null; boolean inSnapshot = false; if (path != null && FSDirectory.isReservedName(path) && NameNodeLayoutVersion.supports( LayoutVersion.Feature.ADD_INODE_ID, getLayoutVersion())) {