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: v16.2.14~51^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7d3248a92b1f1037c7686576a10ade0ed0115c40;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 84441fcf6620..202eebc6b1de 100644 --- a/src/mds/ScrubStack.cc +++ b/src/mds/ScrubStack.cc @@ -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