Skip to content

Commit fed14f5

Browse files
committed
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
2 parents d1db888 + a75a16c commit fed14f5

File tree

10 files changed

+48
-45
lines changed

10 files changed

+48
-45
lines changed

drivers/message/fusion/mptfc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ mptfc_bus_reset(struct scsi_cmnd *SCpnt)
265265
MPT_SCSI_HOST __maybe_unused *hd = shost_priv(shost);
266266
int channel = SCpnt->device->channel;
267267
struct mptfc_rport_info *ri;
268-
int rtn;
268+
int rtn = FAILED;
269269

270270
list_for_each_entry(ri, &hd->ioc->fc_rports, list) {
271271
if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) {

drivers/scsi/aic7xxx/aic79xx_osm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,8 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
18341834
} else {
18351835
ahd_set_transaction_status(scb, CAM_REQ_CMP);
18361836
}
1837-
} else if (ahd_get_transaction_status(scb) == CAM_SCSI_STATUS_ERROR) {
1837+
} else if (cmd &&
1838+
ahd_get_transaction_status(scb) == CAM_SCSI_STATUS_ERROR) {
18381839
ahd_linux_handle_scsi_status(ahd, cmd->device, scb);
18391840
}
18401841

@@ -1868,7 +1869,8 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
18681869
}
18691870

18701871
ahd_free_scb(ahd, scb);
1871-
ahd_linux_queue_cmd_complete(ahd, cmd);
1872+
if (cmd)
1873+
ahd_linux_queue_cmd_complete(ahd, cmd);
18721874
}
18731875

18741876
static void

drivers/scsi/megaraid.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,10 +1925,13 @@ megaraid_abort_and_reset(adapter_t *adapter, struct scsi_cmnd *cmd, int aor)
19251925
struct list_head *pos, *next;
19261926
scb_t *scb;
19271927

1928-
dev_warn(&adapter->dev->dev, "%s cmd=%x <c=%d t=%d l=%d>\n",
1929-
(aor == SCB_ABORT)? "ABORTING":"RESET",
1930-
cmd->cmnd[0], cmd->device->channel,
1931-
cmd->device->id, (u32)cmd->device->lun);
1928+
if (aor == SCB_ABORT)
1929+
dev_warn(&adapter->dev->dev,
1930+
"ABORTING cmd=%x <c=%d t=%d l=%d>\n",
1931+
cmd->cmnd[0], cmd->device->channel,
1932+
cmd->device->id, (u32)cmd->device->lun);
1933+
else
1934+
dev_warn(&adapter->dev->dev, "RESETTING\n");
19321935

19331936
if(list_empty(&adapter->pending_list))
19341937
return FAILED;

drivers/scsi/mpt3sas/mpt3sas_base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ _base_readl_ext_retry(const void __iomem *addr)
223223

224224
for (i = 0 ; i < 30 ; i++) {
225225
ret_val = readl(addr);
226-
if (ret_val == 0)
227-
continue;
226+
if (ret_val != 0)
227+
break;
228228
}
229229

230230
return ret_val;

drivers/scsi/pmcraid.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,7 +2679,7 @@ static int pmcraid_error_handler(struct pmcraid_cmd *cmd)
26792679
/**
26802680
* pmcraid_reset_device - device reset handler functions
26812681
*
2682-
* @scsi_cmd: scsi command struct
2682+
* @scsi_dev: scsi device struct
26832683
* @timeout: command timeout
26842684
* @modifier: reset modifier indicating the reset sequence to be performed
26852685
*
@@ -3066,6 +3066,7 @@ static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd)
30663066
{
30673067
struct Scsi_Host *shost = scmd->device->host;
30683068
struct scsi_device *scsi_dev = NULL, *tmp;
3069+
int ret;
30693070

30703071
shost_for_each_device(tmp, shost) {
30713072
if ((tmp->channel == scmd->device->channel) &&
@@ -3078,9 +3079,11 @@ static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd)
30783079
return FAILED;
30793080
sdev_printk(KERN_INFO, scsi_dev,
30803081
"Doing target reset due to an I/O command timeout.\n");
3081-
return pmcraid_reset_device(scsi_dev,
3082-
PMCRAID_INTERNAL_TIMEOUT,
3083-
RESET_DEVICE_TARGET);
3082+
ret = pmcraid_reset_device(scsi_dev,
3083+
PMCRAID_INTERNAL_TIMEOUT,
3084+
RESET_DEVICE_TARGET);
3085+
scsi_device_put(scsi_dev);
3086+
return ret;
30843087
}
30853088

30863089
/**

drivers/scsi/scsi_lib.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,28 +1251,26 @@ static inline int scsi_dev_queue_ready(struct request_queue *q,
12511251
int token;
12521252

12531253
token = sbitmap_get(&sdev->budget_map);
1254-
if (atomic_read(&sdev->device_blocked)) {
1255-
if (token < 0)
1256-
goto out;
1254+
if (token < 0)
1255+
return -1;
12571256

1258-
if (scsi_device_busy(sdev) > 1)
1259-
goto out_dec;
1257+
if (!atomic_read(&sdev->device_blocked))
1258+
return token;
12601259

1261-
/*
1262-
* unblock after device_blocked iterates to zero
1263-
*/
1264-
if (atomic_dec_return(&sdev->device_blocked) > 0)
1265-
goto out_dec;
1266-
SCSI_LOG_MLQUEUE(3, sdev_printk(KERN_INFO, sdev,
1267-
"unblocking device at zero depth\n"));
1260+
/*
1261+
* Only unblock if no other commands are pending and
1262+
* if device_blocked has decreased to zero
1263+
*/
1264+
if (scsi_device_busy(sdev) > 1 ||
1265+
atomic_dec_return(&sdev->device_blocked) > 0) {
1266+
sbitmap_put(&sdev->budget_map, token);
1267+
return -1;
12681268
}
12691269

