From c7101fe21ba7b9aa589f0a9266ed34356f30b35f Mon Sep 17 00:00:00 2001 From: Miklos Szegedi Date: Fri, 2 Feb 2018 11:38:21 -0800 Subject: [PATCH] YARN-7879. NM user is unable to access the application filecache due to permissions. Contributed by Jason Lowe. --- .../main/java/org/apache/hadoop/yarn/util/FSDownload.java | 7 ++----- .../java/org/apache/hadoop/yarn/util/TestFSDownload.java | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java index 508440a5f36..d203f65b93d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java @@ -401,7 +401,7 @@ public class FSDownload implements Callable { } final Path destinationTmp = new Path(destDirPath + "_tmp"); - createDir(destinationTmp, PRIVATE_DIR_PERMS); + createDir(destinationTmp, cachePerms); Path dFinal = files.makeQualified(new Path(destinationTmp, sCopy.getName())); try { @@ -416,10 +416,7 @@ public class FSDownload implements Callable { } }); } - Path destinationTmpfilesQualified = files.makeQualified(destinationTmp); - changePermissions( - destinationTmpfilesQualified.getFileSystem(conf), - destinationTmpfilesQualified); + changePermissions(dFinal.getFileSystem(conf), dFinal); files.rename(destinationTmp, destDirPath, Rename.OVERWRITE); if (LOG.isDebugEnabled()) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java index fa8c0398cf3..08d6189289d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java @@ -451,7 +451,7 @@ public class TestFSDownload { FileStatus status = files.getFileStatus(localized.getParent()); FsPermission perm = status.getPermission(); assertEquals("Cache directory permissions are incorrect", - new FsPermission((short)0700), perm); + new FsPermission((short)0755), perm); status = files.getFileStatus(localized); perm = status.getPermission();