All of lore.kernel.org
 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] rbd: fix I/O error propagation for reads
Date: Tue, 27 Aug 2013 07:29:46 -0500	[thread overview]
Message-ID: <521C9BBA.7070404@linaro.org> (raw)
In-Reply-To: <1377567242-25736-1-git-send-email-josh.durgin@inktank.com>

On 08/26/2013 08:34 PM, Josh Durgin wrote:
> When a request returns an error, the driver needs to report the entire
> extent of the request as completed.  Writes already did this, since

You're right.  The block layer needs to "consume" the bytes in this
portion of the image request whether or not they were completed
successfully.

This looks good to me.

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

> they always set xferred = length, but reads were skipping that step if
> an error other than -ENOENT occurred.  Instead, rbd would end up
> passing 0 xferred to blk_end_request(), which would always report
> needing more data.  This resulted in an assert failing when more data
> was required by the block layer, but all the object requests were
> done:
> 
> [ 1868.719077] rbd: obj_request read result -108 xferred 0
> [ 1868.719077]
> [ 1868.719518] end_request: I/O error, dev rbd1, sector 0
> [ 1868.719739]
> [ 1868.719739] Assertion failure in rbd_img_obj_callback() at line 1736:
> [ 1868.719739]
> [ 1868.719739]   rbd_assert(more ^ (which == img_request->obj_request_count));
> 
> Without this assert, reads that hit errors would hang forever, since
> the block layer considered them incomplete.
> 
> Fixes: http://tracker.ceph.com/issues/5647
> Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
> ---
>  drivers/block/rbd.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 0d669ae..f8fd7d3 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1557,11 +1557,12 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
>  		obj_request, obj_request->img_request, obj_request->result,
>  		xferred, length);
>  	/*
> -	 * ENOENT means a hole in the image.  We zero-fill the
> -	 * entire length of the request.  A short read also implies
> -	 * zero-fill to the end of the request.  Either way we
> -	 * update the xferred count to indicate the whole request
> -	 * was satisfied.
> +	 * ENOENT means a hole in the image.  We zero-fill the entire
> +	 * length of the request.  A short read also implies zero-fill
> +	 * to the end of the request.  An error requires the whole
> +	 * length of the request to be reported finished with an error
> +	 * to the block layer.  In each case we update the xferred
> +	 * count to indicate the whole request was satisfied.
>  	 */
>  	rbd_assert(obj_request->type != OBJ_REQUEST_NODATA);
>  	if (obj_request->result == -ENOENT) {
> @@ -1570,14 +1571,13 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
>  		else
>  			zero_pages(obj_request->pages, 0, length);
>  		obj_request->result = 0;
> -		obj_request->xferred = length;
>  	} else if (xferred < length && !obj_request->result) {
>  		if (obj_request->type == OBJ_REQUEST_BIO)
>  			zero_bio_chain(obj_request->bio_list, xferred);
>  		else
>  			zero_pages(obj_request->pages, xferred, length);
> -		obj_request->xferred = length;
>  	}
> +	obj_request->xferred = length;
>  	obj_request_done_set(obj_request);
>  }
>  
> 


  parent reply	other threads:[~2013-08-27 12:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-27  1:34 [PATCH] rbd: fix I/O error propagation for reads Josh Durgin
2013-08-27  3:27 ` Mike Dawson
2013-08-27  7:19   ` Josh Durgin
2013-08-27 12:29 ` Alex Elder [this message]
2013-08-27 15:36   ` Sage Weil
2013-08-27 15:40     ` 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=521C9BBA.7070404@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 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.