HDFS-7028: FSDirectory should not get storage policy id from symlinks
This commit is contained in:
parent
6997c1c658
commit
4124905aa5
|
@ -1423,8 +1423,8 @@ public class FSDirectory implements Closeable {
|
||||||
HdfsFileStatus listing[] = new HdfsFileStatus[numOfListing];
|
HdfsFileStatus listing[] = new HdfsFileStatus[numOfListing];
|
||||||
for (int i=0; i<numOfListing && locationBudget>0; i++) {
|
for (int i=0; i<numOfListing && locationBudget>0; i++) {
|
||||||
INode cur = contents.get(startChild+i);
|
INode cur = contents.get(startChild+i);
|
||||||
byte curPolicy = isSuperUser ? cur.getLocalStoragePolicyID() :
|
byte curPolicy = isSuperUser && !cur.isSymlink()?
|
||||||
BlockStoragePolicy.ID_UNSPECIFIED;
|
cur.getLocalStoragePolicyID(): BlockStoragePolicy.ID_UNSPECIFIED;
|
||||||
listing[i] = createFileStatus(cur.getLocalNameBytes(), cur, needLocation,
|
listing[i] = createFileStatus(cur.getLocalNameBytes(), cur, needLocation,
|
||||||
getStoragePolicyID(curPolicy, parentStoragePolicy), snapshot,
|
getStoragePolicyID(curPolicy, parentStoragePolicy), snapshot,
|
||||||
isRawPath);
|
isRawPath);
|
||||||
|
@ -1503,7 +1503,7 @@ public class FSDirectory implements Closeable {
|
||||||
}
|
}
|
||||||
final INodesInPath inodesInPath = getLastINodeInPath(srcs, resolveLink);
|
final INodesInPath inodesInPath = getLastINodeInPath(srcs, resolveLink);
|
||||||
final INode i = inodesInPath.getINode(0);
|
final INode i = inodesInPath.getINode(0);
|
||||||
byte policyId = includeStoragePolicy && i != null ?
|
byte policyId = includeStoragePolicy && i != null && !i.isSymlink() ?
|
||||||
i.getStoragePolicyID() : BlockStoragePolicy.ID_UNSPECIFIED;
|
i.getStoragePolicyID() : BlockStoragePolicy.ID_UNSPECIFIED;
|
||||||
return i == null ? null : createFileStatus(HdfsFileStatus.EMPTY_NAME, i,
|
return i == null ? null : createFileStatus(HdfsFileStatus.EMPTY_NAME, i,
|
||||||
policyId, inodesInPath.getPathSnapshotId(), isRawPath);
|
policyId, inodesInPath.getPathSnapshotId(), isRawPath);
|
||||||
|
|
Loading…
Reference in New Issue