* [PATCH 01/12] qla4xxx: wait for device to come online in reset_lun
@ 2010-04-06 10:13 Ravi Anand
2010-04-07 3:35 ` Mike Christie
0 siblings, 1 reply; 2+ messages in thread
From: Ravi Anand @ 2010-04-06 10:13 UTC (permalink / raw)
To: James Bottomley; +Cc: Mike Christie, Linux-SCSI Mailing List, Vikas Chaudhary
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
wait upto 10s for device to come online otherwise indicating
an error condition.
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_def.h | 1 +
drivers/scsi/qla4xxx/ql4_mbx.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 81b5f29..38e261d 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -146,6 +146,7 @@
#define ISNS_DEREG_TOV 5
#define MAX_RESET_HA_RETRIES 2
+#define DEVICE_ONLINE_TOV 10
/*
* SCSI Request Block structure (srb) that is placed
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 09d6d4b..4d8b3cb 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -679,11 +679,33 @@ int qla4xxx_reset_lun(struct scsi_qla_host * ha, struct ddb_entry * ddb_entry,
uint32_t mbox_cmd[MBOX_REG_COUNT];
uint32_t mbox_sts[MBOX_REG_COUNT];
int status = QLA_SUCCESS;
+ unsigned long wait_online;
DEBUG2(printk("scsi%ld:%d:%d: lun reset issued\n", ha->host_no,
ddb_entry->os_target_id, lun));
/*
+ * If device is not online wait for 10 sec for device to come online.
+ * else return error
+ */
+ if (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) {
+ wait_online = jiffies + (DEVICE_ONLINE_TOV * HZ);
+ while (time_before(jiffies, wait_online)) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ);
+ if (atomic_read(&ddb_entry->state) == DDB_STATE_ONLINE)
+ break;
+ }
+
+ if (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) {
+ DEBUG2(printk(KERN_WARNING "scsi%ld: %s: Unable to "
+ "reset lun. Device is not online.\n",
+ ha->host_no, __func__));
+ return QLA_ERROR;
+ }
+ }
+
+ /*
* Send lun reset command to ISP, so that the ISP will return all
* outstanding requests with RESET status
*/
--
1.6.0.2
----- End forwarded message -----
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 01/12] qla4xxx: wait for device to come online in reset_lun
2010-04-06 10:13 [PATCH 01/12] qla4xxx: wait for device to come online in reset_lun Ravi Anand
@ 2010-04-07 3:35 ` Mike Christie
0 siblings, 0 replies; 2+ messages in thread
From: Mike Christie @ 2010-04-07 3:35 UTC (permalink / raw)
To: Ravi Anand; +Cc: James Bottomley, Linux-SCSI Mailing List, Vikas Chaudhary
On 04/06/2010 05:13 AM, Ravi Anand wrote:
>
> From: Vikas Chaudhary<vikas.chaudhary@qlogic.com>
>
> wait upto 10s for device to come online otherwise indicating
> an error condition.
>
> Signed-off-by: Vikas Chaudhary<vikas.chaudhary@qlogic.com>
> Signed-off-by: Ravi Anand<ravi.anand@qlogic.com>
> ---
> drivers/scsi/qla4xxx/ql4_def.h | 1 +
> drivers/scsi/qla4xxx/ql4_mbx.c | 22 ++++++++++++++++++++++
> 2 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
> index 81b5f29..38e261d 100644
> --- a/drivers/scsi/qla4xxx/ql4_def.h
> +++ b/drivers/scsi/qla4xxx/ql4_def.h
> @@ -146,6 +146,7 @@
> #define ISNS_DEREG_TOV 5
>
> #define MAX_RESET_HA_RETRIES 2
> +#define DEVICE_ONLINE_TOV 10
>
> /*
> * SCSI Request Block structure (srb) that is placed
> diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
> index 09d6d4b..4d8b3cb 100644
> --- a/drivers/scsi/qla4xxx/ql4_mbx.c
> +++ b/drivers/scsi/qla4xxx/ql4_mbx.c
> @@ -679,11 +679,33 @@ int qla4xxx_reset_lun(struct scsi_qla_host * ha, struct ddb_entry * ddb_entry,
> uint32_t mbox_cmd[MBOX_REG_COUNT];
> uint32_t mbox_sts[MBOX_REG_COUNT];
> int status = QLA_SUCCESS;
> + unsigned long wait_online;
>
> DEBUG2(printk("scsi%ld:%d:%d: lun reset issued\n", ha->host_no,
> ddb_entry->os_target_id, lun));
>
> /*
> + * If device is not online wait for 10 sec for device to come online.
> + * else return error
> + */
> + if (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) {
> + wait_online = jiffies + (DEVICE_ONLINE_TOV * HZ);
> + while (time_before(jiffies, wait_online)) {
> + set_current_state(TASK_INTERRUPTIBLE);
> + schedule_timeout(HZ);
> + if (atomic_read(&ddb_entry->state) == DDB_STATE_ONLINE)
> + break;
> + }
> +
> + if (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) {
> + DEBUG2(printk(KERN_WARNING "scsi%ld: %s: Unable to "
> + "reset lun. Device is not online.\n",
> + ha->host_no, __func__));
> + return QLA_ERROR;
> + }
> + }
> +
This looks similar to what you sent back in Feb. I said to wait in the
target reset handler for the session to come back or for
qla4xxx_recovery_timedout to be called
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-07 3:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06 10:13 [PATCH 01/12] qla4xxx: wait for device to come online in reset_lun Ravi Anand
2010-04-07 3:35 ` Mike Christie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox