]> 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:18:34 +0000 (15:48 +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 f709ecbe271565b47b179e8ca655c309c0bdd099..b4d89663257d7ee5349693c8498c11731654c29b 100644 (file)
@@ -67,6 +67,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);
@@ -75,6 +80,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