umamaheswararao commented on a change in pull request #2019:
URL: https://github.com/apache/hadoop/pull/2019#discussion_r430623477
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
##########
@@ -1211,13 +1211,29 @@ public FileStatus getFileStatus(Path f) throws
IOException {
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));
+ // For MERGE or NFLY links, the first target link is considered
+ // for fetching the FileStatus with an assumption that the permission
+ // and the owner will be the same for all the target directories.
+ Path linkedPath = new Path(link.targetDirLinkList[0].toString());
+ ChRootedFileSystem linkedFs = (ChRootedFileSystem)
+ link.getTargetFileSystem();
+ try {
+ FileStatus status = linkedFs.getMyFs().getFileStatus(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) {
+ 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));
Review comment:
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](https://issues.apache.org/jira/browse/HDFS-15370?focusedCommentId=17116927&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17116927).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]