Skip to content

Commit 0917ac4

Browse files
James BottomleyJames Bottomley
authored andcommitted
Merge remote-tracking branch 'mkp-scsi/4.11/scsi-fixes' into fixes
2 parents ca4a213 + a3902ee commit 0917ac4

File tree

12 files changed

+57
-39
lines changed

12 files changed

+57
-39
lines changed

drivers/scsi/aacraid/commsup.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,6 @@ static int fillup_pools(struct aac_dev *dev, struct hw_fib **hw_fib_pool,
20562056
{
20572057
struct hw_fib **hw_fib_p;
20582058
struct fib **fib_p;
2059-
int rcode = 1;
20602059

20612060
hw_fib_p = hw_fib_pool;
20622061
fib_p = fib_pool;
@@ -2074,11 +2073,11 @@ static int fillup_pools(struct aac_dev *dev, struct hw_fib **hw_fib_pool,
20742073
}
20752074
}
20762075

2076+
/*
2077+
* Get the actual number of allocated fibs
2078+
*/
20772079
num = hw_fib_p - hw_fib_pool;
2078-
if (!num)
2079-
rcode = 0;
2080-
2081-
return rcode;
2080+
return num;
20822081
}
20832082

20842083
static void wakeup_fibctx_threads(struct aac_dev *dev,
@@ -2186,7 +2185,6 @@ static void aac_process_events(struct aac_dev *dev)
21862185
struct fib *fib;
21872186
unsigned long flags;
21882187
spinlock_t *t_lock;
2189-
unsigned int rcode;
21902188

21912189
t_lock = dev->queues->queue[HostNormCmdQueue].lock;
21922190
spin_lock_irqsave(t_lock, flags);
@@ -2269,8 +2267,8 @@ static void aac_process_events(struct aac_dev *dev)
22692267
* Fill up fib pointer pools with actual fibs
22702268
* and hw_fibs
22712269
*/
2272-
rcode = fillup_pools(dev, hw_fib_pool, fib_pool, num);
2273-
if (!rcode)
2270+
num = fillup_pools(dev, hw_fib_pool, fib_pool, num);
2271+
if (!num)
22742272
goto free_mem;
22752273

22762274
/*

drivers/scsi/device_handler/scsi_dh_alua.c

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct alua_queue_data {
113113
#define ALUA_POLICY_SWITCH_ALL 1
114114

115115
static void alua_rtpg_work(struct work_struct *work);
116-
static void alua_rtpg_queue(struct alua_port_group *pg,
116+
static bool alua_rtpg_queue(struct alua_port_group *pg,
117117
struct scsi_device *sdev,
118118
struct alua_queue_data *qdata, bool force);
119119
static void alua_check(struct scsi_device *sdev, bool force);
@@ -862,16 +862,22 @@ static void alua_rtpg_work(struct work_struct *work)
862862
kref_put(&pg->kref, release_port_group);
863863
}
864864

865-
static void alua_rtpg_queue(struct alua_port_group *pg,
865+
/**
866+
* alua_rtpg_queue() - cause RTPG to be submitted asynchronously
867+
*
868+
* Returns true if and only if alua_rtpg_work() will be called asynchronously.
869+
* That function is responsible for calling @qdata->fn().
870+
*/
871+
static bool alua_rtpg_queue(struct alua_port_group *pg,
866872
struct scsi_device *sdev,
867873
struct alua_queue_data *qdata, bool force)
868874
{
869875
int start_queue = 0;
870876
unsigned long flags;
871877
struct workqueue_struct *alua_wq = kaluad_wq;
872878

873-
if (!pg)
874-
return;
879+
if (WARN_ON_ONCE(!pg) || scsi_device_get(sdev))
880+
return false;
875881

876882
spin_lock_irqsave(&pg->lock, flags);
877883
if (qdata) {
@@ -884,14 +890,12 @@ static void alua_rtpg_queue(struct alua_port_group *pg,
884890
pg->flags |= ALUA_PG_RUN_RTPG;
885891
kref_get(&pg->kref);
886892
pg->rtpg_sdev = sdev;
887-
scsi_device_get(sdev);
888893
start_queue = 1;
889894
} else if (!(pg->flags & ALUA_PG_RUN_RTPG) && force) {
890895
pg->flags |= ALUA_PG_RUN_RTPG;
891896
/* Do not queue if the worker is already running */
892897
if (!(pg->flags & ALUA_PG_RUNNING)) {
893898
kref_get(&pg->kref);
894-
sdev = NULL;
895899
start_queue = 1;
896900
}
897901
}
@@ -900,13 +904,17 @@ static void alua_rtpg_queue(struct alua_port_group *pg,
900904
alua_wq = kaluad_sync_wq;
901905
spin_unlock_irqrestore(&pg->lock, flags);
902906

903-
if (start_queue &&
904-
!queue_delayed_work(alua_wq, &pg->rtpg_work,
905-
msecs_to_jiffies(ALUA_RTPG_DELAY_MSECS))) {
906-
if (sdev)
907-
scsi_device_put(sdev);
908-
kref_put(&pg->kref, release_port_group);
907+
if (start_queue) {
908+
if (queue_delayed_work(alua_wq, &pg->rtpg_work,
909+
msecs_to_jiffies(ALUA_RTPG_DELAY_MSECS)))
910+
sdev = NULL;
911+
else
912+
kref_put(&pg->kref, release_port_group);
909913
}
914+
if (sdev)
915+
scsi_device_put(sdev);
916+
917+
return true;
910918
}
911919

912920
/*
@@ -1007,11 +1015,13 @@ static int alua_activate(struct scsi_device *sdev,
10071015
mutex_unlock(&h->init_mutex);
10081016
goto out;
10091017
}
1010-
fn = NULL;
10111018
rcu_read_unlock();
10121019
mutex_unlock(&h->init_mutex);
10131020

1014-
alua_rtpg_queue(pg, sdev, qdata, true);
1021+
if (alua_rtpg_queue(pg, sdev, qdata, true))
1022+
fn = NULL;
1023+
else
1024+
err = SCSI_DH_DEV_OFFLINED;
10151025
kref_put(&pg->kref, release_port_group);
10161026
out:
10171027
if (fn)

drivers/scsi/hpsa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3885,6 +3885,7 @@ static int hpsa_update_device_info(struct ctlr_info *h,
38853885
if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
38863886
hpsa_get_ioaccel_status(h, scsi3addr, this_device);
38873887
volume_offline = hpsa_volume_offline(h, scsi3addr);
3888+
this_device->volume_offline = volume_offline;
38883889
if (volume_offline == HPSA_LV_FAILED) {
38893890
rc = HPSA_LV_FAILED;
38903891
dev_err(&h->pdev->dev,

drivers/scsi/libsas/sas_ata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
221221
task->num_scatter = qc->n_elem;
222222
} else {
223223
for_each_sg(qc->sg, sg, qc->n_elem, si)
224-
xfer += sg->length;
224+
xfer += sg_dma_len(sg);
225225

226226
task->total_xfer_len = xfer;
227227
task->num_scatter = si;

drivers/scsi/lpfc/lpfc_debugfs.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@
4444
/* hbqinfo output buffer size */
4545
#define LPFC_HBQINFO_SIZE 8192
4646

47-
enum {
48-
DUMP_FCP,
49-
DUMP_NVME,
50-
DUMP_MBX,
51-
DUMP_ELS,
52-
DUMP_NVMELS,
53-
};
54-
5547
/* nvmestat output buffer size */
5648
#define LPFC_NVMESTAT_SIZE 8192
5749
#define LPFC_NVMEKTIME_SIZE 8192
@@ -283,8 +275,22 @@ struct lpfc_idiag {
283275
struct lpfc_idiag_offset offset;
284276
void *ptr_private;
285277
};
278+
279+
#else
280+
281+
#define lpfc_nvmeio_data(phba, fmt, arg...) \
282+
no_printk(fmt, ##arg)
283+
286284
#endif
287285

286+
enum {
287+
DUMP_FCP,
288+
DUMP_NVME,
289+
DUMP_MBX,
290+
DUMP_ELS,
291+
DUMP_NVMELS,
292+
};
293+
288294
/* Mask for discovery_trace */
289295
#define LPFC_DISC_TRC_ELS_CMD 0x1 /* Trace ELS commands */
290296
#define LPFC_DISC_TRC_ELS_RSP 0x2 /* Trace ELS response */

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7968,7 +7968,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
79687968
did, vport->port_state, ndlp->nlp_flag);
79697969

79707970
phba->fc_stat.elsRcvPRLI++;
7971-
if (vport->port_state < LPFC_DISC_AUTH) {
7971+
if ((vport->port_state < LPFC_DISC_AUTH) &&
7972+
(vport->fc_flag & FC_FABRIC)) {
79727973
rjt_err = LSRJT_UNABLE_TPC;
79737974
rjt_exp = LSEXP_NOTHING_MORE;
79747975
break;

drivers/scsi/lpfc/lpfc_nvmet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport,
520520
struct lpfc_hba *phba = ctxp->phba;
521521
struct lpfc_iocbq *nvmewqeq;
522522
unsigned long iflags;
523-
int rc, id;
523+
int rc;
524524

525525
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
526526
if (phba->ktime_on) {
@@ -530,7 +530,7 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport,
530530
ctxp->ts_nvme_data = ktime_get_ns();
531531
}
532532
if (phba->cpucheck_on & LPFC_CHECK_NVMET_IO) {
533-
id = smp_processor_id();
533+
int id = smp_processor_id();
534534
ctxp->cpu = id;
535535
if (id < LPFC_CHECK_CPU_CNT)
536536
phba->cpucheck_xmt_io[id]++;

drivers/scsi/qedi/qedi_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,6 +2007,7 @@ static void qedi_remove(struct pci_dev *pdev)
20072007

20082008
static struct pci_device_id qedi_pci_tbl[] = {
20092009
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, 0x165E) },
2010+
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, 0x8084) },
20102011
{ 0 },
20112012
};
20122013
MODULE_DEVICE_TABLE(pci, qedi_pci_tbl);

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
16511651
/* Don't abort commands in adapter during EEH
16521652
* recovery as it's not accessible/responding.
16531653
*/
1654-
if (GET_CMD_SP(sp) && !ha->flags.eeh_busy) {
1654+
if (GET_CMD_SP(sp) && !ha->flags.eeh_busy &&
1655+
(sp->type == SRB_SCSI_CMD)) {
16551656
/* Get a reference to the sp and drop the lock.
16561657
* The reference ensures this sp->done() call
16571658
* - and not the call in qla2xxx_eh_abort() -

drivers/scsi/sg.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,8 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
996996
result = get_user(val, ip);
997997
if (result)
998998
return result;
999+
if (val > SG_MAX_CDB_SIZE)
1000+
return -ENOMEM;
9991001
sfp->next_cmd_len = (val > 0) ? val : 0;
10001002
return 0;
10011003
case SG_GET_VERSION_NUM:

0 commit comments

Comments
 (0)