From 93954d0e99296c58ef85cd9fdf455e939d5f4fd4 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Fri, 11 Nov 2016 06:28:29 -0500 Subject: [PATCH] mds: do mds log flush if CLIENT_CAPS_SYNC is set If the client has set the sync flag in a cap update, then it is indicating that it's waiting on the reply. Ensure that we flush the journal in that case. Signed-off-by: Jeff Layton --- src/mds/Locker.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 64a56af7fd5..285eebdd3c8 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -2487,7 +2487,9 @@ void Locker::handle_client_caps(MClientCaps *m) client_t client = m->get_source().num(); snapid_t follows = m->get_snap_follows(); - dout(7) << "handle_client_caps on " << m->get_ino() + dout(7) << "handle_client_caps " + << ((m->flags & CLIENT_CAPS_SYNC) ? "sync" : "async") + << " on " << m->get_ino() << " tid " << m->get_client_tid() << " follows " << follows << " op " << ceph_cap_op_name(m->get_op()) << dendl; @@ -2706,10 +2708,10 @@ void Locker::handle_client_caps(MClientCaps *m) } // filter wanted based on what we could ever give out (given auth/replica status) - bool need_flush = false; + bool need_flush = m->flags & CLIENT_CAPS_SYNC; int new_wanted = m->get_wanted() & head_in->get_caps_allowed_ever(); if (new_wanted != cap->wanted()) { - if (new_wanted & ~cap->pending()) { + if (!need_flush && (new_wanted & ~cap->pending())) { // exapnding caps. make sure we aren't waiting for a log flush need_flush = _need_flush_mdlog(head_in, new_wanted & ~cap->pending()); } -- 2.47.3