]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: cleanup tracking of early kicked flushing caps
authorYan, Zheng <zyan@redhat.com>
Thu, 20 Jun 2019 01:52:49 +0000 (09:52 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 21 Jun 2019 01:49:53 +0000 (09:49 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/client/Client.cc
src/client/Inode.h
src/client/MetaSession.h

index 315c1cce85e5b09e6323a2cb1c54039edc9b8010..ba1feca29b090c05094a821769e971aa57f81ec1 100644 (file)
@@ -3587,17 +3587,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;
@@ -4457,22 +4456,19 @@ void Client::kick_flushing_caps(MetaSession *session)
 
   for (xlist<Inode*>::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<Inode*>::iterator p = session->flushing_caps.begin(); !p.end(); ++p) {
     Inode *in = *p;
     Cap *cap = in->auth_cap;
@@ -4481,13 +4477,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.
@@ -4896,8 +4894,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)
index bba7f920aa1a0fac90fe6e6bd5e6996ccf63ace3..dcc51d32d209dd915d5e1b886b147d3b38bcdfb7 100644 (file)
@@ -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;
index 958d0bd96c19d1ee3b29df65ce30662657fa6b46..94881c370cac3d78488df5bf69beeeeb04ecd576 100644 (file)
@@ -52,7 +52,6 @@ struct MetaSession {
   xlist<MetaRequest*> requests;
   xlist<MetaRequest*> unsafe_requests;
   std::set<ceph_tid_t> flushing_caps_tids;
-  std::set<Inode*> early_flushing_caps;
 
   ceph::ref_t<MClientCapRelease> release;