diff mbox

[v2] rbd: drop original request earlier for existence check

Message ID 51954FB1.9060902@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder May 16, 2013, 9:29 p.m. UTC
The reference to the original request dropped at the end of
rbd_img_obj_exists_callback() corresponds to the reference taken
in rbd_img_obj_exists_submit() to account for the stat request
referring to it.  Move the put of that reference up right after
clearing that pointer to make its purpose more obvious.

Signed-off-by: Alex Elder <elder@inktank.com>
---
v2: rebased to reflect changes in earlier patches

 drivers/block/rbd.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


@@ -2549,7 +2550,6 @@ static void rbd_img_obj_exists_callback(struct
rbd_obj_request *obj_request)
 	if (!rbd_dev->parent_overlap) {
 		struct ceph_osd_client *osdc;

-		rbd_obj_request_put(orig_request);
 		osdc = &rbd_dev->rbd_client->client->osdc;
 		result = rbd_obj_request_submit(osdc, orig_request);
 		if (!result)
@@ -2579,7 +2579,6 @@ static void rbd_img_obj_exists_callback(struct
rbd_obj_request *obj_request)
 out:
 	if (orig_request->result)
 		rbd_obj_request_complete(orig_request);
-	rbd_obj_request_put(orig_request);
 }

 static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)

Comments

Josh Durgin May 17, 2013, 1:42 a.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 05/16/2013 02:29 PM, Alex Elder wrote:
> The reference to the original request dropped at the end of
> rbd_img_obj_exists_callback() corresponds to the reference taken
> in rbd_img_obj_exists_submit() to account for the stat request
> referring to it.  Move the put of that reference up right after
> clearing that pointer to make its purpose more obvious.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
> v2: rebased to reflect changes in earlier patches
>
>   drivers/block/rbd.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index fdbcf04..b4c5e47 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2529,6 +2529,7 @@ static void rbd_img_obj_exists_callback(struct
> rbd_obj_request *obj_request)
>   	 */
>   	orig_request = obj_request->obj_request;
>   	obj_request->obj_request = NULL;
> +	rbd_obj_request_put(orig_request);
>   	rbd_assert(orig_request);
>   	rbd_assert(orig_request->img_request);
>
> @@ -2549,7 +2550,6 @@ static void rbd_img_obj_exists_callback(struct
> rbd_obj_request *obj_request)
>   	if (!rbd_dev->parent_overlap) {
>   		struct ceph_osd_client *osdc;
>
> -		rbd_obj_request_put(orig_request);
>   		osdc = &rbd_dev->rbd_client->client->osdc;
>   		result = rbd_obj_request_submit(osdc, orig_request);
>   		if (!result)
> @@ -2579,7 +2579,6 @@ static void rbd_img_obj_exists_callback(struct
> rbd_obj_request *obj_request)
>   out:
>   	if (orig_request->result)
>   		rbd_obj_request_complete(orig_request);
> -	rbd_obj_request_put(orig_request);
>   }
>
>   static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
>

--
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/drivers/block/rbd.c b/drivers/block/rbd.c
index fdbcf04..b4c5e47 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2529,6 +2529,7 @@  static void rbd_img_obj_exists_callback(struct
rbd_obj_request *obj_request)
 	 */
 	orig_request = obj_request->obj_request;
 	obj_request->obj_request = NULL;
+	rbd_obj_request_put(orig_request);
 	rbd_assert(orig_request);
 	rbd_assert(orig_request->img_request);