You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by ag...@apache.org on 2022/05/16 16:09:09 UTC

[storm] branch master updated: STORM-3862 HdfsBlobStoreImpl should check permission after mkdirs (#3478)

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

agresch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new 145fe0950 STORM-3862 HdfsBlobStoreImpl should check permission after mkdirs (#3478)
145fe0950 is described below

commit 145fe09507e75208f5104053093eb678df4e360b
Author: skysiders <64...@users.noreply.github.com>
AuthorDate: Tue May 17 00:08:57 2022 +0800

    STORM-3862 HdfsBlobStoreImpl should check permission after mkdirs (#3478)
---
 .../main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreFile.java | 5 +++++
 .../main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreImpl.java | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreFile.java b/external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreFile.java
index bff6a08f3..fe64f1757 100644
--- a/external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreFile.java
+++ b/external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreFile.java
@@ -141,6 +141,11 @@ public class HdfsBlobStoreFile extends BlobStoreFile {
             if (!fileSystem.mkdirs(path.getParent(), dirperms)) {
                 LOG.warn("error creating parent dir: " + path.getParent());
             }
+            if (!fileSystem.getFileStatus(path.getParent()).getPermission().equals(dirperms)) {
+                LOG.warn("Directory {} created with unexpected permission {}.Set permission {} for this directory.",
+                    path.getParent(), fileSystem.getFileStatus(path.getParent()).getPermission(), dirperms);
+                fileSystem.setPermission(path.getParent(), dirperms);
+            }
             out = fileSystem.create(path, (short) this.getMetadata().get_replication_factor());
             fileSystem.setPermission(path, dirperms);
             fileSystem.setReplication(path, (short) this.getMetadata().get_replication_factor());
diff --git a/external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreImpl.java b/external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreImpl.java
index 7f81c94ca..455cdd785 100644
--- a/external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreImpl.java
+++ b/external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreImpl.java
@@ -143,6 +143,11 @@ public class HdfsBlobStoreImpl {
         if (!fileSystem.exists(fullPath)) {
             FsPermission perms = new FsPermission(BLOBSTORE_DIR_PERMISSION);
             boolean success = fileSystem.mkdirs(fullPath, perms);
+            if (!fileSystem.getFileStatus(fullPath).getPermission().equals(perms)) {
+                LOG.warn("Directory {} created with unexpected permission {}.Set permission {} for this directory.",
+                    fullPath, fileSystem.getFileStatus(fullPath).getPermission(), perms);
+                fileSystem.setPermission(fullPath, perms);
+            }
             if (!success) {
                 throw new IOException("Error creating blobstore directory: " + fullPath);
             }