smengcl commented on a change in pull request #906:
URL: https://github.com/apache/hadoop-ozone/pull/906#discussion_r424741927



##########
File path: 
hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java
##########
@@ -469,15 +478,76 @@ public boolean delete(Path f, boolean recursive) throws 
IOException {
         return false;
       }
 
+      OFSPath ofsPath = new OFSPath(key);
+
+      // Handle rm root
+      if (ofsPath.isRoot()) {
+        Iterator<? extends OzoneVolume> it =
+            adapterImpl.getObjectStore().listVolumes("");
+        while (it.hasNext()) {
+          OzoneVolume volume = it.next();
+          String nextVolume = addTrailingSlashIfNeeded(
+              f.toString()) + volume.getName();
+          delete(new Path(nextVolume), true);
+        }

Review comment:
       Replace the rm root logic with a warning. Effectively disallowing admin 
to use `rm -r /` to clear the cluster.
   
   Admins should re-init the cluster if they really want to clear the cluster.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to