All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>, mtosatti@redhat.com
Subject: Re: [RFC] block: fix barrier error transmission
Date: Wed, 2 Apr 2008 21:08:28 +0200	[thread overview]
Message-ID: <20080402190827.GJ12774@kernel.dk> (raw)
In-Reply-To: <1207159348.3082.45.camel@localhost.localdomain>

On Wed, Apr 02 2008, James Bottomley wrote:
> There's a problem with barriers in SCSI.  They're prepared as a
> SYNCHRONIZE_CACHE REQ_TYPE_BLOCK_PC command.  However, our processing
> model dictates that we always return no block error but set req->errors
> to the SCSI result.  The upshot is that if we get an error on a flush
> barrier, it's never seen by the block layer.
> 
> This patch attempts to get the block layer to see such errors.  Note,
> it's still not quite right.  There are possible sense errors that could
> indicate success of the command (like deferred errors) that this will
> treat as failures.  I suppose we could process the sense in scsi and try
> to return a first pass error even for REQ_TYPE_BLOCK_PC ... I'm just not
> sure what that will do to the other users.
> 
> James
> 
> ---
> 
> diff --git a/block/blk-barrier.c b/block/blk-barrier.c
> index 55c5f1f..3a3947c 100644
> --- a/block/blk-barrier.c
> +++ b/block/blk-barrier.c
> @@ -114,18 +114,24 @@ void blk_ordered_complete_seq(struct request_queue *q, unsigned seq, int error)
>  
>  static void pre_flush_end_io(struct request *rq, int error)
>  {
> +	error = rq->errors ? -EIO : error;
> +
>  	elv_completed_request(rq->q, rq);
>  	blk_ordered_complete_seq(rq->q, QUEUE_ORDSEQ_PREFLUSH, error);
>  }

It's a bit of a hack, SCSI really should pass the error value back
instead of fiddling around with possibly perhaps finding it in ->errors.
And please don't use these ?: constructs, in this case it doesn't even
make a lot of sense and a

        if (rq->errors)
                error = -EIO;

would have been much cleaner ;-)

So my question is why does the model not allow you to return the error
properly?

-- 
Jens Axboe


  reply	other threads:[~2008-04-02 19:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 18:02 [RFC] block: fix barrier error transmission James Bottomley
2008-04-02 19:08 ` Jens Axboe [this message]
2008-04-02 23:11   ` James Bottomley
2008-04-03  8:06     ` Jens Axboe
2008-04-03 14:02       ` James Bottomley
2008-04-04 11:46         ` Jens Axboe

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=20080402190827.GJ12774@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mtosatti@redhat.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.