I think commit
f7170f9 was based on some of my bad advice. Every time the
client sends a request, it should look at what caps it has that might
conflict with the operation and (if possible) release them with the
request. I suspect I was confusing this with the case on the MDS side of
things where we only process the release(s) when we first receive the
message and not when it is deferred/retried.
Specifically, this fixes a problem where we send a request to mds A and
release some set of caps, A tells us to talk to B instead, and we resend
the same message with (old, now bogus) releases intended for A to B
instead, where they probably make no sense.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
if (in->caps.count(mds))
caps = in->caps[mds];
if (caps &&
- drop & caps->issued &&
+ (drop & caps->issued) &&
!(unless & caps->issued)) {
ldout(cct, 25) << "Dropping caps. Initial " << ccap_string(caps->issued) << dendl;
caps->issued &= ~drop;
r->set_replayed_op();
r->set_mdsmap_epoch(mdsmap->get_epoch());
- if (request->cap_releases.empty())
- encode_cap_releases(request, mds);
- r->releases = request->cap_releases;
+ encode_cap_releases(request, mds);
+ r->releases.swap(request->cap_releases);
if (request->mds == -1) {
request->sent_stamp = ceph_clock_now(cct);