HDFS-6890. NFS readdirplus doesn't return dotdot attributes. Contributed by Brandon Li

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1619500 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Li 2014-08-21 17:53:54 +00:00
parent e5e9d792c7
commit 7b28f363b1
2 changed files with 6 additions and 2 deletions

View File

@ -1643,6 +1643,7 @@ READDIRPLUS3Response readdirplus(XDR xdr, SecurityHandler securityHandler,
DirectoryListing dlisting = null; DirectoryListing dlisting = null;
Nfs3FileAttributes postOpDirAttr = null; Nfs3FileAttributes postOpDirAttr = null;
long dotdotFileId = 0; long dotdotFileId = 0;
HdfsFileStatus dotdotStatus = null;
try { try {
String dirFileIdPath = Nfs3Utils.getFileIdPath(handle); String dirFileIdPath = Nfs3Utils.getFileIdPath(handle);
dirStatus = dfsClient.getFileInfo(dirFileIdPath); dirStatus = dfsClient.getFileInfo(dirFileIdPath);
@ -1678,7 +1679,7 @@ READDIRPLUS3Response readdirplus(XDR xdr, SecurityHandler securityHandler,
if (cookie == 0) { if (cookie == 0) {
// Get dotdot fileId // Get dotdot fileId
String dotdotFileIdPath = dirFileIdPath + "/.."; String dotdotFileIdPath = dirFileIdPath + "/..";
HdfsFileStatus dotdotStatus = dfsClient.getFileInfo(dotdotFileIdPath); dotdotStatus = dfsClient.getFileInfo(dotdotFileIdPath);
if (dotdotStatus == null) { if (dotdotStatus == null) {
// This should not happen // This should not happen
@ -1723,7 +1724,8 @@ READDIRPLUS3Response readdirplus(XDR xdr, SecurityHandler securityHandler,
postOpDirAttr.getFileId(), ".", 0, postOpDirAttr, new FileHandle( postOpDirAttr.getFileId(), ".", 0, postOpDirAttr, new FileHandle(
postOpDirAttr.getFileId())); postOpDirAttr.getFileId()));
entries[1] = new READDIRPLUS3Response.EntryPlus3(dotdotFileId, "..", entries[1] = new READDIRPLUS3Response.EntryPlus3(dotdotFileId, "..",
dotdotFileId, postOpDirAttr, new FileHandle(dotdotFileId)); dotdotFileId, Nfs3Utils.getNfs3FileAttrFromFileStatus(dotdotStatus,
iug), new FileHandle(dotdotFileId));
for (int i = 2; i < n + 2; i++) { for (int i = 2; i < n + 2; i++) {
long fileId = fstatus[i - 2].getFileId(); long fileId = fstatus[i - 2].getFileId();

View File

@ -626,6 +626,8 @@ Release 2.6.0 - UNRELEASED
HDFS-6870. Blocks and INodes could leak for Rename with overwrite flag. (Yi HDFS-6870. Blocks and INodes could leak for Rename with overwrite flag. (Yi
Liu via jing9) Liu via jing9)
HDFS-6890. NFS readdirplus doesn't return dotdot attributes (brandonli)
Release 2.5.0 - 2014-08-11 Release 2.5.0 - 2014-08-11
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES