]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: Hold on to exclusive caps on directories we "own" 4168/head
authorGreg Farnum <gfarnum@redhat.com>
Tue, 24 Mar 2015 22:15:42 +0000 (15:15 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 25 Mar 2015 18:10:56 +0000 (11:10 -0700)
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>
src/client/Client.cc

index a649f2276eb28042abd277bc98e0a027bc67302d..b272bbec9ded81d50581c4fd7eb7dd6063ee4587 100644 (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)