From 79b8374de2c5c0b9ce8bd645a292c2f21b3b8df7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 25 Jul 2011 22:17:24 -0700 Subject: [PATCH] client: reencode cap releases for each request 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 --- src/client/Client.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 66cecf18015b8..7c9aa258a57a0 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1117,7 +1117,7 @@ int Client::encode_inode_release(Inode *in, MetaRequest *req, 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; @@ -1270,9 +1270,8 @@ void Client::send_request(MetaRequest *request, int mds) 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); -- 2.39.5