HDFS-7028: FSDirectory should not get storage policy id from symlinks
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4124905a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4124905a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4124905a Branch: refs/heads/HDFS-6581 Commit: 4124905aa55a8ff3d6905fd05ccf13ef4eb37afe Parents: 6997c1c Author: Tsz-Wo Nicholas Sze <szets...@hortonworks.com> Authored: Wed Sep 10 12:34:15 2014 +0800 Committer: Tsz-Wo Nicholas Sze <szets...@hortonworks.com> Committed: Wed Sep 10 12:34:15 2014 +0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/4124905a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java index b890375..f541da5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java @@ -1423,8 +1423,8 @@ public class FSDirectory implements Closeable { HdfsFileStatus listing[] = new HdfsFileStatus[numOfListing]; for (int i=0; i<numOfListing && locationBudget>0; i++) { INode cur = contents.get(startChild+i); - byte curPolicy = isSuperUser ? cur.getLocalStoragePolicyID() : - BlockStoragePolicy.ID_UNSPECIFIED; + byte curPolicy = isSuperUser && !cur.isSymlink()? + cur.getLocalStoragePolicyID(): BlockStoragePolicy.ID_UNSPECIFIED; listing[i] = createFileStatus(cur.getLocalNameBytes(), cur, needLocation, getStoragePolicyID(curPolicy, parentStoragePolicy), snapshot, isRawPath); @@ -1503,7 +1503,7 @@ public class FSDirectory implements Closeable { } final INodesInPath inodesInPath = getLastINodeInPath(srcs, resolveLink); final INode i = inodesInPath.getINode(0); - byte policyId = includeStoragePolicy && i != null ? + byte policyId = includeStoragePolicy && i != null && !i.isSymlink() ? i.getStoragePolicyID() : BlockStoragePolicy.ID_UNSPECIFIED; return i == null ? null : createFileStatus(HdfsFileStatus.EMPTY_NAME, i, policyId, inodesInPath.getPathSnapshotId(), isRawPath);