CEPH filesystem development
 help / color / mirror / Atom feed
From: Alex Elder <alex.elder@linaro.org>
To: Josh Durgin <josh.durgin@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH v3 2/5] rbd: make rbd_obj_notify_ack() synchronous
Date: Mon, 09 Sep 2013 07:06:23 -0500	[thread overview]
Message-ID: <522DB9BF.1050206@linaro.org> (raw)
In-Reply-To: <1378711022-20158-3-git-send-email-josh.durgin@inktank.com>

On 09/09/2013 02:16 AM, Josh Durgin wrote:
> The only user of rbd_obj_notify_ack() is rbd_watch_cb(). It used
> asynchronously with no tracking of when the notify ack completes, so
> it may still be in progress when the osd_client is shut down.  This
> results in a BUG() since the osd client assumes no requests are in
> flight when it stops. Since all notifies are flushed before the
> osd_client is stopped, waiting for the notify ack to complete before
> returning from the watch callback ensures there are no notify acks in
> flight during shutdown.
> 
> Rename rbd_obj_notify_ack() to rbd_obj_notify_ack_sync() to reflect
> its new synchronous nature.
> 
> Signed-off-by: Josh Durgin <josh.durgin@inktank.com>

Looks great.  Nice description.

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

> ---
>  drivers/block/rbd.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index bf89e34..9e5f07f 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2808,7 +2808,7 @@ out_err:
>  	obj_request_done_set(obj_request);
>  }
>  
> -static int rbd_obj_notify_ack(struct rbd_device *rbd_dev, u64 notify_id)
> +static int rbd_obj_notify_ack_sync(struct rbd_device *rbd_dev, u64 notify_id)
>  {
>  	struct rbd_obj_request *obj_request;
>  	struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
> @@ -2823,16 +2823,17 @@ static int rbd_obj_notify_ack(struct rbd_device *rbd_dev, u64 notify_id)
>  	obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, obj_request);
>  	if (!obj_request->osd_req)
>  		goto out;
> -	obj_request->callback = rbd_obj_request_put;
>  
>  	osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_NOTIFY_ACK,
>  					notify_id, 0, 0);
>  	rbd_osd_req_format_read(obj_request);
>  
>  	ret = rbd_obj_request_submit(osdc, obj_request);
> -out:
>  	if (ret)
> -		rbd_obj_request_put(obj_request);
> +		goto out;
> +	ret = rbd_obj_request_wait(obj_request);
> +out:
> +	rbd_obj_request_put(obj_request);
>  
>  	return ret;
>  }
> @@ -2852,7 +2853,7 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
>  	if (ret)
>  		rbd_warn(rbd_dev, "header refresh error (%d)\n", ret);
>  
> -	rbd_obj_notify_ack(rbd_dev, notify_id);
> +	rbd_obj_notify_ack_sync(rbd_dev, notify_id);
>  }
>  
>  /*
> 


  reply	other threads:[~2013-09-09 12:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09  7:16 [PATCH v3 0/5] fix shutdown races and snapshot error handling Josh Durgin
2013-09-09  7:16 ` [PATCH v3 1/5] rbd: complete notifies before cleaning up osd_client and rbd_dev Josh Durgin
2013-09-09  7:16 ` [PATCH v3 2/5] rbd: make rbd_obj_notify_ack() synchronous Josh Durgin
2013-09-09 12:06   ` Alex Elder [this message]
2013-09-09  7:17 ` [PATCH v3 3/5] rbd: fix use-after free of rbd_dev->disk Josh Durgin
2013-09-09 13:37   ` Alex Elder
2013-09-09 16:15     ` Josh Durgin
2013-09-09 16:43       ` Alex Elder
2013-09-09  7:17 ` [PATCH v3 4/5] rbd: ignore unmapped snapshots that no longer exist Josh Durgin
2013-09-09 13:47   ` Alex Elder
2013-09-09  7:17 ` [PATCH v3 5/5] rbd: fix error handling from rbd_snap_name() Josh Durgin
2013-09-09 13:49   ` Alex Elder
2013-09-09 13:50 ` [PATCH v3 0/5] fix shutdown races and snapshot error handling Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=522DB9BF.1050206@linaro.org \
    --to=alex.elder@linaro.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=josh.durgin@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox