From: Lars Marowsky-Bree <[email-masked]>

Use the sense data in the dm-mpath hardware handlers.

Signed-off-by: Lars Marowsky-Bree <[email-masked]>
---

 drivers/md/dm-emc.c        |   13 +++++--------
 drivers/md/dm-hw-handler.c |   10 ++++------
 2 files changed, 9 insertions(+), 14 deletions(-)

Index: linux-2.6.21/drivers/md/dm-emc.c
===================================================================
--- linux-2.6.21.orig/drivers/md/dm-emc.c	2007-05-01 17:41:13.000000000 +0100
+++ linux-2.6.21/drivers/md/dm-emc.c	2007-05-03 17:21:03.000000000 +0100
@@ -289,12 +289,10 @@ static void emc_destroy(struct hw_handle
 
 static unsigned emc_error(struct hw_handler *hwh, struct bio *bio)
 {
-	/* FIXME: Patch from axboe still missing */
-#if 0
 	int sense;
 
-	if (bio->bi_error & BIO_SENSE) {
-		sense = bio->bi_error & 0xffffff; /* sense key / asc / ascq */
+	if (bio_sense_valid(bio)) {
+		sense = bio_sense_value(bio); /* sense key / asc / ascq */
 
 		if (sense == 0x020403) {
 			/* LUN Not Ready - Manual Intervention Required
@@ -305,21 +303,20 @@ static unsigned emc_error(struct hw_hand
 			 * progress, we should set FAIL_PATH too.
 			 * This indicates we might have to do a SCSI
 			 * inquiry in the end_io path. Ugh. */
-			return MP_BYPASS_PG | MP_RETRY_IO;
+			return MP_BYPASS_PG;
 		} else if (sense == 0x052501) {
 			/* An array based copy is in progress. Do not
 			 * fail the path, do not bypass to another PG,
 			 * do not retry. Fail the IO immediately.
 			 * (Actually this is the same conclusion as in
 			 * the default handler, but lets make sure.) */
-			return 0;
+			return MP_ERROR_IO;
 		} else if (sense == 0x062900) {
 			/* Unit Attention Code. This is the first IO
 			 * to the new path, so just retry. */
-			return MP_RETRY_IO;
+			return 0;
 		}
 	}
-#endif
 
 	/* Try default handler */
 	return dm_scsi_err_handler(hwh, bio);
Index: linux-2.6.21/drivers/md/dm-hw-handler.c
===================================================================
--- linux-2.6.21.orig/drivers/md/dm-hw-handler.c	2007-05-01 17:41:13.000000000 +0100
+++ linux-2.6.21/drivers/md/dm-hw-handler.c	2007-05-03 17:21:03.000000000 +0100
@@ -150,15 +150,14 @@ int dm_unregister_hw_handler(struct hw_h
 
 unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio)
 {
-#if 0
 	int sense_key, asc, ascq;
 
-	if (bio->bi_error & BIO_SENSE) {
+	if (bio_sense_valid(bio)) {
 		/* FIXME: This is just an initial guess. */
 		/* key / asc / ascq */
-		sense_key = (bio->bi_error >> 16) & 0xff;
-		asc = (bio->bi_error >> 8) & 0xff;
-		ascq = bio->bi_error & 0xff;
+		sense_key = (bio_sense_value(bio) >> 16) & 0xff;
+		asc = (bio_sense_value(bio) >> 8) & 0xff;
+		ascq = bio_sense_value(bio) & 0xff;
 
 		switch (sense_key) {
 			/* This block as a whole comes from the device.
@@ -203,7 +202,6 @@ unsigned dm_scsi_err_handler(struct hw_h
 			return 0;
 		}
 	}
-#endif
 
 	/* We got no idea how to decode the other kinds of errors ->
 	 * assume generic error condition. */