bshashikant commented on a change in pull request #2172:
URL: https://github.com/apache/hadoop/pull/2172#discussion_r470421353



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirSnapshotOp.java
##########
@@ -358,4 +358,23 @@ static void checkSnapshot(FSDirectory fsd, INodesInPath 
iip,
       checkSnapshot(iip.getLastINode(), snapshottableDirs);
     }
   }
+
+  static void checkUnderSameSnapshottableRoot(FSDirectory fsd,
+      INodesInPath srcIIP, INodesInPath dstIIP) throws IOException {
+    // Ensure rename out of a snapshottable root is not permitted if ordered
+    // snapshot deletion feature is enabled
+    SnapshotManager snapshotManager = fsd.getFSNamesystem().
+        getSnapshotManager();
+    if (snapshotManager.isSnapshotDeletionOrdered() && fsd.getFSNamesystem()
+        .isSnapshotTrashRootEnabled()) {
+      String errMsg = "Source " + srcIIP.getPath() +
+          " and dest " + dstIIP.getPath() + " are not under " +
+          "the same snapshot root.";
+      INodeDirectory src = snapshotManager.

Review comment:
       Good catch! I think its better to check snapshottable root for both src 
and dst to be equal. isDescendent() check will be true if src snapshot root is 
ancesstor of dst snapshot root even if they are not equal and if nested 
snapshot feature is enabled.
   




----------------------------------------------------------------
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