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: v16.1.0~1368^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=34c6b4437a2e8a49bb76e86d07cd86b740e3f581;p=ceph.git mds: disallow creating snapshot on descendent directory of subvolume Signed-off-by: "Yan, Zheng" --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 10ff327119c9..f3c07a28edc4 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -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 &&