]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: auth pin CInode when validating its disk state
authorYan, Zheng <zyan@redhat.com>
Wed, 3 Jun 2020 03:51:48 +0000 (11:51 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 16 Nov 2020 01:02:17 +0000 (09:02 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/CInode.cc
src/mds/MDCache.cc

index 601a144e8c5639820b64ef7d2ce7211025b7ae87..11617ff820643e4ced86a6dcdcba6625c4a2f8f0 100644 (file)
@@ -4630,6 +4630,9 @@ void CInode::validate_disk_state(CInode::validated_data *results,
     }
 
     bool _start(int rval) {
+      ceph_assert(in->can_auth_pin());
+      in->auth_pin(this);
+
       if (in->is_dirty()) {
        MDCache *mdcache = in->mdcache;  // For the benefit of dout
        auto ino = [this]() { return in->ino(); }; // For the benefit of dout
@@ -4879,6 +4882,8 @@ next:
        in->scrub_infop->header->set_repaired();
       if (fin)
        fin->complete(get_rval());
+
+      in->auth_unpin(this);
     }
   };
 
index ade41bcb8f8a1d643086f584aa00c3f35490860d..2868dc3686ec3301b2411939ab2775080b596125 100644 (file)
@@ -12962,7 +12962,7 @@ void MDCache::repair_dirfrag_stats_work(MDRequestRef& mdr)
 void MDCache::repair_inode_stats(CInode *diri)
 {
   MDRequestRef mdr = request_start_internal(CEPH_MDS_OP_REPAIR_INODESTATS);
-  mdr->pin(diri);
+  mdr->auth_pin(diri); // already auth pinned by CInode::validate_disk_state()
   mdr->internal_op_private = diri;
   mdr->internal_op_finish = new C_MDSInternalNoop;
   repair_inode_stats_work(mdr);
@@ -13062,7 +13062,7 @@ do_rdlocks:
 void MDCache::rdlock_dirfrags_stats(CInode *diri, MDSInternalContext* fin)
 {
   MDRequestRef mdr = request_start_internal(CEPH_MDS_OP_RDLOCK_FRAGSSTATS);
-  mdr->pin(diri);
+  mdr->auth_pin(diri); // already auth pinned by CInode::validate_disk_state()
   mdr->internal_op_private = diri;
   mdr->internal_op_finish = fin;
   return rdlock_dirfrags_stats_work(mdr);