From: dparmar18 Date: Fri, 2 Dec 2022 12:33:20 +0000 (+0530) Subject: mds: do not scrub inode if it is purging X-Git-Tag: v17.2.7~192^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9ecd46e18acee96ed587dc88a75a95f83e5b8765;p=ceph.git mds: do not scrub inode if it is purging 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 (cherry picked from commit a8680d37821854fb6d8685db85bdf2b658f12981) --- diff --git a/src/mds/ScrubStack.cc b/src/mds/ScrubStack.cc index f709ecbe2715..b4d89663257d 100644 --- a/src/mds/ScrubStack.cc +++ b/src/mds/ScrubStack.cc @@ -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