All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libceph: avoid unregistering osd request when not registered
@ 2012-05-17 13:21 Alex Elder
  0 siblings, 0 replies; only message in thread
From: Alex Elder @ 2012-05-17 13:21 UTC (permalink / raw)
  To: ceph-devel

(Sending this on behalf of Sage, because I'm about to commit it
for testing and I wanted the list to have better visibility.)

There is a race between two __unregister_request() callers: the
reply path and the ceph_osdc_wait_request().  If we get a reply
*and* the timeout expires at roughly the same time, both callers
will try to unregister the request, and the second one will do bad
things.

Simply check if the request is still already unregistered; if so,
return immediately and do nothing.

Fixes http://tracker.newdream.net/issues/2420

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Alex Elder <elder@inktank.com>
---
  net/ceph/osd_client.c |    6 ++++++
  1 file changed, 6 insertions(+)

Index: b/net/ceph/osd_client.c
===================================================================
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -841,6 +841,12 @@ static void register_request(struct ceph
  static void __unregister_request(struct ceph_osd_client *osdc,
  				 struct ceph_osd_request *req)
  {
+	if (RB_EMPTY_NODE(&req->r_node)) {
+		dout("__unregister_request %p tid %lld not registered\n",
+			req, req->r_tid);
+		return;
+	}
+
  	dout("__unregister_request %p tid %lld\n", req, req->r_tid);
  	rb_erase(&req->r_node, &osdc->requests);
  	osdc->num_requests--;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-17 13:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-17 13:21 [PATCH] libceph: avoid unregistering osd request when not registered Alex Elder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.