X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fmds%2FScrubStack.cc;h=6d799343f1496c2f7c0a414a67215d9185f1c0a2;hb=aee94f6923ba628a85d855d0c5316d0da78bfa2a;hp=5a3c2bf81e8538609c3efd0f41b65b085cd6fb54;hpb=27f45121cc74e31203777ad565f78d8aad9b92a2;p=ceph.git diff --git a/ceph/src/mds/ScrubStack.cc b/ceph/src/mds/ScrubStack.cc index 5a3c2bf81..6d799343f 100644 --- a/ceph/src/mds/ScrubStack.cc +++ b/ceph/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 @@ -109,7 +119,20 @@ int ScrubStack::enqueue(CInode *in, ScrubHeaderRef& header, bool top) << ", conflicting tag " << header->get_tag() << dendl; return -CEPHFS_EEXIST; } - + if (header->get_scrub_mdsdir()) { + filepath fp; + mds_rank_t rank; + rank = mdcache->mds->get_nodeid(); + if(rank >= 0 && rank < MAX_MDS) { + fp.set_path("", MDS_INO_MDSDIR(rank)); + } + int r = _enqueue(mdcache->get_inode(fp.get_ino()), header, true); + if (r < 0) { + return r; + } + //to make sure mdsdir is always on the top + top = false; + } int r = _enqueue(in, header, top); if (r < 0) return r; @@ -673,6 +696,12 @@ void ScrubStack::scrub_status(Formatter *f) { } *optcss << "force"; } + if (header->get_scrub_mdsdir()) { + if (have_more) { + *optcss << ","; + } + *optcss << "scrub_mdsdir"; + } f->dump_string("options", optcss->strv()); f->close_section(); // scrub id @@ -837,6 +866,18 @@ void ScrubStack::dispatch(const cref_t &m) } } +bool ScrubStack::remove_inode_if_stacked(CInode *in) { + MDSCacheObject *obj = dynamic_cast(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 &m) {