Skip to content

Commit be75b1b

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "This is mostly fixes for driver specific issues (nine of them) and the storvsc performance improvement with interrupt handling which was dropped from the previous fixes pull request. We also have two regressions: one is a double call_rcu() in ATA error handling and the other is a missed conversion to BLK_STS_OK in __scsi_error_from_host_byte()" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: qedi: Fix kernel crash during port toggle scsi: qla2xxx: Fix FC-NVMe LUN discovery scsi: core: return BLK_STS_OK for DID_OK in __scsi_error_from_host_byte() scsi: core: Avoid that ATA error handling can trigger a kernel hang or oops scsi: qla2xxx: ensure async flags are reset correctly scsi: qla2xxx: do not check login_state if no loop id is assigned scsi: qla2xxx: Fixup locking for session deletion scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS scsi: mpt3sas: wait for and flush running commands on shutdown/unload scsi: mpt3sas: fix oops in error handlers after shutdown/unload scsi: storvsc: Spread interrupts when picking a channel for I/O requests scsi: megaraid_sas: Do not use 32-bit atomic request descriptor for Ventura controllers
2 parents 86f8477 + 967823d commit be75b1b

File tree

16 files changed

+115
-76
lines changed

16 files changed

+115
-76
lines changed

drivers/scsi/hosts.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,6 @@ static void scsi_host_dev_release(struct device *dev)
328328
if (shost->work_q)
329329
destroy_workqueue(shost->work_q);
330330

331-
destroy_rcu_head(&shost->rcu);
332-
333331
if (shost->shost_state == SHOST_CREATED) {
334332
/*
335333
* Free the shost_dev device name here if scsi_host_alloc()
@@ -404,7 +402,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
404402
INIT_LIST_HEAD(&shost->starved_list);
405403
init_waitqueue_head(&shost->host_wait);
406404
mutex_init(&shost->scan_mutex);
407-
init_rcu_head(&shost->rcu);
408405

409406
index = ida_simple_get(&host_index_ida, 0, 0, GFP_KERNEL);
410407
if (index < 0)

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -216,36 +216,30 @@ inline void megasas_return_cmd_fusion(struct megasas_instance *instance,
216216
/**
217217
* megasas_fire_cmd_fusion - Sends command to the FW
218218
* @instance: Adapter soft state
219-
* @req_desc: 32bit or 64bit Request descriptor
219+
* @req_desc: 64bit Request descriptor
220220
*
221-
* Perform PCI Write. Ventura supports 32 bit Descriptor.
222-
* Prior to Ventura (12G) MR controller supports 64 bit Descriptor.
221+
* Perform PCI Write.
223222
*/
224223

225224
static void
226225
megasas_fire_cmd_fusion(struct megasas_instance *instance,
227226
union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc)
228227
{
229-
if (instance->adapter_type == VENTURA_SERIES)
230-
writel(le32_to_cpu(req_desc->u.low),
231-
&instance->reg_set->inbound_single_queue_port);
232-
else {
233228
#if defined(writeq) && defined(CONFIG_64BIT)
234-
u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) |
235-
le32_to_cpu(req_desc->u.low));
229+
u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) |
230+
le32_to_cpu(req_desc->u.low));
236231

237-
writeq(req_data, &instance->reg_set->inbound_low_queue_port);
232+
writeq(req_data, &instance->reg_set->inbound_low_queue_port);
238233
#else
239-
unsigned long flags;
240-
spin_lock_irqsave(&instance->hba_lock, flags);
241-
writel(le32_to_cpu(req_desc->u.low),
242-
&instance->reg_set->inbound_low_queue_port);
243-
writel(le32_to_cpu(req_desc->u.high),
244-
&instance->reg_set->inbound_high_queue_port);
245-
mmiowb();
246-
spin_unlock_irqrestore(&instance->hba_lock, flags);
234+
unsigned long flags;
235+
spin_lock_irqsave(&instance->hba_lock, flags);
236+
writel(le32_to_cpu(req_desc->u.low),
237+
&instance->reg_set->inbound_low_queue_port);
238+
writel(le32_to_cpu(req_desc->u.high),
239+
&instance->reg_set->inbound_high_queue_port);
240+
mmiowb();
241+
spin_unlock_irqrestore(&instance->hba_lock, flags);
247242
#endif
248-
}
249243
}
250244

