]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix Client::trim_caps() 1320/head
authorYan, Zheng <zheng.z.yan@intel.com>
Mon, 24 Feb 2014 08:02:57 +0000 (16:02 +0800)
committerYan, Zheng <zheng.z.yan@intel.com>
Sat, 1 Mar 2014 05:13:28 +0000 (13:13 +0800)
allow trimming non-auth caps if the issued auth caps include all
caps client wants/uses.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
src/client/Client.cc

index 40e95fb582b2ae126173299de8dbee6ff5786202..f2b9bf13c88692eb62a334a352004d10bc7724c5 100644 (file)
@@ -3041,15 +3041,14 @@ void Client::trim_caps(MetaSession *s, int max)
     s->s_cap_iterator = cap;
     Inode *in = cap->inode;
     if (in->caps.size() > 1 && cap != in->auth_cap) {
+      int mine = cap->issued | cap->implemented;
+      int oissued = in->auth_cap ? in->auth_cap->issued : 0;
       // disposable non-auth cap
-      if (in->caps_used() || in->caps_dirty()) {
-       ldout(cct, 20) << " keeping cap on " << *in << " used " << ccap_string(in->caps_used())
-                      << " dirty " << ccap_string(in->caps_dirty()) << dendl;
-       continue;
+      if (!(in->caps_used() & ~oissued & mine)) {
+       ldout(cct, 20) << " removing unused, unneeded non-auth cap on " << *in << dendl;
+       remove_cap(cap, true);
+       trimmed++;
       }
-      ldout(cct, 20) << " removing unused, unneeded non-auth cap on " << *in << dendl;
-      remove_cap(cap, true);
-      trimmed++;
     } else {
       ldout(cct, 20) << " trying to trim dentries for " << *in << dendl;
       bool all = true;