]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: reencode cap releases for each request
authorSage Weil <sage.weil@dreamhost.com>
Tue, 26 Jul 2011 05:17:24 +0000 (22:17 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 27 Jul 2011 03:44:17 +0000 (20:44 -0700)
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>
src/client/Client.cc

index 66cecf18015b84a448b3049512560d4345f47400..7c9aa258a57a07775807e3e736683007732c8a0f 100644 (file)
@@ -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);