All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libceph: drop mutex on error in handle_reply()
@ 2013-04-02 13:35 Alex Elder
  2013-04-02 16:35 ` Sage Weil
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2013-04-02 13:35 UTC (permalink / raw)
  To: ceph-devel@vger.kernel.org

The osd client mutex is acquired just before getting a reference to
a request in handle_reply().  However the error paths after that
don't drop the mutex before returning as they should.

Drop the mutex after dropping the request reference.  Also add a
bad_mutex label at that point and use it so the failed request
lookup case can be handled with the rest.

This resolves:
    http://tracker.ceph.com/issues/4615

Signed-off-by: Alex Elder <elder@inktank.com>
---
 net/ceph/osd_client.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 9b69f47..abbcde3 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1332,8 +1332,7 @@ static void handle_reply(struct ceph_osd_client
*osdc, struct ceph_msg *msg,
 	req = __lookup_request(osdc, tid);
 	if (req == NULL) {
 		dout("handle_reply tid %llu dne\n", tid);
-		mutex_unlock(&osdc->request_mutex);
-		return;
+		goto bad_mutex;
 	}
 	ceph_osdc_get_request(req);

@@ -1422,6 +1421,8 @@ done:

 bad_put:
 	ceph_osdc_put_request(req);
+bad_mutex:
+	mutex_unlock(&osdc->request_mutex);
 bad:
 	pr_err("corrupt osd_op_reply got %d %d\n",
 	       (int)msg->front.iov_len, le32_to_cpu(msg->hdr.front_len));
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libceph: drop mutex on error in handle_reply()
  2013-04-02 13:35 [PATCH] libceph: drop mutex on error in handle_reply() Alex Elder
@ 2013-04-02 16:35 ` Sage Weil
  0 siblings, 0 replies; 2+ messages in thread
From: Sage Weil @ 2013-04-02 16:35 UTC (permalink / raw)
  To: Alex Elder; +Cc: ceph-devel@vger.kernel.org

Reviewed-by: Sage Weil <sage@inktank.com>

On Tue, 2 Apr 2013, Alex Elder wrote:

> The osd client mutex is acquired just before getting a reference to
> a request in handle_reply().  However the error paths after that
> don't drop the mutex before returning as they should.
> 
> Drop the mutex after dropping the request reference.  Also add a
> bad_mutex label at that point and use it so the failed request
> lookup case can be handled with the rest.
> 
> This resolves:
>     http://tracker.ceph.com/issues/4615
> 
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>  net/ceph/osd_client.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 9b69f47..abbcde3 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -1332,8 +1332,7 @@ static void handle_reply(struct ceph_osd_client
> *osdc, struct ceph_msg *msg,
>  	req = __lookup_request(osdc, tid);
>  	if (req == NULL) {
>  		dout("handle_reply tid %llu dne\n", tid);
> -		mutex_unlock(&osdc->request_mutex);
> -		return;
> +		goto bad_mutex;
>  	}
>  	ceph_osdc_get_request(req);
> 
> @@ -1422,6 +1421,8 @@ done:
> 
>  bad_put:
>  	ceph_osdc_put_request(req);
> +bad_mutex:
> +	mutex_unlock(&osdc->request_mutex);
>  bad:
>  	pr_err("corrupt osd_op_reply got %d %d\n",
>  	       (int)msg->front.iov_len, le32_to_cpu(msg->hdr.front_len));
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-02 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02 13:35 [PATCH] libceph: drop mutex on error in handle_reply() Alex Elder
2013-04-02 16:35 ` Sage Weil

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.