]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: do not scrub inode if it is purging
authordparmar18 <dparmar@redhat.com>
Fri, 2 Dec 2022 12:33:20 +0000 (18:03 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Fri, 31 Mar 2023 10:14:12 +0000 (15:44 +0530)
Scrub could evaluate strays but there was a race condition where
an inode pinned for scrub would land for purging which would indeed
lead to crashes.

Fixes: https://tracker.ceph.com/issues/51824
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
(cherry picked from commit a8680d37821854fb6d8685db85bdf2b658f12981)

src/mds/ScrubStack.cc

index 84441fcf6620350c1fef7329e7dd79d672ffba62..202eebc6b1de17c54276cc5855b405dee1b88deb 100644 (file)
@@ -64,6 +64,11 @@ int ScrubStack::_enqueue(MDSCacheObject *obj, ScrubHeaderRef& header, bool top)
       dout(10) << __func__ << " with {" << *in << "}" << ", already in scrubbing" << dendl;
       return -CEPHFS_EBUSY;
     }
+    if(in->state_test(CInode::STATE_PURGING)) {
+      dout(10) << *obj << " is purging, skip pushing into scrub stack" << dendl;
+      // treating this as success since purge will make sure this inode goes away
+      return 0;
+    }
 
     dout(10) << __func__ << " with {" << *in << "}" << ", top=" << top << dendl;
     in->scrub_initialize(header);
@@ -72,6 +77,11 @@ int ScrubStack::_enqueue(MDSCacheObject *obj, ScrubHeaderRef& header, bool top)
       dout(10) << __func__ << " with {" << *dir << "}" << ", already in scrubbing" << dendl;
       return -CEPHFS_EBUSY;
     }
+    if(dir->get_inode()->state_test(CInode::STATE_PURGING)) {
+      dout(10) << *obj << " is purging, skip pushing into scrub stack" << dendl;
+      // treating this as success since purge will make sure this dir inode goes away
+      return 0;
+    }
 
     dout(10) << __func__ << " with {" << *dir << "}" << ", top=" << top << dendl;
     // The edge directory must be in memory