]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: only enable batch getattr/lookup for non-snap request. 32268/head
authorYan, Zheng <zyan@redhat.com>
Mon, 16 Dec 2019 07:54:01 +0000 (15:54 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 16 Dec 2019 08:12:41 +0000 (16:12 +0800)
MDS may cow dentry/inode. After COWing, batch getattr/lookup for snap
request can be attched to wrong object.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/Server.cc

index 60edf37d965d156467f574ab219928372d16a5de..c7418007e6f0bb2188e134583caa79e9db4f3a75 100644 (file)
@@ -3542,7 +3542,7 @@ void Server::handle_client_getattr(MDRequestRef& mdr, bool is_lookup)
 
   mdr->getattr_caps = mask;
 
-  if (!mdr->is_batch_head && mdr->is_batch_op()) {
+  if (mdr->snapid == CEPH_NOSNAP && !mdr->is_batch_head && mdr->is_batch_op()) {
     if (!is_lookup) {
       auto em = ref->batch_ops.emplace(std::piecewise_construct, std::forward_as_tuple(mask), std::forward_as_tuple());
       if (em.second) {
@@ -3564,8 +3564,8 @@ void Server::handle_client_getattr(MDRequestRef& mdr, bool is_lookup)
        return;
       }
     }
+    mdr->is_batch_head = true;
   }
-  mdr->is_batch_head = true;
 
   /*
    * if client currently holds the EXCL cap on a field, do not rdlock