You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2022/05/08 20:29:43 UTC

[hbase] branch branch-2.4 updated: HBASE-26994 MasterFileSystem create directory without permission check (#4391)

This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new bba83dc931 HBASE-26994 MasterFileSystem create directory without permission check (#4391)
bba83dc931 is described below

commit bba83dc931a900e742afa1a376c6c3a83e72920c
Author: skysiders <64...@users.noreply.github.com>
AuthorDate: Mon May 9 04:26:53 2022 +0800

    HBASE-26994 MasterFileSystem create directory without permission check (#4391)
    
    Signed-off-by: Viraj Jasani <vj...@apache.org>
---
 .../hadoop/hbase/master/MasterFileSystem.java      | 23 +++++++++++-----------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
index be46ac1821..5b210df4b2 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
@@ -330,16 +330,15 @@ public class MasterFileSystem {
           throw new IOException("HBase directory '" + p + "' creation failure.");
         }
       }
-    } else {
-      if (isSecurityEnabled && !dirPerms.equals(fs.getFileStatus(p).getPermission())) {
-        // check whether the permission match
-        LOG.warn("Found HBase directory permissions NOT matching expected permissions for "
-          + p.toString() + " permissions=" + fs.getFileStatus(p).getPermission() + ", expecting "
-          + dirPerms + ". Automatically setting the permissions. "
-          + "You can change the permissions by setting \"" + dirPermsConfName
-          + "\" in hbase-site.xml " + "and restarting the master");
-        fs.setPermission(p, dirPerms);
-      }
+    }
+    if (isSecurityEnabled && !dirPerms.equals(fs.getFileStatus(p).getPermission())) {
+      // check whether the permission match
+      LOG.warn("Found HBase directory permissions NOT matching expected permissions for "
+        + p.toString() + " permissions=" + fs.getFileStatus(p).getPermission() + ", expecting "
+        + dirPerms + ". Automatically setting the permissions. "
+        + "You can change the permissions by setting \"" + dirPermsConfName
+        + "\" in hbase-site.xml " + "and restarting the master");
+      fs.setPermission(p, dirPerms);
     }
   }
 
@@ -354,9 +353,9 @@ public class MasterFileSystem {
         if (!this.fs.mkdirs(p, HiddenDirPerms)) {
           throw new IOException("Failed to create staging directory " + p.toString());
         }
-      } else {
-        this.fs.setPermission(p, HiddenDirPerms);
       }
+      this.fs.setPermission(p, HiddenDirPerms);
+
     } catch (IOException e) {
       LOG.error("Failed to create or set permission on staging directory " + p.toString());
       throw new IOException(