diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2009-08-20 03:52:00 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-05 10:34:49 -0400 |
commit | 155dd4c763694222c125e65438d823f58ea653bc (patch) | |
tree | 0db7b5b8d41c165222357ac8dee45482f1425faa /drivers/scsi/mpt2sas/mpt2sas_ctl.c | |
parent | cd4e12e8ad246ec5bc23ab04d0da0e6985025620 (diff) |
[SCSI] mpt2sas: Prevent sending command to FW while Host Reset
This patch renames the flag for indicating host reset from
ioc_reset_in_progress to shost_recovery. It also removes the spin locks
surrounding the setting of this flag, which are unnecessary. Sanity checks on
the shost_recovery flag were added thru out the code so as to prevent sending
firmware commands during host reset. Also, the setting of the shost state to
SHOST_RECOVERY was removed to prevent deadlocks, this is actually better
handled by the shost_recovery flag.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <Eric.moore@lsi.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_ctl.c')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_ctl.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index 14e473d1fa7b..c2a51018910f 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c | |||
@@ -1963,7 +1963,6 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg) | |||
1963 | { | 1963 | { |
1964 | enum block_state state; | 1964 | enum block_state state; |
1965 | long ret = -EINVAL; | 1965 | long ret = -EINVAL; |
1966 | unsigned long flags; | ||
1967 | 1966 | ||
1968 | state = (file->f_flags & O_NONBLOCK) ? NON_BLOCKING : | 1967 | state = (file->f_flags & O_NONBLOCK) ? NON_BLOCKING : |
1969 | BLOCKING; | 1968 | BLOCKING; |
@@ -1989,13 +1988,8 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg) | |||
1989 | !ioc) | 1988 | !ioc) |
1990 | return -ENODEV; | 1989 | return -ENODEV; |
1991 | 1990 | ||
1992 | spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); | 1991 | if (ioc->shost_recovery) |
1993 | if (ioc->shost_recovery) { | ||
1994 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, | ||
1995 | flags); | ||
1996 | return -EAGAIN; | 1992 | return -EAGAIN; |
1997 | } | ||
1998 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); | ||
1999 | 1993 | ||
2000 | if (_IOC_SIZE(cmd) == sizeof(struct mpt2_ioctl_command)) { | 1994 | if (_IOC_SIZE(cmd) == sizeof(struct mpt2_ioctl_command)) { |
2001 | uarg = arg; | 1995 | uarg = arg; |
@@ -2098,7 +2092,6 @@ _ctl_compat_mpt_command(struct file *file, unsigned cmd, unsigned long arg) | |||
2098 | struct mpt2_ioctl_command karg; | 2092 | struct mpt2_ioctl_command karg; |
2099 | struct MPT2SAS_ADAPTER *ioc; | 2093 | struct MPT2SAS_ADAPTER *ioc; |
2100 | enum block_state state; | 2094 | enum block_state state; |
2101 | unsigned long flags; | ||
2102 | 2095 | ||
2103 | if (_IOC_SIZE(cmd) != sizeof(struct mpt2_ioctl_command32)) | 2096 | if (_IOC_SIZE(cmd) != sizeof(struct mpt2_ioctl_command32)) |
2104 | return -EINVAL; | 2097 | return -EINVAL; |
@@ -2113,13 +2106,8 @@ _ctl_compat_mpt_command(struct file *file, unsigned cmd, unsigned long arg) | |||
2113 | if (_ctl_verify_adapter(karg32.hdr.ioc_number, &ioc) == -1 || !ioc) | 2106 | if (_ctl_verify_adapter(karg32.hdr.ioc_number, &ioc) == -1 || !ioc) |
2114 | return -ENODEV; | 2107 | return -ENODEV; |
2115 | 2108 | ||
2116 | spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); | 2109 | if (ioc->shost_recovery) |
2117 | if (ioc->shost_recovery) { | ||
2118 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, | ||
2119 | flags); | ||
2120 | return -EAGAIN; | 2110 | return -EAGAIN; |
2121 | } | ||
2122 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); | ||
2123 | 2111 | ||
2124 | memset(&karg, 0, sizeof(struct mpt2_ioctl_command)); | 2112 | memset(&karg, 0, sizeof(struct mpt2_ioctl_command)); |
2125 | karg.hdr.ioc_number = karg32.hdr.ioc_number; | 2113 | karg.hdr.ioc_number = karg32.hdr.ioc_number; |