diff mbox

rbd: assert next_completion under completion_lock

Message ID 1395755268-11908-1-git-send-email-ilya.dryomov@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov March 25, 2014, 1:47 p.m. UTC
completion_lock is there specifically to protect next_completion.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
---
 drivers/block/rbd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alex Elder March 25, 2014, 3:25 p.m. UTC | #1
On 03/25/2014 08:47 AM, Ilya Dryomov wrote:
> completion_lock is there specifically to protect next_completion.
> 
> Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>

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

> ---
>  drivers/block/rbd.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index fbf41e058bfd..f044fab3da99 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2123,12 +2123,12 @@ static void rbd_img_obj_callback(struct rbd_obj_request *obj_request)
>  	rbd_assert(img_request->obj_request_count > 0);
>  	rbd_assert(which != BAD_WHICH);
>  	rbd_assert(which < img_request->obj_request_count);
> -	rbd_assert(which >= img_request->next_completion);
>  
>  	spin_lock_irq(&img_request->completion_lock);
> -	if (which != img_request->next_completion)
> +	if (which > img_request->next_completion)
>  		goto out;
>  
> +	rbd_assert(which == img_request->next_completion);
>  	for_each_obj_request_from(img_request, obj_request) {
>  		rbd_assert(more);
>  		rbd_assert(which < img_request->obj_request_count);
> 

--
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 fbf41e058bfd..f044fab3da99 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2123,12 +2123,12 @@  static void rbd_img_obj_callback(struct rbd_obj_request *obj_request)
 	rbd_assert(img_request->obj_request_count > 0);
 	rbd_assert(which != BAD_WHICH);
 	rbd_assert(which < img_request->obj_request_count);
-	rbd_assert(which >= img_request->next_completion);
 
 	spin_lock_irq(&img_request->completion_lock);
-	if (which != img_request->next_completion)
+	if (which > img_request->next_completion)
 		goto out;
 
+	rbd_assert(which == img_request->next_completion);
 	for_each_obj_request_from(img_request, obj_request) {
 		rbd_assert(more);
 		rbd_assert(which < img_request->obj_request_count);