]> git.apps.os.sepia.ceph.com Git - ceph.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)
committerPatrick Donnelly <pdonnell@redhat.com>
Sat, 12 Dec 2020 21:58:02 +0000 (13:58 -0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 34c6b4437a2e8a49bb76e86d07cd86b740e3f581)

src/mds/Server.cc

index 946c24e19deca0c7c5cde4382be326916e191881..f80fee3475ec122a5fc20d988fb5db3252f56648 100644 (file)
@@ -9925,6 +9925,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 &&