From: Yan, Zheng Date: Mon, 24 Feb 2014 08:02:57 +0000 (+0800) Subject: client: fix Client::trim_caps() X-Git-Tag: v0.79~179^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1320%2Fhead;p=ceph.git client: fix Client::trim_caps() allow trimming non-auth caps if the issued auth caps include all caps client wants/uses. Signed-off-by: Yan, Zheng --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 40e95fb582b..f2b9bf13c88 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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;