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: v14.2.5~216^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2af3674c59383db25fe885871e5f9d8aea00a93b;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 e821de07fb3..ffc301f649e 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -3585,17 +3585,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; @@ -4455,22 +4454,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; Cap *cap = in->auth_cap; @@ -4479,13 +4475,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; // send_reconnect() also will reset these sequence numbers. make sure // sequence numbers in cap flush message match later reconnect message. @@ -4894,8 +4892,9 @@ void Client::handle_cap_import(MetaSession *session, Inode *in, const MConstRef< 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 e101596c7f1..0e6586cb669 100644 --- a/src/client/Inode.h +++ b/src/client/Inode.h @@ -113,6 +113,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 af2d7acd764..ba1f8d80fcd 100644 --- a/src/client/MetaSession.h +++ b/src/client/MetaSession.h @@ -52,7 +52,6 @@ struct MetaSession { xlist requests; xlist unsafe_requests; std::set flushing_caps_tids; - std::set early_flushing_caps; MClientCapRelease::ref release;