-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-17029. Return correct permission and owner for listing on internal directories in ViewFs #2019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-17029. Return correct permission and owner for listing on internal directories in ViewFs #2019
Changes from 4 commits
35cfe4e
0243a70
a7a7875
da1702a
7d43b29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1200,13 +1200,24 @@ public FileStatus[] listStatus(Path f) throws AccessControlException, | |
| INode<FileSystem> inode = iEntry.getValue(); | ||
| if (inode.isLink()) { | ||
| INodeLink<FileSystem> link = (INodeLink<FileSystem>) inode; | ||
|
|
||
| result[i++] = new FileStatus(0, false, 0, 0, | ||
| creationTime, creationTime, PERMISSION_555, | ||
| ugi.getShortUserName(), ugi.getPrimaryGroupName(), | ||
| link.getTargetLink(), | ||
| new Path(inode.fullPath).makeQualified( | ||
| myUri, null)); | ||
| try { | ||
| FileStatus status = link.getTargetFileSystem() | ||
| .getFileStatus(new Path("/")); | ||
| result[i++] = new FileStatus(status.getLen(), false, | ||
| status.getReplication(), status.getBlockSize(), | ||
| status.getModificationTime(), status.getAccessTime(), | ||
| status.getPermission(), status.getOwner(), status.getGroup(), | ||
| link.getTargetLink(), | ||
| new Path(inode.fullPath).makeQualified( | ||
| myUri, null)); | ||
| } catch (FileNotFoundException ex) { | ||
| result[i++] = new FileStatus(0, false, 0, 0, | ||
| creationTime, creationTime, PERMISSION_555, | ||
| ugi.getShortUserName(), ugi.getPrimaryGroupName(), | ||
| link.getTargetLink(), | ||
| new Path(inode.fullPath).makeQualified( | ||
| myUri, null)); | ||
|
||
| } | ||
| } else { | ||
| result[i++] = new FileStatus(0, true, 0, 0, | ||
| creationTime, creationTime, PERMISSION_555, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -917,11 +917,23 @@ public FileStatus getFileLinkStatus(final Path f) | |
| if (inode.isLink()) { | ||
| INodeLink<AbstractFileSystem> inodelink = | ||
| (INodeLink<AbstractFileSystem>) inode; | ||
| result = new FileStatus(0, false, 0, 0, creationTime, creationTime, | ||
| try { | ||
| FileStatus status = inodelink.getTargetFileSystem() | ||
| .getFileStatus(new Path("/")); | ||
| result = new FileStatus(status.getLen(), false, | ||
| status.getReplication(), status.getBlockSize(), | ||
| status.getModificationTime(), status.getAccessTime(), | ||
| status.getPermission(), status.getOwner(), status.getGroup(), | ||
| inodelink.getTargetLink(), | ||
| new Path(inode.fullPath).makeQualified( | ||
| myUri, null)); | ||
| } catch (FileNotFoundException ex) { | ||
|
||
| result = new FileStatus(0, false, 0, 0, creationTime, creationTime, | ||
| PERMISSION_555, ugi.getShortUserName(), ugi.getPrimaryGroupName(), | ||
| inodelink.getTargetLink(), | ||
| new Path(inode.fullPath).makeQualified( | ||
| myUri, null)); | ||
| } | ||
| } else { | ||
| result = new FileStatus(0, true, 0, 0, creationTime, creationTime, | ||
| PERMISSION_555, ugi.getShortUserName(), ugi.getPrimaryGroupName(), | ||
|
|
@@ -976,12 +988,24 @@ public FileStatus[] listStatus(final Path f) throws AccessControlException, | |
| INodeLink<AbstractFileSystem> link = | ||
| (INodeLink<AbstractFileSystem>) inode; | ||
|
|
||
| result[i++] = new FileStatus(0, false, 0, 0, | ||
| creationTime, creationTime, | ||
| PERMISSION_555, ugi.getShortUserName(), ugi.getPrimaryGroupName(), | ||
| link.getTargetLink(), | ||
| new Path(inode.fullPath).makeQualified( | ||
| myUri, null)); | ||
| try { | ||
| FileStatus status = link.getTargetFileSystem() | ||
| .getFileStatus(new Path("/")); | ||
| result[i++] = new FileStatus(status.getLen(), false, | ||
| status.getReplication(), status.getBlockSize(), | ||
| status.getModificationTime(), status.getAccessTime(), | ||
| status.getPermission(), status.getOwner(), status.getGroup(), | ||
| link.getTargetLink(), | ||
| new Path(inode.fullPath).makeQualified( | ||
| myUri, null)); | ||
| } catch (FileNotFoundException ex) { | ||
|
||
| result[i++] = new FileStatus(0, false, 0, 0, | ||
| creationTime, creationTime, PERMISSION_555, | ||
| ugi.getShortUserName(), ugi.getPrimaryGroupName(), | ||
| link.getTargetLink(), | ||
| new Path(inode.fullPath).makeQualified( | ||
| myUri, null)); | ||
| } | ||
| } else { | ||
| result[i++] = new FileStatus(0, true, 0, 0, | ||
| creationTime, creationTime, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we getting status on "/"? In practical scenario it should work. However what if the target uri is a file?
Should we simply use link.getTargetFileSystem().getUri() ?
Could you please check scenario? If this works, I have no other changes.
Thanks for update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to link.getTargetFileSystem().getUri(). Used ChRootedFileSystem to obtain the filestatus.
((ChRootedFileSystem)link.getTargetFileSystem()).getMyFs().getFileStatus().