]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix completed cap flush handling
authorYan, Zheng <zyan@redhat.com>
Wed, 13 Jan 2016 14:00:53 +0000 (22:00 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 15 Jan 2016 05:19:37 +0000 (13:19 +0800)
Client re-send cap flush when MDS restarts. The cap flush message
may release some caps even if the corresponding flush is already
completed.

Fixes: #13546
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/Locker.cc
src/messages/MClientCaps.h

index d956c03f3e37f797e924a121f1288ecd74192297..aea88f5b6830c303de1fb50d86c0338163174012 100644 (file)
@@ -2488,8 +2488,14 @@ void Locker::handle_client_caps(MClientCaps *m)
     ack->set_snap_follows(follows);
     ack->set_client_tid(m->get_client_tid());
     mds->send_message_client_counted(ack, m->get_connection());
-    m->put();
-    return;
+    if (m->get_op() == CEPH_CAP_OP_FLUSHSNAP) {
+      m->put();
+      return;
+    } else {
+      // fall-thru because the message may release some caps
+      m->clear_dirty();
+      m->set_op(CEPH_CAP_OP_UPDATE);
+    }
   }
 
   // "oldest flush tid" > 0 means client uses unique TID for each flush
index c923dd16b0834932330fd0cc6f39882195533a73..1b3f487f271d36afe0d0b41f9844f5c224f63c47 100644 (file)
@@ -92,6 +92,8 @@ class MClientCaps : public Message {
   void set_oldest_flush_tid(ceph_tid_t tid) { oldest_flush_tid = tid; }
   ceph_tid_t get_oldest_flush_tid() { return oldest_flush_tid; }
 
+  void clear_dirty() { head.dirty = 0; }
+
   MClientCaps()
     : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION),
       osd_epoch_barrier(0),