]> 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)
committerPatrick Donnelly <pdonnell@redhat.com>
Sat, 12 Dec 2020 21:58:03 +0000 (13:58 -0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 55cc3f7d7d27837bfe64ee46444358c0e45d16f6)

src/mds/Server.cc

index 3093e7dfeef1f3a652894e2b57599032d3b3be21..2a510b6a045c1c69b649f2202482e227fe92cf6c 100644 (file)
@@ -6340,6 +6340,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);