From 0c6bd2775fe43274e07c5b10586565d6170d8ea9 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 24 Mar 2015 15:15:42 -0700 Subject: [PATCH] client: Hold on to exclusive caps on directories we "own" If a directory is complete, we *really* want to keep the exclusive cap so that we don't end up needing to do MDS lookup requests on every cache miss. Fixes: #11226 Signed-off-by: Greg Farnum --- src/client/Client.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/client/Client.cc b/src/client/Client.cc index a649f2276eb..b272bbec9de 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2850,6 +2850,13 @@ void Client::check_caps(Inode *in, bool is_delayed) unsigned used = get_caps_used(in); unsigned cap_used; + if (in->is_dir() && (in->flags & I_COMPLETE)) { + // we do this here because we don't want to drop to Fs (and then + // drop the Fs if we do a create!) if that alone makes us send lookups + // to the MDS. Doing it in in->caps_wanted() has knock-on effects elsewhere + wanted |= CEPH_CAP_FILE_EXCL; + } + int retain = wanted | used | CEPH_CAP_PIN; if (!unmounting) { if (wanted)