From a374166c68bb5a47654352560b971be62ad83be8 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Thu, 10 Nov 2016 06:30:27 -0500 Subject: [PATCH] client: rename flush_caps() with no arguments to flush_caps_sync() Per Greg's recommendation, change the name of this function to better indicate what it does now that we always request a journal flush on the last cap flush. Also, add a comment above the function to better explain why we do this. Signed-off-by: Jeff Layton --- src/client/Client.cc | 13 +++++++++---- src/client/Client.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 9f0517a6b7b33..44dd55ae485ca 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -4113,9 +4113,14 @@ void Client::adjust_session_flushing_caps(Inode *in, MetaSession *old_s, MetaSe new_s->flushing_caps.push_back(&in->flushing_cap_item); } -void Client::flush_caps() +/* + * Flush all caps back to the MDS. Because the callers generally wait on the + * result of this function (syncfs and umount cases), we set + * CHECK_CAPS_SYNCHRONOUS on the last check_caps call. + */ +void Client::flush_caps_sync() { - ldout(cct, 10) << "flush_caps" << dendl; + ldout(cct, 10) << __func__ << dendl; xlist::iterator p = delayed_caps.begin(); while (!p.end()) { unsigned flags = CHECK_CAPS_NODELAY; @@ -5773,7 +5778,7 @@ void Client::unmount() } } - flush_caps(); + flush_caps_sync(); wait_sync_caps(last_flush_tid); // empty lru cache @@ -9670,7 +9675,7 @@ int Client::_sync_fs() flush_done = true; // flush caps - flush_caps(); + flush_caps_sync(); ceph_tid_t flush_tid = last_flush_tid; // wait for unsafe mds requests diff --git a/src/client/Client.h b/src/client/Client.h index 155385d192f23..636de56f27beb 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -627,7 +627,7 @@ protected: void mark_caps_dirty(Inode *in, int caps); int mark_caps_flushing(Inode *in, ceph_tid_t *ptid); void adjust_session_flushing_caps(Inode *in, MetaSession *old_s, MetaSession *new_s); - void flush_caps(); + void flush_caps_sync(); void flush_caps(Inode *in, MetaSession *session, bool sync=false); void kick_flushing_caps(MetaSession *session); void early_kick_flushing_caps(MetaSession *session); -- 2.39.5