]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: pin dentry when attaching batch lookup to it
authorYan, Zheng <zyan@redhat.com>
Mon, 16 Dec 2019 07:48:42 +0000 (15:48 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 16 Dec 2019 08:01:16 +0000 (16:01 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/CDentry.h
src/mds/CInode.h
src/mds/Server.cc

index 98ebb0464094c79daed35db14e3fd89d8d6242de..353b5e24aefb8f0d1003e3892752898045c9b0db 100644 (file)
@@ -123,6 +123,10 @@ public:
     linkage.remote_d_type = dt;
   }
 
+  ~CDentry() override {
+    ceph_assert(batch_ops.empty());
+  }
+
   std::string_view pin_name(int p) const override {
     switch (p) {
     case PIN_INODEPIN: return "inodepin";
index c0b8a5fd65747a647ef2f74ffe76baed4f962226..b3c82ef4f641dc0eaffcaa68861bf8896d49bcc3 100644 (file)
@@ -347,6 +347,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
     ceph_assert(num_caps_wanted == 0);
     ceph_assert(num_subtree_roots == 0);
     ceph_assert(num_exporting_dirs == 0);
+    ceph_assert(batch_ops.empty());
   }
 
   std::map<int, std::unique_ptr<BatchOp>> batch_ops;
index f81f4288a4995ef665876ec2a93b862725617b5a..60edf37d965d156467f574ab219928372d16a5de 100644 (file)
@@ -3556,7 +3556,8 @@ void Server::handle_client_getattr(MDRequestRef& mdr, bool is_lookup)
       CDentry* dn = mdr->dn[0].back();
       auto em = dn->batch_ops.emplace(std::piecewise_construct, std::forward_as_tuple(mask), std::forward_as_tuple());
       if (em.second) {
-        em.first->second = std::make_unique<Batch_Getattr_Lookup>(this, mdr, mdcache);
+       em.first->second = std::make_unique<Batch_Getattr_Lookup>(this, mdr, mdcache);
+       mdr->pin(dn);
       } else {
        dout(20) << __func__ << ": LOOKUP op, wait for previous same getattr ops to respond. " << *mdr << dendl;
        em.first->second->add_request(mdr);