Skip to content

Commit 6266f7d

Browse files
Merge branch '5.15/scsi-fixes' into 5.16/scsi-queue
The partial UFS revert in 5.15 is needed for some additional fixes in the 5.16 SCSI tree. Merge the fixes branch. Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 5ae1750 + 09d9e4d commit 6266f7d

File tree

17 files changed

+84
-336
lines changed

17 files changed

+84
-336
lines changed

drivers/scsi/hosts.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
220220
goto fail;
221221
}
222222

223-
shost->cmd_per_lun = min_t(short, shost->cmd_per_lun,
223+
/* Use min_t(int, ...) in case shost->can_queue exceeds SHRT_MAX */
224+
shost->cmd_per_lun = min_t(int, shost->cmd_per_lun,
224225
shost->can_queue);
225226

226227
error = scsi_init_sense_cache(shost);

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,7 @@ static int ibmvfc_send_event(struct ibmvfc_event *evt,
16961696

16971697
spin_lock_irqsave(&evt->queue->l_lock, flags);
16981698
list_add_tail(&evt->queue_list, &evt->queue->sent);
1699+
atomic_set(&evt->active, 1);
16991700

17001701
mb();
17011702

@@ -1710,6 +1711,7 @@ static int ibmvfc_send_event(struct ibmvfc_event *evt,
17101711
be64_to_cpu(crq_as_u64[1]));
17111712

17121713
if (rc) {
1714+
atomic_set(&evt->active, 0);
17131715
list_del(&evt->queue_list);
17141716
spin_unlock_irqrestore(&evt->queue->l_lock, flags);
17151717
del_timer(&evt->timer);
@@ -1737,7 +1739,6 @@ static int ibmvfc_send_event(struct ibmvfc_event *evt,
17371739

17381740
evt->done(evt);
17391741
} else {
1740-
atomic_set(&evt->active, 1);
17411742
spin_unlock_irqrestore(&evt->queue->l_lock, flags);
17421743
ibmvfc_trc_start(evt);
17431744
}

drivers/scsi/mpi3mr/mpi3mr_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3736,7 +3736,7 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
37363736
shost->max_lun = -1;
37373737
shost->unique_id = mrioc->id;
37383738

3739-
shost->max_channel = 1;
3739+
shost->max_channel = 0;
37403740
shost->max_id = 0xFFFFFFFF;
37413741

37423742
if (prot_mask >= 0)

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5065,9 +5065,12 @@ _scsih_setup_eedp(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
50655065
if (scmd->prot_flags & SCSI_PROT_GUARD_CHECK)
50665066
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
50675067

5068-
if (scmd->prot_flags & SCSI_PROT_REF_CHECK) {
5069-
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
5070-
MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG;
5068+
if (scmd->prot_flags & SCSI_PROT_REF_CHECK)
5069+
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG;
5070+
5071+
if (scmd->prot_flags & SCSI_PROT_REF_INCREMENT) {
5072+
eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG;
5073+
50715074
mpi_request->CDB.EEDP32.PrimaryReferenceTag =
50725075
cpu_to_be32(scsi_prot_ref_tag(scmd));
50735076
}

drivers/scsi/qla2xxx/qla_bsg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
431431
goto done_free_fcport;
432432

433433
done_free_fcport:
434-
if (bsg_request->msgcode == FC_BSG_RPT_ELS)
434+
if (bsg_request->msgcode != FC_BSG_RPT_ELS)
435435
qla2x00_free_fcport(fcport);
436436
done:
437437
return rval;

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4151,7 +4151,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
41514151
ql_dbg_pci(ql_dbg_init, ha->pdev,
41524152
0xe0ee, "%s: failed alloc dsd\n",
41534153
__func__);
4154-
return 1;
4154+
return -ENOMEM;
41554155
}
41564156
ha->dif_bundle_kallocs++;
41574157

drivers/scsi/qla2xxx/qla_target.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,8 +3320,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
33203320
"RESET-RSP online/active/old-count/new-count = %d/%d/%d/%d.\n",
33213321
vha->flags.online, qla2x00_reset_active(vha),
33223322
cmd->reset_count, qpair->chip_reset);
3323-
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3324-
return 0;
3323+
goto out_unmap_unlock;
33253324
}
33263325

33273326
/* Does F/W have an IOCBs for this request */
@@ -3446,10 +3445,6 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd)
34463445
prm.sg = NULL;
34473446
prm.req_cnt = 1;
34483447

3449-
/* Calculate number of entries and segments required */
3450-
if (qlt_pci_map_calc_cnt(&prm) != 0)
3451-
return -EAGAIN;
3452-
34533448
if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) ||
34543449
(cmd->sess && cmd->sess->deleted)) {
34553450
/*
@@ -3467,6 +3462,10 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd)
34673462
return 0;
34683463
}
34693464

3465+
/* Calculate number of entries and segments required */
3466+
if (qlt_pci_map_calc_cnt(&prm) != 0)
3467+
return -EAGAIN;
3468+
34703469
spin_lock_irqsave(qpair->qp_lock_ptr, flags);
34713470
/* Does F/W have an IOCBs for this request */
34723471
res = qlt_check_reserve_free_req(qpair, prm.req_cnt);
@@ -3871,9 +3870,6 @@ void qlt_free_cmd(struct qla_tgt_cmd *cmd)
38713870

38723871
BUG_ON(cmd->cmd_in_wq);
38733872

3874-
if (cmd->sg_mapped)
3875-
qlt_unmap_sg(cmd->vha, cmd);
3876-
38773873
if (!cmd->q_full)
38783874
qlt_decr_num_pend_cmds(cmd->vha);
38793875

drivers/scsi/scsi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,10 @@ EXPORT_SYMBOL(scsi_device_get);
545545
*/
546546
void scsi_device_put(struct scsi_device *sdev)
547547
{
548-
module_put(sdev->host->hostt->module);
548+
struct module *mod = sdev->host->hostt->module;
549+
549550
put_device(&sdev->sdev_gendev);
551+
module_put(mod);
550552
}
551553
EXPORT_SYMBOL(scsi_device_put);
552554

drivers/scsi/scsi_sysfs.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,12 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
444444
struct scsi_vpd *vpd_pg80 = NULL, *vpd_pg83 = NULL;
445445
struct scsi_vpd *vpd_pg0 = NULL, *vpd_pg89 = NULL;
446446
unsigned long flags;
447+
struct module *mod;
447448

448449
sdev = container_of(work, struct scsi_device, ew.work);
449450

451+
mod = sdev->host->hostt->module;
452+
450453
scsi_dh_release_device(sdev);
451454

452455
parent = sdev->sdev_gendev.parent;
@@ -497,11 +500,17 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
497500

498501
if (parent)
499502
put_device(parent);
503+
module_put(mod);
500504
}
501505

502506
static void scsi_device_dev_release(struct device *dev)
503507
{
504508
struct scsi_device *sdp = to_scsi_device(dev);
509+
510+
/* Set module pointer as NULL in case of module unloading */
511+
if (!try_module_get(sdp->host->hostt->module))
512+
sdp->host->hostt->module = NULL;
513+
505514
execute_in_process_context(scsi_device_dev_release_usercontext,
506515
&sdp->ew);
507516
}

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,8 +2930,6 @@ iscsi_set_param(struct iscsi_transport *transport, struct iscsi_uevent *ev)
29302930
session->recovery_tmo = value;
29312931
break;
29322932
default:
2933-
err = transport->set_param(conn, ev->u.set_param.param,
2934-
data, ev->u.set_param.len);
29352933
if ((conn->state == ISCSI_CONN_BOUND) ||
29362934
(conn->state == ISCSI_CONN_UP)) {
29372935
err = transport->set_param(conn, ev->u.set_param.param,

0 commit comments

Comments
 (0)