diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 2015c19f194..5f43596d3db 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -399,6 +399,9 @@ Branch-2 ( Unreleased changes ) HDFS-3574. Fix small race and do some cleanup in GetImageServlet (todd) + HDFS-3581. FSPermissionChecker#checkPermission sticky bit check + missing range check. (eli) + BREAKDOWN OF HDFS-3042 SUBTASKS HDFS-2185. HDFS portion of ZK-based FailoverController (todd) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java index a60061b4b41..fd706b73350 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java @@ -127,10 +127,10 @@ class FSPermissionChecker { ancestorIndex--); checkTraverse(inodes, ancestorIndex); - if(parentAccess != null && parentAccess.implies(FsAction.WRITE) - && inodes[inodes.length - 1] != null) + if (parentAccess != null && parentAccess.implies(FsAction.WRITE) + && inodes.length > 1 && inodes[inodes.length - 1] != null) { checkStickyBit(inodes[inodes.length - 2], inodes[inodes.length - 1]); - + } if (ancestorAccess != null && inodes.length > 1) { check(inodes, ancestorIndex, ancestorAccess); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java index b49818cd685..2f65c1f0de4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java @@ -259,8 +259,8 @@ public class TestWebHdfsFileSystemContract extends FileSystemContractBaseTest { assertTrue(status != null); assertEquals(0777, status.getPermission().toShort()); - //delete root - disabled due to a sticky bit bug - //assertFalse(fs.delete(root, true)); + //delete root + assertFalse(fs.delete(root, true)); //create file using root path try {