From 891f814f308e834369616601cf7f3540bea192ef Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 3 Mar 2015 20:14:28 +0000 Subject: [PATCH] mds: flush immediately in do_open_truncate Previously truncating opens were horribly laggy for clients when the system was otherwise idle, as they would wait for the next tick() before proceeding. Fixes: #11011 Signed-off-by: John Spray --- src/mds/Server.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index d572340be1e7..846ade3cb0aa 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -3618,6 +3618,10 @@ void Server::do_open_truncate(MDRequestRef& mdr, int cmode) journal_and_reply(mdr, in, dn, le, new C_MDS_inode_update_finish(mds, mdr, in, old_size > 0, changed_ranges)); + // Although the `open` part can give an early reply, the truncation won't + // happen until our EUpdate is persistent, to give the client a prompt + // response we must also flush that event. + mdlog->flush(); } -- 2.47.3