From: Yan, Zheng Date: Wed, 5 Aug 2020 07:33:10 +0000 (+0800) Subject: mds: disallow creating snapshot on descendent directory of subvolume X-Git-Tag: v15.2.9~110^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c67d225b38cd2e23e68210150bc3677a57f62d1;p=ceph.git mds: disallow creating snapshot on descendent directory of subvolume Signed-off-by: "Yan, Zheng" (cherry picked from commit 34c6b4437a2e8a49bb76e86d07cd86b740e3f581) --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 946c24e19de..f80fee3475e 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -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 &&