it an inode is being purged, scrub should not be ran on it.
Fixes: https://tracker.ceph.com/issues/51824
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
(cherry picked from commit
ce12cd71ffa703c8e3f05617cd8261d4ff820e7e)
}
}
+bool ScrubStack::remove_inode_if_stacked(CInode *in) {
+ MDSCacheObject *obj = dynamic_cast<MDSCacheObject*>(in);
+ if(obj->item_scrub.is_on_list()) {
+ dout(20) << "removing inode " << *in << " from scrub_stack" << dendl;
+ obj->put(MDSCacheObject::PIN_SCRUBQUEUE);
+ obj->item_scrub.remove_myself();
+ stack_size--;
+ return true;
+ }
+ return false;
+}
+
void ScrubStack::handle_scrub(const cref_t<MMDSScrub> &m)
{
void dispatch(const cref_t<Message> &m);
+ bool remove_inode_if_stacked(CInode *in);
+
MDCache *mdcache;
protected:
#include "mds/MDLog.h"
#include "mds/CDir.h"
#include "mds/CDentry.h"
+#include "mds/ScrubStack.h"
#include "events/EUpdate.h"
#include "messages/MClientRequest.h"
CInode *in = dnl->get_inode();
ceph_assert(in);
+ //remove inode from scrub stack if it is being purged
+ if(mds->scrubstack->remove_inode_if_stacked(in)) {
+ dout(20) << "removed " << *in << " from the scrub stack" << dendl;
+ }
+
/* We consider a stray to be purging as soon as it is enqueued, to avoid
* enqueing it twice */
dn->state_set(CDentry::STATE_PURGING);