From patchwork Fri Nov 20 07:52:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 61596 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAK7qwnD015471 for ; Fri, 20 Nov 2009 07:52:58 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id DBA21619F3B; Fri, 20 Nov 2009 02:52:57 -0500 (EST) Received: from int-mx03.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id nAK7quFK023467 for ; Fri, 20 Nov 2009 02:52:56 -0500 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.5]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAK7queS010532 for ; Fri, 20 Nov 2009 02:52:56 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAK7qeGl027890 for ; Fri, 20 Nov 2009 02:52:41 -0500 Received: from relay2.suse.de (mail2.suse.de [195.135.221.8]) by mx2.suse.de (Postfix) with ESMTP id 3967479727; Fri, 20 Nov 2009 08:52:40 +0100 (CET) Date: Fri, 20 Nov 2009 08:52:40 +0100 To: James Bottomley User-Agent: Heirloom mailx 12.2 01/07/07 MIME-Version: 1.0 Message-Id: <20091120075240.1BB3F3A081@ochil.suse.de> From: hare@suse.de (Hannes Reinecke) X-RedHat-Spam-Score: -3.972 (AWL,RCVD_IN_DNSWL_MED) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.5 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, linux-scsi@vger.kernel.org Subject: [dm-devel] [PATCH] scsi: Introduce REQ_SCSI_ERROR flag X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index e5a3884..ccba32d 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -1258,9 +1258,12 @@ static int do_end_io(struct multipath *m, struct request *clone, if (error == -EOPNOTSUPP) return error; - r = eval_scsi_error(clone->errors, clone->sense, clone->sense_len); - if (r != DM_ENDIO_REQUEUE) - return r; + if (blk_rq_scsi_error(clone)) { + r = eval_scsi_error(clone->errors, clone->sense, + clone->sense_len); + if (r != DM_ENDIO_REQUEUE) + return r; + } if (mpio->pgpath) fail_path(mpio->pgpath); diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 10aa084..e878fc5 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -723,6 +723,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) } req->errors = result; + req->cmd_flags |= REQ_SCSI_ERROR; + if (sense_valid && req->sense) { int len = 8 + cmd->sense_buffer[7]; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 221cecd..dbc3302 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -115,6 +115,7 @@ enum rq_flag_bits { __REQ_NOIDLE, /* Don't anticipate more IO after this one */ __REQ_IO_STAT, /* account I/O stat */ __REQ_MIXED_MERGE, /* merge of different types, fail separately */ + __REQ_SCSI_ERROR, /* errors are SCSI result codes */ __REQ_NR_BITS, /* stops here */ }; @@ -144,6 +145,7 @@ enum rq_flag_bits { #define REQ_NOIDLE (1 << __REQ_NOIDLE) #define REQ_IO_STAT (1 << __REQ_IO_STAT) #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) +#define REQ_SCSI_ERROR (1 << __REQ_SCSI_ERROR) #define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \ REQ_FAILFAST_DRIVER) @@ -606,6 +608,7 @@ enum { #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) #define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT) #define blk_rq_quiet(rq) ((rq)->cmd_flags & REQ_QUIET) +#define blk_rq_scsi_error(rq) ((rq)->cmd_flags & REQ_SCSI_ERROR) #define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))