From: Dave Wysochanski <dwysocha@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: [patch 3/3] Add retries to hp hardware handler if path initialization command completes with a check condition.
Date: Thu, 26 Jul 2007 14:24:23 -0400 [thread overview]
Message-ID: <1185474263.4843.11.camel@linux-cxyg> (raw)
In-Reply-To: <46A8BAB7.4060003@cs.wisc.edu>
[-- Attachment #1: Type: text/plain, Size: 396 bytes --]
On Thu, 2007-07-26 at 10:16 -0500, Mike Christie wrote:
> dwysocha@redhat.com wrote:
>
>
> struct hp_sw_context {
> unsigned char sense[SCSI_SENSE_BUFFERSIZE];
> + unsigned argc;
> };
>
>
> argc does not seem to be used anywhere that I could see.
>
> Also do not forget your signed off line.
>
Indeed, argc was a remnant of prior code that had retries in the
hardware handler.
[-- Attachment #2: dm-hp-sw-add-retries-handle-not-ready.patch --]
[-- Type: text/x-patch, Size: 3956 bytes --]
Add retries to hp hardware handler if path initialization command completes
with a check condition.
This patch adds retries to the hp hardware handler, and utilizes the
MP_RETRY flag of dm-multipath. For now in the hp handler, if we get a
pg_init completed with a check condition we just assume we can retry the
pg_init command. We make this assumption because of incomplete data on
specific check condition code of the HP hardware, and because testing
has shown the HP path initialization command to be idempotent.
The number of times we retry is settable via the "pg_init_retries"
multipath map feature.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
Index: linux-2.6.23-rc1/drivers/md/dm-hp-sw.c
===================================================================
--- linux-2.6.23-rc1.orig/drivers/md/dm-hp-sw.c
+++ linux-2.6.23-rc1/drivers/md/dm-hp-sw.c
@@ -18,6 +18,7 @@
#include <linux/types.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_dbg.h>
#include "dm.h"
#include "dm-hw-handler.h"
@@ -28,6 +29,39 @@ struct hp_sw_context {
unsigned char sense[SCSI_SENSE_BUFFERSIZE];
};
+/**
+ * hp_sw_error_is_retryable - Is an HP-specific check condition retryable?
+ * @req: path activation request
+ *
+ * Examine error codes of request and determine whether the error is retryable.
+ * Some error codes are already retried by scsi-ml (see
+ * scsi_decide_disposition), but some HP specific codes are not.
+ * The intent of this routine is to supply the logic for the HP specific
+ * check conditions.
+ *
+ * Returns:
+ * 1 - command completed with retryable error
+ * 0 - command completed with non-retryable error
+ *
+ * Possible optimizations
+ * 1. More hardware-specific error codes
+ */
+static int hp_sw_error_is_retryable(struct request *req)
+{
+ /*
+ * NOT_READY is known to be retryable
+ * For now we just dump out the sense data and call it retryable
+ */
+ if (status_byte(req->errors) == CHECK_CONDITION)
+ __scsi_print_sense("hp_sw", req->sense, req->sense_len);
+
+ /*
+ * At this point we don't have complete information about all the error
+ * codes from this hardware, so we are just conservative and retry
+ * when in doubt.
+ */
+ return 1;
+}
/**
* hp_sw_end_io - Completion handler for HP path activation.
@@ -39,8 +73,6 @@ struct hp_sw_context {
*
* Context: scsi-ml softirq
*
- * Possible optimizations
- * 1. Actually check sense data for retryable error (e.g. NOT_READY)
*/
static void hp_sw_end_io(struct request *req, int error)
{
@@ -52,11 +84,17 @@ static void hp_sw_end_io(struct request
DMDEBUG("%s path activation command - success",
path->dev->name);
} else {
- DMWARN("path activation command on %s - error=0x%x",
- path->dev->name, error);
+ if (hp_sw_error_is_retryable(req)) {
+ DMDEBUG("%s path activation command retry",
+ path->dev->name);
+ err_flags = MP_RETRY;
+ goto out;
+ }
+ DMWARN("%s path activation fail - error=0x%x",
+ path->dev->name, error);
err_flags = MP_FAIL_PATH;
}
-
+ out:
req->end_io_data = NULL;
__blk_put_request(req->q, req);
dm_pg_init_complete(path, err_flags);
@@ -134,17 +172,16 @@ static void hp_sw_pg_init(struct hw_hand
if (!req) {
DMERR("%s path activation command allocation fail ",
path->dev->name);
- goto fail;
+ goto retry;
}
- DMDEBUG("path activation command sent on %s",
- path->dev->name);
+ DMDEBUG("%s path activation command sent", path->dev->name);
blk_execute_rq_nowait(req->q, NULL, req, 1, hp_sw_end_io);
return;
- fail:
- dm_pg_init_complete(path, MP_FAIL_PATH);
+ retry:
+ dm_pg_init_complete(path, MP_RETRY);
}
static int hp_sw_create(struct hw_handler *hwh, unsigned argc, char **argv)
@@ -181,7 +218,7 @@ static int __init hp_sw_init(void)
if (r < 0)
DMERR("register failed %d", r);
else
- DMINFO("version 0.0.2 loaded");
+ DMINFO("version 0.0.3 loaded");
return r;
}
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2007-07-26 18:24 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-26 4:44 [patch 0/3] Add HP hardware handler support to dm-multipath dwysocha
2007-07-26 4:44 ` [patch 1/3] Extremely basic hp hardware handler (no retries, no error handling, etc) dwysocha
2007-07-26 15:18 ` Mike Christie
2007-07-26 16:16 ` Dave Wysochanski
2007-07-26 19:09 ` Chandra Seetharaman
2007-07-30 18:06 ` Dave Wysochanski
2007-07-30 19:25 ` Chandra Seetharaman
2007-07-30 20:10 ` Dave Wysochanski
2007-07-30 22:05 ` Chandra Seetharaman
2007-07-30 21:08 ` Mike Christie
2007-07-30 22:08 ` Dave Wysochanski
2007-07-30 23:27 ` Chandra Seetharaman
2007-07-31 3:35 ` Mike Christie
2007-07-31 17:35 ` Chandra Seetharaman
2007-07-31 17:37 ` Mike Christie
2007-07-26 4:44 ` [patch 2/3] Add MP_RETRY flag for hw handlers to tell dm-mpath to retry pg_init dwysocha
2007-07-26 15:20 ` Mike Christie
2007-07-26 18:21 ` Dave Wysochanski
2007-07-26 19:15 ` Chandra Seetharaman
2007-07-30 18:54 ` Dave Wysochanski
2007-07-30 19:03 ` CVS pull of device mapper Wood, Brian J
2007-07-30 21:49 ` Mike Snitzer
2007-07-30 22:20 ` Wood, Brian J
2007-07-30 22:46 ` Wood, Brian J
2007-07-30 19:26 ` [patch 2/3] Add MP_RETRY flag for hw handlers to tell dm-mpath to retry pg_init Chandra Seetharaman
2007-07-30 21:11 ` Mike Christie
2007-07-30 22:15 ` Dave Wysochanski
2007-07-26 4:44 ` [patch 3/3] Add retries to hp hardware handler if path initialization command completes with a check condition dwysocha
2007-07-26 15:16 ` Mike Christie
2007-07-26 18:24 ` Dave Wysochanski [this message]
2007-07-26 19:19 ` Chandra Seetharaman
2007-07-30 19:10 ` Dave Wysochanski
2007-07-30 19:27 ` Chandra Seetharaman
2007-07-30 21:08 ` Mike Christie
2007-07-30 22:16 ` Dave Wysochanski
-- strict thread matches above, loose matches on Subject: below --
2007-08-02 16:15 [patch 0/3] Add HP hardware handler support to dm-multipath dwysocha
2007-08-02 16:15 ` [patch 3/3] Add retries to hp hardware handler if path initialization command completes with a check condition dwysocha
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=1185474263.4843.11.camel@linux-cxyg \
--to=dwysocha@redhat.com \
--cc=dm-devel@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.