]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: disallow creating snapshot on descendent directory of subvolume
authorYan, Zheng <zyan@redhat.com>
Wed, 5 Aug 2020 07:33:10 +0000 (15:33 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 20 Aug 2020 03:10:18 +0000 (11:10 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/Server.cc

index 10ff327119c922896de927df82d2ae33762f505d..f3c07a28edc45668b2a37ee51f2709230eaef00c 100644 (file)
@@ -9937,6 +9937,12 @@ void Server::handle_client_mksnap(MDRequestRef& mdr)
   if (!check_access(mdr, diri, MAY_WRITE|MAY_SNAPSHOT))
     return;
 
+  if (inodeno_t subvol_ino = diri->find_snaprealm()->get_subvolume_ino();
+      (subvol_ino && subvol_ino != diri->ino())) {
+    respond_to_request(mdr, -EPERM);
+    return;
+  }
+
   // check if we can create any more snapshots
   // we don't allow any more if we are already at or beyond the limit
   if (diri->snaprealm &&