]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: disallow hardlink across subvolume
authorYan, Zheng <zyan@redhat.com>
Wed, 5 Aug 2020 08:04:30 +0000 (16:04 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 26 Aug 2020 06:32:37 +0000 (14:32 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 55cc3f7d7d27837bfe64ee46444358c0e45d16f6)

src/mds/Server.cc

index 0fe3f900e3b6c51539f7e6f2b3332e306c2db75a..6781208230b566abf2aa5c20f18153dc91f4da52 100644 (file)
@@ -6075,6 +6075,16 @@ void Server::handle_client_link(MDRequestRef& mdr)
       return;
   }
 
+  CInode* target_pin = targeti->get_projected_parent_dir()->inode;
+  SnapRealm *target_realm = target_pin->find_snaprealm();
+  if (target_pin != dir->inode &&
+      target_realm->get_subvolume_ino() !=
+      dir->inode->find_snaprealm()->get_subvolume_ino()) {
+    dout(7) << "target is in different subvolume, failing..." << dendl;
+    respond_to_request(mdr, -EXDEV);
+    return;
+  }
+
   // go!
   ceph_assert(g_conf()->mds_kill_link_at != 1);