]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: touch cap on lookup even if we use the dentry lease
authorSage Weil <sage@newdream.net>
Fri, 24 Jun 2011 17:45:46 +0000 (10:45 -0700)
committerSage Weil <sage@newdream.net>
Fri, 24 Jun 2011 23:49:29 +0000 (16:49 -0700)
Touch the dir cap for the lease's mds even if we use the lease to traverse.
This makes the trim_caps() behave better because it keeps the dentry and
session cap LRUs in sync.

Signed-off-by: Sage Weil <sage@newdream.net>
src/client/Client.cc
src/client/Client.h

index 130ff18144728429009d157dde40eb899c5413d1..f9806e1e04c87fcf485fd3b243f063f1310bfd40 100644 (file)
@@ -3319,6 +3319,9 @@ int Client::_lookup(Inode *dir, const string& dname, Inode **target)
       if (s->cap_ttl > now &&
          s->cap_gen == dn->lease_gen) {
        *target = dn->inode;
+       // touch this mds's dir cap too, even though we don't _explicitly_ use it here, to
+       // make trim_caps() behave.
+       try_touch_cap(dir, dn->lease_mds);
        touch_dn(dn);
        goto done;
       }
index 22fb8ca78159bb819a091bebd457690e953e74e6..cd5ba72e284711e0e67bde3f45e2ef498486842c 100644 (file)
@@ -593,6 +593,10 @@ class Inode {
     // move to back of LRU
     cap->session->caps.push_back(&cap->cap_item);
   }
+  void try_touch_cap(Inode *inode, int mds) {
+    if (caps.count(mds))
+      touch_cap[mds];
+  }
   bool caps_issued_mask(unsigned mask) {
     int c = exporting_issued | snap_caps;
     if ((c & mask) == mask)