From: Yan, Zheng Date: Wed, 13 Jan 2016 14:00:53 +0000 (+0800) Subject: mds: fix completed cap flush handling X-Git-Tag: v10.0.3~12^2~2^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5d8d66629f820ad48c79e6a9cf32326da8689283;p=ceph.git mds: fix completed cap flush handling 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 --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index d956c03f3e37..aea88f5b6830 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -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 diff --git a/src/messages/MClientCaps.h b/src/messages/MClientCaps.h index c923dd16b083..1b3f487f271d 100644 --- a/src/messages/MClientCaps.h +++ b/src/messages/MClientCaps.h @@ -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),