Skip to content

Commit bba83dc

Browse files
skysidersvirajjasani
authored andcommitted
HBASE-26994 MasterFileSystem create directory without permission check (#4391)
Signed-off-by: Viraj Jasani <[email protected]>
1 parent daaf5ad commit bba83dc

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,15 @@ private void checkSubDir(final Path p, final String dirPermsConfName) throws IOE
330330
throw new IOException("HBase directory '" + p + "' creation failure.");
331331
}
332332
}
333-
} else {
334-
if (isSecurityEnabled && !dirPerms.equals(fs.getFileStatus(p).getPermission())) {
335-
// check whether the permission match
336-
LOG.warn("Found HBase directory permissions NOT matching expected permissions for "
337-
+ p.toString() + " permissions=" + fs.getFileStatus(p).getPermission() + ", expecting "
338-
+ dirPerms + ". Automatically setting the permissions. "
339-
+ "You can change the permissions by setting \"" + dirPermsConfName
340-
+ "\" in hbase-site.xml " + "and restarting the master");
341-
fs.setPermission(p, dirPerms);
342-
}
333+
}
334+
if (isSecurityEnabled && !dirPerms.equals(fs.getFileStatus(p).getPermission())) {
335+
// check whether the permission match
336+
LOG.warn("Found HBase directory permissions NOT matching expected permissions for "
337+
+ p.toString() + " permissions=" + fs.getFileStatus(p).getPermission() + ", expecting "
338+
+ dirPerms + ". Automatically setting the permissions. "
339+
+ "You can change the permissions by setting \"" + dirPermsConfName
340+
+ "\" in hbase-site.xml " + "and restarting the master");
341+
fs.setPermission(p, dirPerms);
343342
}
344343
}
345344

@@ -354,9 +353,9 @@ private void checkStagingDir() throws IOException {
354353
if (!this.fs.mkdirs(p, HiddenDirPerms)) {
355354
throw new IOException("Failed to create staging directory " + p.toString());
356355
}
357-
} else {
358-
this.fs.setPermission(p, HiddenDirPerms);
359356
}
357+
this.fs.setPermission(p, HiddenDirPerms);
358+
360359
} catch (IOException e) {
361360
LOG.error("Failed to create or set permission on staging directory " + p.toString());
362361
throw new IOException(

0 commit comments

Comments
 (0)