From: Greg Farnum Date: Tue, 24 Mar 2015 22:15:42 +0000 (-0700) Subject: client: Hold on to exclusive caps on directories we "own" X-Git-Tag: v9.0.0~74^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F4168%2Fhead;p=ceph.git 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 --- diff --git a/src/client/Client.cc b/src/client/Client.cc index a649f2276eb2..b272bbec9ded 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)