]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: re-send flushing caps (which are revoked) in reconnect stage
authorYan, Zheng <zyan@redhat.com>
Wed, 3 Jun 2015 11:14:22 +0000 (19:14 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 18 Aug 2015 08:49:50 +0000 (16:49 +0800)
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 <zyan@redhat.com>
src/client/Client.cc
src/client/Client.h

index 28b9fb09979be6e265b29c44b2d25d562a0605b9..c248c7d5b3239f4f5cc383e0d2914b6fa9bcfade 100644 (file)
@@ -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<Inode*>::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<ceph_tid_t,int>::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<Cap*>::iterator iter = session->caps.begin();
index e7b19b9ea01ac54b1da19c6d4a50f0254eab6df5..4b916149d21667cce6095d8aab75aff2340edb2d 100644 (file)
@@ -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<ceph_tid_t, MetaRequest*> 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);