From: Yan, Zheng Date: Thu, 20 Jun 2019 01:52:49 +0000 (+0800) Subject: client: cleanup tracking of early kicked flushing caps X-Git-Tag: v13.2.9~22^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=32094badb03338e1a421bf2cee101937603f2bf1;p=ceph.git client: cleanup tracking of early kicked flushing caps Signed-off-by: "Yan, Zheng" (cherry picked from commit d1942c4fb50f50330c7603feb497f40f71aa9d9e) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 5b15069e33f2..a23767db1128 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -3539,17 +3539,16 @@ void Client::check_caps(Inode *in, unsigned flags) } ack: - // re-send old cap/snapcap flushes first. - if (session->mds_state >= MDSMap::STATE_RECONNECT && - session->mds_state < MDSMap::STATE_ACTIVE && - session->early_flushing_caps.count(in) == 0) { - ldout(cct, 20) << " reflushing caps (check_caps) on " << *in - << " to mds." << session->mds_num << dendl; - session->early_flushing_caps.insert(in); - if (in->cap_snaps.size()) - flush_snaps(in, true); - if (in->flushing_caps) - flush_caps(in, session, flags & CHECK_CAPS_SYNCHRONOUS); + if (&cap == in->auth_cap) { + if (in->flags & I_KICK_FLUSH) { + ldout(cct, 20) << " reflushing caps (check_caps) on " << *in + << " to mds." << mds << dendl; + in->flags &= ~I_KICK_FLUSH; + if (in->cap_snaps.size()) + flush_snaps(in, true); + if (in->flushing_caps) + flush_caps(in, session, flags & CHECK_CAPS_SYNCHRONOUS); + } } int flushing; @@ -4411,22 +4410,19 @@ void Client::kick_flushing_caps(MetaSession *session) for (xlist::iterator p = session->flushing_caps.begin(); !p.end(); ++p) { Inode *in = *p; - if (session->early_flushing_caps.count(in)) + if (!(in->flags & I_KICK_FLUSH)) continue; + in->flags &= ~I_KICK_FLUSH; ldout(cct, 20) << " reflushing caps on " << *in << " to mds." << mds << dendl; if (in->cap_snaps.size()) flush_snaps(in, true); if (in->flushing_caps) flush_caps(in, session); } - - session->early_flushing_caps.clear(); } void Client::early_kick_flushing_caps(MetaSession *session) { - session->early_flushing_caps.clear(); - for (xlist::iterator p = session->flushing_caps.begin(); !p.end(); ++p) { Inode *in = *p; assert(in->auth_cap); @@ -4434,13 +4430,15 @@ void Client::early_kick_flushing_caps(MetaSession *session) // if flushing caps were revoked, we re-send the cap flush in client reconnect // stage. This guarantees that MDS processes the cap flush message before issuing // the flushing caps to other client. - if ((in->flushing_caps & in->auth_cap->issued) == in->flushing_caps) + if ((in->flushing_caps & in->auth_cap->issued) == in->flushing_caps) { + in->flags |= I_KICK_FLUSH; continue; + } ldout(cct, 20) << " reflushing caps (early_kick) on " << *in << " to mds." << session->mds_num << dendl; - session->early_flushing_caps.insert(in); + in->flags &= ~I_KICK_FLUSH; if (in->cap_snaps.size()) flush_snaps(in, true); @@ -4863,8 +4861,9 @@ void Client::handle_cap_import(MetaSession *session, Inode *in, MClientCaps *m) if (realm) put_snap_realm(realm); - if (in->auth_cap && in->auth_cap->session->mds_num == mds) { + if (in->auth_cap && in->auth_cap->session == session) { // reflush any/all caps (if we are now the auth_cap) + in->flags &= ~I_KICK_FLUSH; if (in->cap_snaps.size()) flush_snaps(in, true); if (in->flushing_caps) diff --git a/src/client/Inode.h b/src/client/Inode.h index f8505c8f9693..77136d4403ba 100644 --- a/src/client/Inode.h +++ b/src/client/Inode.h @@ -111,6 +111,7 @@ struct CapSnap { #define I_DIR_ORDERED 2 #define I_CAP_DROPPED 4 #define I_SNAPDIR_OPEN 8 +#define I_KICK_FLUSH 16 struct Inode { Client *client; diff --git a/src/client/MetaSession.h b/src/client/MetaSession.h index 8aad3dbe104f..f740dda20409 100644 --- a/src/client/MetaSession.h +++ b/src/client/MetaSession.h @@ -44,7 +44,6 @@ struct MetaSession { xlist requests; xlist unsafe_requests; std::set flushing_caps_tids; - std::set early_flushing_caps; boost::intrusive_ptr release;