diff mbox

[05/14] libceph: harden ceph_osdc_request_release() a bit

Message ID 1403716607-13535-6-git-send-email-ilya.dryomov@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov June 25, 2014, 5:16 p.m. UTC
Add some WARN_ONs to alert us when we try to destroy requests that are
still registered.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
---
 net/ceph/osd_client.c |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Alex Elder June 30, 2014, 12:36 p.m. UTC | #1
On 06/25/2014 12:16 PM, Ilya Dryomov wrote:
> Add some WARN_ONs to alert us when we try to destroy requests that are
> still registered.
> 
> Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>

Good idea.  Especially the RB_CLEAR_NODE() call.

Reviewed-by: Alex Elder <elder@linaro.org>

> ---
>  net/ceph/osd_client.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 7406046212dc..052eb8bfcc74 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -305,6 +305,12 @@ static void ceph_osdc_release_request(struct kref *kref)
>  
>  	dout("%s %p (r_request %p r_reply %p)\n", __func__, req,
>  	     req->r_request, req->r_reply);
> +	WARN_ON(!RB_EMPTY_NODE(&req->r_node));
> +	WARN_ON(!list_empty(&req->r_req_lru_item));
> +	WARN_ON(!list_empty(&req->r_osd_item));
> +	WARN_ON(!list_empty(&req->r_linger_item));
> +	WARN_ON(!list_empty(&req->r_linger_osd_item));
> +	WARN_ON(req->r_osd);
>  
>  	if (req->r_request)
>  		ceph_msg_put(req->r_request);
> @@ -1204,6 +1210,7 @@ static void __unregister_request(struct ceph_osd_client *osdc,
>  
>  	dout("__unregister_request %p tid %lld\n", req, req->r_tid);
>  	rb_erase(&req->r_node, &osdc->requests);
> +	RB_CLEAR_NODE(&req->r_node);
>  	osdc->num_requests--;
>  
>  	if (req->r_osd) {
> 

--
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
diff mbox

Patch

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 7406046212dc..052eb8bfcc74 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -305,6 +305,12 @@  static void ceph_osdc_release_request(struct kref *kref)
 
 	dout("%s %p (r_request %p r_reply %p)\n", __func__, req,
 	     req->r_request, req->r_reply);
+	WARN_ON(!RB_EMPTY_NODE(&req->r_node));
+	WARN_ON(!list_empty(&req->r_req_lru_item));
+	WARN_ON(!list_empty(&req->r_osd_item));
+	WARN_ON(!list_empty(&req->r_linger_item));
+	WARN_ON(!list_empty(&req->r_linger_osd_item));
+	WARN_ON(req->r_osd);
 
 	if (req->r_request)
 		ceph_msg_put(req->r_request);
@@ -1204,6 +1210,7 @@  static void __unregister_request(struct ceph_osd_client *osdc,
 
 	dout("__unregister_request %p tid %lld\n", req, req->r_tid);
 	rb_erase(&req->r_node, &osdc->requests);
+	RB_CLEAR_NODE(&req->r_node);
 	osdc->num_requests--;
 
 	if (req->r_osd) {