From: Yan, Zheng Date: Wed, 3 Jun 2015 11:14:22 +0000 (+0800) Subject: client: re-send flushing caps (which are revoked) in reconnect stage X-Git-Tag: v9.1.0~57^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a1d14b74e87063c5645fd2fbf54f2d3965447c15;p=ceph.git client: re-send flushing caps (which are revoked) in reconnect stage if flushing caps were revoked, we should 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. Signed-off-by: Yan, Zheng --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 28b9fb09979..c248c7d5b32 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2424,6 +2424,9 @@ void Client::send_reconnect(MetaSession *session) } } } + + early_kick_flushing_caps(session); + session->con->send_message(m); mount_cond.Signal(); @@ -3842,6 +3845,36 @@ void Client::kick_flushing_caps(MetaSession *session) } } +void Client::early_kick_flushing_caps(MetaSession *session) +{ + for (xlist::iterator p = session->flushing_caps.begin(); !p.end(); ++p) { + Inode *in = *p; + if (!in->flushing_caps) + continue; + assert(in->auth_cap); + Cap *cap = in->auth_cap; + + // 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. + bool send_now = (in->flushing_caps & in->auth_cap->issued) != in->flushing_caps; + + if (send_now) + ldout(cct, 20) << " reflushing caps (revoked) on " << *in + << " to mds." << session->mds_num << dendl; + + for (map::iterator q = in->flushing_cap_tids.begin(); + q != in->flushing_cap_tids.end(); + ++q) { + if (send_now) { + send_cap(in, session, cap, (get_caps_used(in) | in->caps_dirty()), + in->caps_wanted(), (cap->issued | cap->implemented), + q->second, q->first); + } + } + } +} + void Client::kick_maxsize_requests(MetaSession *session) { xlist::iterator iter = session->caps.begin(); diff --git a/src/client/Client.h b/src/client/Client.h index e7b19b9ea01..4b916149d21 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -292,9 +292,11 @@ public: // mds requests ceph_tid_t last_tid; ceph_tid_t oldest_tid; // oldest incomplete mds request, excluding setfilelock requests - ceph_tid_t last_flush_tid; map mds_requests; + // cap flushing + ceph_tid_t last_flush_tid; + void dump_mds_requests(Formatter *f); void dump_mds_sessions(Formatter *f); @@ -539,6 +541,7 @@ protected: void flush_caps(); void flush_caps(Inode *in, MetaSession *session); void kick_flushing_caps(MetaSession *session); + void early_kick_flushing_caps(MetaSession *session); void kick_maxsize_requests(MetaSession *session); int get_caps(Inode *in, int need, int want, int *have, loff_t endoff); int get_caps_used(Inode *in);