-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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 all 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 |
---|---|---|
|
@@ -917,11 +917,25 @@ 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 { | ||
String linkedPath = inodelink.getTargetFileSystem() | ||
.getUri().getPath(); | ||
FileStatus status = ((ChRootedFs)inodelink.getTargetFileSystem()) | ||
.getMyFs().getFileStatus(new Path(linkedPath)); | ||
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar comment regarding FileNotFoundException. I think in general, it's better to match behavior of non-federated client. If a path does not exist, just throw back FileNotFoundException. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I just verified symlinks. When target deleted, ls on symlink does not throw FNFE. Instead it is converted to file link. I tested dir->dir link.
|
||
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 +990,25 @@ 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 { | ||
String linkedPath = link.getTargetFileSystem().getUri().getPath(); | ||
FileStatus status = ((ChRootedFs)link.getTargetFileSystem()) | ||
.getMyFs().getFileStatus(new Path(linkedPath)); | ||
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment about FileNotFoundException here |
||
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.
two comments:
If this is the case, I wonder if it makes more sense to just skip this mount, by not adding a FileStatus for mount at all. So that clients do not get confused by an actually non-existing FileStatus, among other existing ones. But one issue here would be that result array is strictly the size of the # of mounts. Creating result as a list, append, and then return as a array may resolve this.
Uh oh!
There was an error while loading. Please reload this page.
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.
For # 2: The problem here I think we may not be able reset mount automatically, so until some one checks file exists or do op on target, we will not know whether the file exists or not. This will continue until user updates mount points accordingly.
This can be possible when some one deletes the target directory directly but not updated the mount tables accordingly. Please check one of my comment on behavior of ls in MAC. Also we have other issue: isDir is inconsistent.
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.
Sorry if I am missing anything. The change with catching the
FileNotFoundException
is good ? or I need to make a change.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.
Sorry if I am missing anything. The change with catching the FileNotFoundException is good ? or I need to change something. @umamaheswararao
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.
IMO, FileNotFoundException is fine. Please see my comment below https://github.com/apache/hadoop/pull/2019/files#r430611396
@chliang71 , What do you say?