From 0ed63fd3e595336366f000927d18a933657d7a8b Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Mon, 24 Feb 2014 16:02:57 +0800 Subject: [PATCH] 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 --- src/client/Client.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 40e95fb582b2a..f2b9bf13c8869 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; -- 2.39.5