251245
/**
@@ -982,7 +976,6 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
982976
const char *sys_info;
983977
MFI_CAPABILITIES *drv_ops;
984978
u32 scratch_pad_2;
985-
unsigned long flags;
986979
ktime_t time;
987980
bool cur_fw_64bit_dma_capable;
988981

@@ -1121,14 +1114,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
11211114
break;
11221115
}
11231116

1124-
/* For Ventura also IOC INIT required 64 bit Descriptor write. */
1125-
spin_lock_irqsave(&instance->hba_lock, flags);
1126-
writel(le32_to_cpu(req_desc.u.low),
1127-
&instance->reg_set->inbound_low_queue_port);
1128-
writel(le32_to_cpu(req_desc.u.high),
1129-
&instance->reg_set->inbound_high_queue_port);
1130-
mmiowb();
1131-
spin_unlock_irqrestore(&instance->hba_lock, flags);
1117+
megasas_fire_cmd_fusion(instance, &req_desc);
11321118

11331119
wait_and_poll(instance, cmd, MFI_POLL_TIMEOUT_SECS);
11341120

drivers/scsi/mpt3sas/mpt3sas_base.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6297,14 +6297,14 @@ _base_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase)
62976297
}
62986298

62996299
/**
6300-
* _wait_for_commands_to_complete - reset controller
6300+
* mpt3sas_wait_for_commands_to_complete - reset controller
63016301
* @ioc: Pointer to MPT_ADAPTER structure
63026302
*
63036303
* This function is waiting 10s for all pending commands to complete
63046304
* prior to putting controller in reset.
63056305
*/
6306-
static void
6307-
_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc)
6306+
void
6307+
mpt3sas_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc)
63086308
{
63096309
u32 ioc_state;
63106310

@@ -6377,7 +6377,7 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc,
63776377
is_fault = 1;
63786378
}
63796379
_base_reset_handler(ioc, MPT3_IOC_PRE_RESET);
6380-
_wait_for_commands_to_complete(ioc);
6380+
mpt3sas_wait_for_commands_to_complete(ioc);
63816381
_base_mask_interrupts(ioc);
63826382
r = _base_make_ioc_ready(ioc, type);
63836383
if (r)

drivers/scsi/mpt3sas/mpt3sas_base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,9 @@ void mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc,
14331433

14341434
int mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc);
14351435

1436+
void
1437+
mpt3sas_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc);
1438+
14361439

14371440
/* scsih shared API */
14381441
struct scsi_cmnd *mpt3sas_scsih_scsi_lookup_get(struct MPT3SAS_ADAPTER *ioc,

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,7 +2835,8 @@ scsih_abort(struct scsi_cmnd *scmd)
28352835
_scsih_tm_display_info(ioc, scmd);
28362836

28372837
sas_device_priv_data = scmd->device->hostdata;
2838-
if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
2838+
if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
2839+
ioc->remove_host) {
28392840
sdev_printk(KERN_INFO, scmd->device,
28402841
"device been deleted! scmd(%p)\n", scmd);
28412842
scmd->result = DID_NO_CONNECT << 16;
@@ -2898,7 +2899,8 @@ scsih_dev_reset(struct scsi_cmnd *scmd)
28982899
_scsih_tm_display_info(ioc, scmd);
28992900

29002901
sas_device_priv_data = scmd->device->hostdata;
2901-
if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
2902+
if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
2903+
ioc->remove_host) {
29022904
sdev_printk(KERN_INFO, scmd->device,
29032905
"device been deleted! scmd(%p)\n", scmd);
29042906
scmd->result = DID_NO_CONNECT << 16;
@@ -2961,7 +2963,8 @@ scsih_target_reset(struct scsi_cmnd *scmd)
29612963
_scsih_tm_display_info(ioc, scmd);
29622964

29632965
sas_device_priv_data = scmd->device->hostdata;
2964-
if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
2966+
if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
2967+
ioc->remove_host) {
29652968
starget_printk(KERN_INFO, starget, "target been deleted! scmd(%p)\n",
29662969
scmd);
29672970
scmd->result = DID_NO_CONNECT << 16;
@@ -3019,7 +3022,7 @@ scsih_host_reset(struct scsi_cmnd *scmd)
30193022
ioc->name, scmd);
30203023
scsi_print_command(scmd);
30213024