1270+
SCSI_LOG_MLQUEUE(3, sdev_printk(KERN_INFO, sdev,
1271+
"unblocking device at zero depth\n"));
1272+
12701273
return token;
1271-
out_dec:
1272-
if (token >= 0)
1273-
sbitmap_put(&sdev->budget_map, token);
1274-
out:
1275-
return -1;
12761274
}
12771275

12781276
/*

drivers/scsi/snic/snic_scsi.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,7 @@ snic_dr_clean_pending_req(struct snic *snic, struct scsi_cmnd *lr_sc)
18501850
{
18511851
struct scsi_device *lr_sdev = lr_sc->device;
18521852
u32 tag = 0;
1853-
int ret = FAILED;
1853+
int ret;
18541854

18551855
for (tag = 0; tag < snic->max_tag_id; tag++) {
18561856
if (tag == snic_cmd_tag(lr_sc))
@@ -1859,32 +1859,26 @@ snic_dr_clean_pending_req(struct snic *snic, struct scsi_cmnd *lr_sc)
18591859
ret = snic_dr_clean_single_req(snic, tag, lr_sdev);
18601860
if (ret) {
18611861
SNIC_HOST_ERR(snic->shost, "clean_err:tag = %d\n", tag);
1862-
18631862
goto clean_err;
18641863
}
18651864
}
18661865

18671866
schedule_timeout(msecs_to_jiffies(100));
18681867

18691868
/* Walk through all the cmds and check abts status. */
1870-
if (snic_is_abts_pending(snic, lr_sc)) {
1871-
ret = FAILED;
1872-
1869+
if (snic_is_abts_pending(snic, lr_sc))
18731870
goto clean_err;
1874-
}
18751871

1876-
ret = 0;
18771872
SNIC_SCSI_DBG(snic->shost, "clean_pending_req: Success.\n");
18781873

1879-
return ret;
1874+
return 0;
18801875

18811876
clean_err:
1882-
ret = FAILED;
18831877
SNIC_HOST_ERR(snic->shost,
18841878
"Failed to Clean Pending IOs on %s device.\n",
18851879
dev_name(&lr_sdev->sdev_gendev));
18861880

1887-
return ret;
1881+
return FAILED;
18881882

18891883
} /* end of snic_dr_clean_pending_req */
18901884

drivers/target/target_core_transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ static void target_queue_submission(struct se_cmd *se_cmd)
19211921

19221922
/**
19231923
* target_submit - perform final initialization and submit cmd to LIO core
1924-
* @cmd: command descriptor to submit
1924+
* @se_cmd: command descriptor to submit
19251925
*
19261926
* target_submit_prep or something similar must have been called on the cmd,
19271927
* and this must be called from process context.

drivers/ufs/core/ufshcd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,7 +2406,7 @@ static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
24062406
int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY,
24072407
500, UIC_CMD_TIMEOUT * 1000, false, hba,
24082408
REG_CONTROLLER_STATUS);
2409-
return ret == 0 ? true : false;
2409+
return ret == 0;
24102410
}
24112411

24122412
/**
@@ -3728,7 +3728,7 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
37283728
*/
37293729
ret = utf16s_to_utf8s(uc_str->uc,
37303730
uc_str->len - QUERY_DESC_HDR_SIZE,
3731-
UTF16_BIG_ENDIAN, str, ascii_len);
3731+
UTF16_BIG_ENDIAN, str, ascii_len - 1);
37323732

37333733
/* replace non-printable or non-ASCII characters with spaces */
37343734
for (i = 0; i < ret; i++)
@@ -5615,13 +5615,13 @@ static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
56155615
* For those cmds of which the cqes are not present
56165616
* in the cq, complete them explicitly.
56175617
*/
5618+
spin_lock_irqsave(&hwq->cq_lock, flags);
56185619
if (cmd && !test_bit(SCMD_STATE_COMPLETE, &cmd->state)) {
5619-
spin_lock_irqsave(&hwq->cq_lock, flags);
56205620
set_host_byte(cmd, DID_REQUEUE);
56215621
ufshcd_release_scsi_cmd(hba, lrbp);
56225622
scsi_done(cmd);
5623-
spin_unlock_irqrestore(&hwq->cq_lock, flags);
56245623
}
5624+
spin_unlock_irqrestore(&hwq->cq_lock, flags);
56255625
} else {
56265626
ufshcd_mcq_poll_cqe_lock(hba, hwq);
56275627
}

include/scsi/scsi_host.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ struct scsi_host_template {
245245
* midlayer calls this point so that the driver may deallocate
246246
* and terminate any references to the target.
247247
*
248+
* Note: This callback is called with the host lock held and hence
249+
* must not sleep.
250+
*
248251
* Status: OPTIONAL
249252
*/
250253
void (* target_destroy)(struct scsi_target *);

0 commit comments

Comments
 (0)