]> git.apps.os.sepia.ceph.com Git - ceph-ci.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>
Thu, 20 Aug 2020 03:10:18 +0000 (11:10 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/Server.cc

index 0655da9d1b32d5305ff65d4597e77854aea8e04a..cd2319e3eb86be87148d6a4eb7818508d0a2cfdb 100644 (file)
@@ -6336,6 +6336,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);