diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2009-09-14 01:35:24 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-10-02 10:48:50 -0400 |
commit | bcfb6e6ea46d84bfb541069545e5b0d7f6cc3233 (patch) | |
tree | c6ddcd28cc123bf2c1abcb6b79b0c49a3521e1bd /drivers | |
parent | 77e63ed44305e89c0564f8292f9cd5764d4fddfb (diff) |
[SCSI] mpt2sas: Call init_completion on a per request basis.
Now driver call init_completion on a per request basis. At some
point the wait_for_completion_timeout is not waiting for the timeout,
instead returning immediately, thus going into diag reset. This fix will
address all request using the wait_for_completion_timeout API. The previous
implimentation was only calling init_completion at driver
load time.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_base.c | 7 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_ctl.c | 4 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_transport.c | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index a9c71769b4ec..f679bff9fc33 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -2614,6 +2614,7 @@ mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc, | |||
2614 | mpi_request->Operation == MPI2_SAS_OP_PHY_LINK_RESET) | 2614 | mpi_request->Operation == MPI2_SAS_OP_PHY_LINK_RESET) |
2615 | ioc->ioc_link_reset_in_progress = 1; | 2615 | ioc->ioc_link_reset_in_progress = 1; |
2616 | mpt2sas_base_put_smid_default(ioc, smid); | 2616 | mpt2sas_base_put_smid_default(ioc, smid); |
2617 | init_completion(&ioc->base_cmds.done); | ||
2617 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, | 2618 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, |
2618 | msecs_to_jiffies(10000)); | 2619 | msecs_to_jiffies(10000)); |
2619 | if ((mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || | 2620 | if ((mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || |
@@ -2715,6 +2716,7 @@ mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc, | |||
2715 | ioc->base_cmds.smid = smid; | 2716 | ioc->base_cmds.smid = smid; |
2716 | memcpy(request, mpi_request, sizeof(Mpi2SepReply_t)); | 2717 | memcpy(request, mpi_request, sizeof(Mpi2SepReply_t)); |
2717 | mpt2sas_base_put_smid_default(ioc, smid); | 2718 | mpt2sas_base_put_smid_default(ioc, smid); |
2719 | init_completion(&ioc->base_cmds.done); | ||
2718 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, | 2720 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, |
2719 | msecs_to_jiffies(10000)); | 2721 | msecs_to_jiffies(10000)); |
2720 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { | 2722 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { |
@@ -2991,6 +2993,7 @@ _base_send_port_enable(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
2991 | mpi_request->VP_ID = 0; | 2993 | mpi_request->VP_ID = 0; |
2992 | 2994 | ||
2993 | mpt2sas_base_put_smid_default(ioc, smid); | 2995 | mpt2sas_base_put_smid_default(ioc, smid); |
2996 | init_completion(&ioc->base_cmds.done); | ||
2994 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, | 2997 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, |
2995 | 300*HZ); | 2998 | 300*HZ); |
2996 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { | 2999 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { |
@@ -3090,6 +3093,7 @@ _base_event_notification(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3090 | mpi_request->EventMasks[i] = | 3093 | mpi_request->EventMasks[i] = |
3091 | le32_to_cpu(ioc->event_masks[i]); | 3094 | le32_to_cpu(ioc->event_masks[i]); |
3092 | mpt2sas_base_put_smid_default(ioc, smid); | 3095 | mpt2sas_base_put_smid_default(ioc, smid); |
3096 | init_completion(&ioc->base_cmds.done); | ||
3093 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ); | 3097 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ); |
3094 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { | 3098 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { |
3095 | printk(MPT2SAS_ERR_FMT "%s: timeout\n", | 3099 | printk(MPT2SAS_ERR_FMT "%s: timeout\n", |
@@ -3486,7 +3490,6 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3486 | 3490 | ||
3487 | /* base internal command bits */ | 3491 | /* base internal command bits */ |
3488 | mutex_init(&ioc->base_cmds.mutex); | 3492 | mutex_init(&ioc->base_cmds.mutex); |
3489 | init_completion(&ioc->base_cmds.done); | ||
3490 | ioc->base_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); | 3493 | ioc->base_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); |
3491 | ioc->base_cmds.status = MPT2_CMD_NOT_USED; | 3494 | ioc->base_cmds.status = MPT2_CMD_NOT_USED; |
3492 | 3495 | ||
@@ -3494,7 +3497,6 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3494 | ioc->transport_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); | 3497 | ioc->transport_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); |
3495 | ioc->transport_cmds.status = MPT2_CMD_NOT_USED; | 3498 | ioc->transport_cmds.status = MPT2_CMD_NOT_USED; |
3496 | mutex_init(&ioc->transport_cmds.mutex); | 3499 | mutex_init(&ioc->transport_cmds.mutex); |
3497 | init_completion(&ioc->transport_cmds.done); | ||
3498 | 3500 | ||
3499 | /* task management internal command bits */ | 3501 | /* task management internal command bits */ |
3500 | ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); | 3502 | ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); |
@@ -3510,7 +3512,6 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3510 | ioc->ctl_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); | 3512 | ioc->ctl_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); |
3511 | ioc->ctl_cmds.status = MPT2_CMD_NOT_USED; | 3513 | ioc->ctl_cmds.status = MPT2_CMD_NOT_USED; |
3512 | mutex_init(&ioc->ctl_cmds.mutex); | 3514 | mutex_init(&ioc->ctl_cmds.mutex); |
3513 | init_completion(&ioc->ctl_cmds.done); | ||
3514 | 3515 | ||
3515 | for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) | 3516 | for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) |
3516 | ioc->event_masks[i] = -1; | 3517 | ioc->event_masks[i] = -1; |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index 33463ace0d48..57d724633906 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c | |||
@@ -812,6 +812,7 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc, | |||
812 | timeout = MPT2_IOCTL_DEFAULT_TIMEOUT; | 812 | timeout = MPT2_IOCTL_DEFAULT_TIMEOUT; |
813 | else | 813 | else |
814 | timeout = karg.timeout; | 814 | timeout = karg.timeout; |
815 | init_completion(&ioc->ctl_cmds.done); | ||
815 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, | 816 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, |
816 | timeout*HZ); | 817 | timeout*HZ); |
817 | if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) { | 818 | if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) { |
@@ -1388,6 +1389,7 @@ _ctl_diag_register(void __user *arg, enum block_state state) | |||
1388 | cpu_to_le32(ioc->product_specific[buffer_type][i]); | 1389 | cpu_to_le32(ioc->product_specific[buffer_type][i]); |
1389 | 1390 | ||
1390 | mpt2sas_base_put_smid_default(ioc, smid); | 1391 | mpt2sas_base_put_smid_default(ioc, smid); |
1392 | init_completion(&ioc->ctl_cmds.done); | ||
1391 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, | 1393 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, |
1392 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); | 1394 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); |
1393 | 1395 | ||
@@ -1654,6 +1656,7 @@ _ctl_send_release(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type, u8 *issue_reset) | |||
1654 | mpi_request->VP_ID = 0; | 1656 | mpi_request->VP_ID = 0; |
1655 | 1657 | ||
1656 | mpt2sas_base_put_smid_default(ioc, smid); | 1658 | mpt2sas_base_put_smid_default(ioc, smid); |
1659 | init_completion(&ioc->ctl_cmds.done); | ||
1657 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, | 1660 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, |
1658 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); | 1661 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); |
1659 | 1662 | ||
@@ -1915,6 +1918,7 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state) | |||
1915 | mpi_request->VP_ID = 0; | 1918 | mpi_request->VP_ID = 0; |
1916 | 1919 | ||
1917 | mpt2sas_base_put_smid_default(ioc, smid); | 1920 | mpt2sas_base_put_smid_default(ioc, smid); |
1921 | init_completion(&ioc->ctl_cmds.done); | ||
1918 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, | 1922 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, |
1919 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); | 1923 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); |
1920 | 1924 | ||
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index 8bc57e315ce8..eb98188c7f3f 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c | |||
@@ -401,6 +401,7 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc, | |||
401 | "send to sas_addr(0x%016llx)\n", ioc->name, | 401 | "send to sas_addr(0x%016llx)\n", ioc->name, |
402 | (unsigned long long)sas_address)); | 402 | (unsigned long long)sas_address)); |
403 | mpt2sas_base_put_smid_default(ioc, smid); | 403 | mpt2sas_base_put_smid_default(ioc, smid); |
404 | init_completion(&ioc->transport_cmds.done); | ||
404 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, | 405 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, |
405 | 10*HZ); | 406 | 10*HZ); |
406 | 407 | ||
@@ -1154,6 +1155,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1154 | "sending smp request\n", ioc->name, __func__)); | 1155 | "sending smp request\n", ioc->name, __func__)); |
1155 | 1156 | ||
1156 | mpt2sas_base_put_smid_default(ioc, smid); | 1157 | mpt2sas_base_put_smid_default(ioc, smid); |
1158 | init_completion(&ioc->transport_cmds.done); | ||
1157 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, | 1159 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, |
1158 | 10*HZ); | 1160 | 10*HZ); |
1159 | 1161 | ||