3022-
if (ioc->is_driver_loading) {
3025+
if (ioc->is_driver_loading || ioc->remove_host) {
30233026
pr_info(MPT3SAS_FMT "Blocking the host reset\n",
30243027
ioc->name);
30253028
r = FAILED;
@@ -4453,7 +4456,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc)
44534456
st = scsi_cmd_priv(scmd);
44544457
mpt3sas_base_clear_st(ioc, st);
44554458
scsi_dma_unmap(scmd);
4456-
if (ioc->pci_error_recovery)
4459+
if (ioc->pci_error_recovery || ioc->remove_host)
44574460
scmd->result = DID_NO_CONNECT << 16;
44584461
else
44594462
scmd->result = DID_RESET << 16;
@@ -9739,6 +9742,10 @@ static void scsih_remove(struct pci_dev *pdev)
97399742
unsigned long flags;
97409743

97419744
ioc->remove_host = 1;
9745+
9746+
mpt3sas_wait_for_commands_to_complete(ioc);
9747+
_scsih_flush_running_cmds(ioc);
9748+
97429749
_scsih_fw_event_cleanup_queue(ioc);
97439750

97449751
spin_lock_irqsave(&ioc->fw_event_lock, flags);
@@ -9815,6 +9822,10 @@ scsih_shutdown(struct pci_dev *pdev)
98159822
unsigned long flags;
98169823

98179824
ioc->remove_host = 1;
9825+
9826+
mpt3sas_wait_for_commands_to_complete(ioc);
9827+
_scsih_flush_running_cmds(ioc);
9828+
98189829
_scsih_fw_event_cleanup_queue(ioc);
98199830

98209831
spin_lock_irqsave(&ioc->fw_event_lock, flags);

drivers/scsi/qedi/qedi_fw.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi,
762762

763763
iscsi_cid = cqe->conn_id;
764764
qedi_conn = qedi->cid_que.conn_cid_tbl[iscsi_cid];
765+
if (!qedi_conn) {
766+
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
767+
"icid not found 0x%x\n", cqe->conn_id);
768+
return;
769+
}
765770

766771
/* Based on this itt get the corresponding qedi_cmd */
767772
spin_lock_bh(&qedi_conn->tmf_work_lock);

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@
261261
struct name_list_extended {
262262
struct get_name_list_extended *l;
263263
dma_addr_t ldma;
264-
struct list_head fcports; /* protect by sess_list */
264+
struct list_head fcports;
265+
spinlock_t fcports_lock;
265266
u32 size;
266-
u8 sent;
267267
};
268268
/*
269269
* Timeout timer counts in seconds
@@ -2217,6 +2217,7 @@ typedef struct {
22172217

22182218
/* FCP-4 types */
22192219
#define FC4_TYPE_FCP_SCSI 0x08
2220+
#define FC4_TYPE_NVME 0x28
22202221
#define FC4_TYPE_OTHER 0x0
22212222
#define FC4_TYPE_UNKNOWN 0xff
22222223

drivers/scsi/qla2xxx/qla_gs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,6 +3179,7 @@ int qla24xx_async_gidpn(scsi_qla_host_t *vha, fc_port_t *fcport)
31793179
sp->free(sp);
31803180
fcport->flags &= ~FCF_ASYNC_SENT;
31813181
done:
3182+
fcport->flags &= ~FCF_ASYNC_ACTIVE;
31823183
return rval;
31833184
}
31843185

@@ -3370,6 +3371,7 @@ int qla24xx_async_gpsc(scsi_qla_host_t *vha, fc_port_t *fcport)
33703371
sp->free(sp);
33713372
fcport->flags &= ~FCF_ASYNC_SENT;
33723373
done:
3374+
fcport->flags &= ~FCF_ASYNC_ACTIVE;
33733375
return rval;
33743376
}
33753377

@@ -3971,6 +3973,9 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
39713973
spin_lock_irqsave(&vha->work_lock, flags);
39723974
vha->scan.scan_flags &= ~SF_SCANNING;
39733975
spin_unlock_irqrestore(&vha->work_lock, flags);
3976+
3977+
if ((fc4type == FC4_TYPE_FCP_SCSI) && vha->flags.nvme_enabled)
3978+
qla24xx_async_gpnft(vha, FC4_TYPE_NVME);
39743979
}
39753980

39763981
static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res)

0 commit comments

Comments
 (0)