public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] block: fix barrier error transmission
@ 2008-04-02 18:02 James Bottomley
  2008-04-02 19:08 ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: James Bottomley @ 2008-04-02 18:02 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-scsi, mtosatti

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);
 }
 
 static void bar_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_BAR, error);
 }
 
 static void post_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_POSTFLUSH, error);
 }



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-04 11:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-02 18:02 [RFC] block: fix barrier error transmission James Bottomley
2008-04-02 19:08 ` Jens Axboe
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox