aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-11-13 13:07:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-11-13 13:07:08 -0500
commit980221d14c4eedbfc24a0f2234475850438a4411 (patch)
tree33339c1b2e05d1a303de1cfe171616c21278f6cd
parentd41bd8f335c7d87016db30836e4b74cbed501775 (diff)
parent8a57646d28540b2a536f168df63b1b043b1d3386 (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "The megaraid_sas patch in here fixes a major regression in the last fix set that made all megaraid_sas cards unusable. It turns out no-one had actually tested such an "obvious" fix, sigh. The fix for the fix has been tested ... The next most serious is the vmw_pvscsi abort problem which basically means that aborts don't work on the vmware paravirt devices and error handling always escalates to reset. The rest are an assortment of missed reference counting in certain paths and corner case bugs that show up on some architectures" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression scsi: qla2xxx: fix invalid DMA access after command aborts in PCI device remove scsi: qla2xxx: do not queue commands when unloading scsi: libcxgbi: fix incorrect DDP resource cleanup scsi: qla2xxx: Fix scsi scan hang triggered if adapter fails during init scsi: scsi_dh_alua: Fix a reference counting bug scsi: vmw_pvscsi: return SUCCESS for successful command aborts scsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk scsi: scsi_dh_alua: fix missing kref_put() in alua_rtpg_work()
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c3
-rw-r--r--drivers/scsi/device_handler/scsi_dh_alua.c5
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h2
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c16
-rw-r--r--drivers/scsi/vmw_pvscsi.c5
-rw-r--r--drivers/scsi/vmw_pvscsi.h2
7 files changed, 29 insertions, 8 deletions
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index d1421139e6ea..2ffe029ff2b6 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -2081,9 +2081,10 @@ void cxgbi_cleanup_task(struct iscsi_task *task)
2081 /* never reached the xmit task callout */ 2081 /* never reached the xmit task callout */
2082 if (tdata->skb) 2082 if (tdata->skb)
2083 __kfree_skb(tdata->skb); 2083 __kfree_skb(tdata->skb);
2084 memset(tdata, 0, sizeof(*tdata));
2085 2084
2086 task_release_itt(task, task->hdr_itt); 2085 task_release_itt(task, task->hdr_itt);
2086 memset(tdata, 0, sizeof(*tdata));
2087
2087 iscsi_tcp_cleanup_task(task); 2088 iscsi_tcp_cleanup_task(task);
2088} 2089}
2089EXPORT_SYMBOL_GPL(cxgbi_cleanup_task); 2090EXPORT_SYMBOL_GPL(cxgbi_cleanup_task);
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 241829e59668..7bb20684e9fa 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -793,6 +793,7 @@ static void alua_rtpg_work(struct work_struct *work)
793 WARN_ON(pg->flags & ALUA_PG_RUN_RTPG); 793 WARN_ON(pg->flags & ALUA_PG_RUN_RTPG);
794 WARN_ON(pg->flags & ALUA_PG_RUN_STPG); 794 WARN_ON(pg->flags & ALUA_PG_RUN_STPG);
795 spin_unlock_irqrestore(&pg->lock, flags); 795 spin_unlock_irqrestore(&pg->lock, flags);
796 kref_put(&pg->kref, release_port_group);
796 return; 797 return;
797 } 798 }
798 if (pg->flags & ALUA_SYNC_STPG) 799 if (pg->flags & ALUA_SYNC_STPG)
@@ -890,6 +891,7 @@ static void alua_rtpg_queue(struct alua_port_group *pg,
890 /* Do not queue if the worker is already running */ 891 /* Do not queue if the worker is already running */
891 if (!(pg->flags & ALUA_PG_RUNNING)) { 892 if (!(pg->flags & ALUA_PG_RUNNING)) {
892 kref_get(&pg->kref); 893 kref_get(&pg->kref);
894 sdev = NULL;
893 start_queue = 1; 895 start_queue = 1;
894 } 896 }
895 } 897 }
@@ -901,7 +903,8 @@ static void alua_rtpg_queue(struct alua_port_group *pg,
901 if (start_queue && 903 if (start_queue &&
902 !queue_delayed_work(alua_wq, &pg->rtpg_work, 904 !queue_delayed_work(alua_wq, &pg->rtpg_work,
903 msecs_to_jiffies(ALUA_RTPG_DELAY_MSECS))) { 905 msecs_to_jiffies(ALUA_RTPG_DELAY_MSECS))) {
904 scsi_device_put(sdev); 906 if (sdev)
907 scsi_device_put(sdev);
905 kref_put(&pg->kref, release_port_group); 908 kref_put(&pg->kref, release_port_group);
906 } 909 }
907} 910}
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index ca86c885dfaa..3aaea713bf37 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -2233,7 +2233,7 @@ struct megasas_instance_template {
2233}; 2233};
2234 2234
2235#define MEGASAS_IS_LOGICAL(scp) \ 2235#define MEGASAS_IS_LOGICAL(scp) \
2236 (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 2236 ((scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1)
2237 2237
2238#define MEGASAS_DEV_INDEX(scp) \ 2238#define MEGASAS_DEV_INDEX(scp) \
2239 (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ 2239 (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 209a969a979d..8aa769a2d919 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -1273,9 +1273,9 @@ scsih_target_alloc(struct scsi_target *starget)
1273 sas_target_priv_data->handle = raid_device->handle; 1273 sas_target_priv_data->handle = raid_device->handle;
1274 sas_target_priv_data->sas_address = raid_device->wwid; 1274 sas_target_priv_data->sas_address = raid_device->wwid;
1275 sas_target_priv_data->flags |= MPT_TARGET_FLAGS_VOLUME; 1275 sas_target_priv_data->flags |= MPT_TARGET_FLAGS_VOLUME;
1276 sas_target_priv_data->raid_device = raid_device;
1277 if (ioc->is_warpdrive) 1276 if (ioc->is_warpdrive)
1278 raid_device->starget = starget; 1277 sas_target_priv_data->raid_device = raid_device;
1278 raid_device->starget = starget;
1279 } 1279 }
1280 spin_unlock_irqrestore(&ioc->raid_device_lock, flags); 1280 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
1281 return 0; 1281 return 0;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index ace65db1d2a2..567fa080e261 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -707,6 +707,11 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
707 srb_t *sp; 707 srb_t *sp;
708 int rval; 708 int rval;
709 709
710 if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) {
711 cmd->result = DID_NO_CONNECT << 16;
712 goto qc24_fail_command;
713 }
714
710 if (ha->flags.eeh_busy) { 715 if (ha->flags.eeh_busy) {
711 if (ha->flags.pci_channel_io_perm_failure) { 716 if (ha->flags.pci_channel_io_perm_failure) {
712 ql_dbg(ql_dbg_aer, vha, 0x9010, 717 ql_dbg(ql_dbg_aer, vha, 0x9010,
@@ -1451,6 +1456,15 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
1451 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { 1456 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
1452 sp = req->outstanding_cmds[cnt]; 1457 sp = req->outstanding_cmds[cnt];
1453 if (sp) { 1458 if (sp) {
1459 /* Get a reference to the sp and drop the lock.
1460 * The reference ensures this sp->done() call
1461 * - and not the call in qla2xxx_eh_abort() -
1462 * ends the SCSI command (with result 'res').
1463 */
1464 sp_get(sp);
1465 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1466 qla2xxx_eh_abort(GET_CMD_SP(sp));
1467 spin_lock_irqsave(&ha->hardware_lock, flags);
1454 req->outstanding_cmds[cnt] = NULL; 1468 req->outstanding_cmds[cnt] = NULL;
1455 sp->done(vha, sp, res); 1469 sp->done(vha, sp, res);
1456 } 1470 }
@@ -2341,6 +2355,8 @@ qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time)
2341{ 2355{
2342 scsi_qla_host_t *vha = shost_priv(shost); 2356 scsi_qla_host_t *vha = shost_priv(shost);
2343 2357
2358 if (test_bit(UNLOADING, &vha->dpc_flags))
2359 return 1;
2344 if (!vha->host) 2360 if (!vha->host)
2345 return 1; 2361 return 1;
2346 if (time > vha->hw->loop_reset_delay * HZ) 2362 if (time > vha->hw->loop_reset_delay * HZ)
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index 4a0d3cdc607c..15ca09cd16f3 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -793,6 +793,7 @@ static int pvscsi_abort(struct scsi_cmnd *cmd)
793 unsigned long flags; 793 unsigned long flags;
794 int result = SUCCESS; 794 int result = SUCCESS;
795 DECLARE_COMPLETION_ONSTACK(abort_cmp); 795 DECLARE_COMPLETION_ONSTACK(abort_cmp);
796 int done;
796 797
797 scmd_printk(KERN_DEBUG, cmd, "task abort on host %u, %p\n", 798 scmd_printk(KERN_DEBUG, cmd, "task abort on host %u, %p\n",
798 adapter->host->host_no, cmd); 799 adapter->host->host_no, cmd);
@@ -824,10 +825,10 @@ static int pvscsi_abort(struct scsi_cmnd *cmd)
824 pvscsi_abort_cmd(adapter, ctx); 825 pvscsi_abort_cmd(adapter, ctx);
825 spin_unlock_irqrestore(&adapter->hw_lock, flags); 826 spin_unlock_irqrestore(&adapter->hw_lock, flags);
826 /* Wait for 2 secs for the completion. */ 827 /* Wait for 2 secs for the completion. */
827 wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000)); 828 done = wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000));
828 spin_lock_irqsave(&adapter->hw_lock, flags); 829 spin_lock_irqsave(&adapter->hw_lock, flags);
829 830
830 if (!completion_done(&abort_cmp)) { 831 if (!done) {
831 /* 832 /*
832 * Failed to abort the command, unmark the fact that it 833 * Failed to abort the command, unmark the fact that it
833 * was requested to be aborted. 834 * was requested to be aborted.
diff --git a/drivers/scsi/vmw_pvscsi.h b/drivers/scsi/vmw_pvscsi.h
index c097d2ccbde3..d41292ef85f2 100644
--- a/drivers/scsi/vmw_pvscsi.h
+++ b/drivers/scsi/vmw_pvscsi.h
@@ -26,7 +26,7 @@
26 26
27#include <linux/types.h> 27#include <linux/types.h>
28 28
29#define PVSCSI_DRIVER_VERSION_STRING "1.0.6.0-k" 29#define PVSCSI_DRIVER_VERSION_STRING "1.0.7.0-k"
30 30
31#define PVSCSI_MAX_NUM_SG_ENTRIES_PER_SEGMENT 128 31#define PVSCSI_MAX_NUM_SG_ENTRIES_PER_SEGMENT 128
32 32