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 <gfarnum@redhat.com>
This commit is contained in:
Greg Farnum 2015-03-24 15:15:42 -07:00
parent 2724ce2d1b
commit 0c6bd2775f

View File

@ -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)