Skip to content

Commit 0b311e3

Browse files
committed
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull more SCSI updates from James Bottomley: "This is a few driver updates (iscsi, mpt3sas) that were still in the staging queue when the merge window opened (all committed on or before 8 Feb) and some small bug fixes which came in during the merge window (all committed on 22 Feb)" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (30 commits) scsi: hpsa: Correct dev cmds outstanding for retried cmds scsi: sd: Fix Opal support scsi: target: tcmu: Fix memory leak caused by wrong uio usage scsi: target: tcmu: Move some functions without code change scsi: sd: sd_zbc: Don't pass GFP_NOIO to kvcalloc scsi: aic7xxx: Remove unused function pointer typedef ahc_bus_suspend/resume_t scsi: bnx2fc: Fix Kconfig warning & CNIC build errors scsi: ufs: Fix a duplicate dev quirk number scsi: aic79xx: Fix spelling of version scsi: target: core: Prevent underflow for service actions scsi: target: core: Add cmd length set before cmd complete scsi: iscsi: Drop session lock in iscsi_session_chkready() scsi: qla4xxx: Use iscsi_is_session_online() scsi: libiscsi: Reset max/exp cmdsn during recovery scsi: iscsi_tcp: Fix shost can_queue initialization scsi: libiscsi: Add helper to calculate max SCSI cmds per session scsi: libiscsi: Fix iSCSI host workq destruction scsi: libiscsi: Fix iscsi_task use after free() scsi: libiscsi: Drop taskqueuelock scsi: libiscsi: Fix iscsi_prep_scsi_cmd_pdu() error handling ...
2 parents 03dc748 + f749d8b commit 0b311e3

30 files changed

+746
-316
lines changed

drivers/scsi/aic7xxx/aic79xx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ struct ahd_softc {
11751175
uint8_t tqinfifonext;
11761176

11771177
/*
1178-
* Cached verson of the hs_mailbox so we can avoid
1178+
* Cached version of the hs_mailbox so we can avoid
11791179
* pausing the sequencer during mailbox updates.
11801180
*/
11811181
uint8_t hs_mailbox;

drivers/scsi/aic7xxx/aic7xxx.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,6 @@ union ahc_bus_softc {
896896

897897
typedef void (*ahc_bus_intr_t)(struct ahc_softc *);
898898
typedef int (*ahc_bus_chip_init_t)(struct ahc_softc *);
899-
typedef int (*ahc_bus_suspend_t)(struct ahc_softc *);
900-
typedef int (*ahc_bus_resume_t)(struct ahc_softc *);
901899
typedef void ahc_callback_t (void *);
902900

903901
struct ahc_softc {

drivers/scsi/bnx2fc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ config SCSI_BNX2X_FCOE
55
depends on (IPV6 || IPV6=n)
66
depends on LIBFC
77
depends on LIBFCOE
8+
depends on MMU
89
select NETDEVICES
910
select ETHERNET
1011
select NET_VENDOR_BROADCOM

drivers/scsi/bnx2i/bnx2i_iscsi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,10 +1171,8 @@ static void bnx2i_cleanup_task(struct iscsi_task *task)
11711171
bnx2i_send_cmd_cleanup_req(hba, task->dd_data);
11721172

11731173
spin_unlock_bh(&conn->session->back_lock);
1174-
spin_unlock_bh(&conn->session->frwd_lock);
11751174
wait_for_completion_timeout(&bnx2i_conn->cmd_cleanup_cmpl,
11761175
msecs_to_jiffies(ISCSI_CMD_CLEANUP_TIMEOUT));
1177-
spin_lock_bh(&conn->session->frwd_lock);
11781176
spin_lock_bh(&conn->session->back_lock);
11791177
}
11801178
bnx2i_iscsi_unmap_sg_list(task->dd_data);

drivers/scsi/hpsa.c

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,10 @@ static void __enqueue_cmd_and_start_io(struct ctlr_info *h,
11511151
{
11521152
dial_down_lockup_detection_during_fw_flash(h, c);
11531153
atomic_inc(&h->commands_outstanding);
1154-
if (c->device)
1154+
/*
1155+
* Check to see if the command is being retried.
1156+
*/
1157+
if (c->device && !c->retry_pending)
11551158
atomic_inc(&c->device->commands_outstanding);
11561159

11571160
reply_queue = h->reply_map[raw_smp_processor_id()];
@@ -5567,7 +5570,8 @@ static inline void hpsa_cmd_partial_init(struct ctlr_info *h, int index,
55675570
}
55685571

55695572
static int hpsa_ioaccel_submit(struct ctlr_info *h,
5570-
struct CommandList *c, struct scsi_cmnd *cmd)
5573+
struct CommandList *c, struct scsi_cmnd *cmd,
5574+
bool retry)
55715575
{
55725576
struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
55735577
int rc = IO_ACCEL_INELIGIBLE;
@@ -5584,18 +5588,22 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h,
55845588
cmd->host_scribble = (unsigned char *) c;
55855589

55865590
if (dev->offload_enabled) {
5587-
hpsa_cmd_init(h, c->cmdindex, c);
5591+
hpsa_cmd_init(h, c->cmdindex, c); /* Zeroes out all fields */
55885592
c->cmd_type = CMD_SCSI;
55895593
c->scsi_cmd = cmd;
55905594
c->device = dev;
5595+
if (retry) /* Resubmit but do not increment device->commands_outstanding. */
5596+
c->retry_pending = true;
55915597
rc = hpsa_scsi_ioaccel_raid_map(h, c);
55925598
if (rc < 0) /* scsi_dma_map failed. */
55935599
rc = SCSI_MLQUEUE_HOST_BUSY;
55945600
} else if (dev->hba_ioaccel_enabled) {
5595-
hpsa_cmd_init(h, c->cmdindex, c);
5601+
hpsa_cmd_init(h, c->cmdindex, c); /* Zeroes out all fields */
55965602
c->cmd_type = CMD_SCSI;
55975603
c->scsi_cmd = cmd;
55985604
c->device = dev;
5605+
if (retry) /* Resubmit but do not increment device->commands_outstanding. */
5606+
c->retry_pending = true;
55995607
rc = hpsa_scsi_ioaccel_direct_map(h, c);
56005608
if (rc < 0) /* scsi_dma_map failed. */
56015609
rc = SCSI_MLQUEUE_HOST_BUSY;
@@ -5628,7 +5636,8 @@ static void hpsa_command_resubmit_worker(struct work_struct *work)
56285636

56295637
if (c2->error_data.serv_response ==
56305638
IOACCEL2_STATUS_SR_TASK_COMP_SET_FULL) {
5631-
rc = hpsa_ioaccel_submit(h, c, cmd);
5639+
/* Resubmit with the retry_pending flag set. */
5640+
rc = hpsa_ioaccel_submit(h, c, cmd, true);
56325641
if (rc == 0)
56335642
return;
56345643
if (rc == SCSI_MLQUEUE_HOST_BUSY) {
@@ -5644,6 +5653,15 @@ static void hpsa_command_resubmit_worker(struct work_struct *work)
56445653
}
56455654
}
56465655
hpsa_cmd_partial_init(c->h, c->cmdindex, c);
5656+
/*
5657+
* Here we have not come in though queue_command, so we
5658+
* can set the retry_pending flag to true for a driver initiated
5659+
* retry attempt (I.E. not a SML retry).
5660+
* I.E. We are submitting a driver initiated retry.
5661+
* Note: hpsa_ciss_submit does not zero out the command fields like
5662+
* ioaccel submit does.
5663+
*/
5664+
c->retry_pending = true;
56475665
if (hpsa_ciss_submit(c->h, c, cmd, dev)) {
56485666
/*
56495667
* If we get here, it means dma mapping failed. Try
@@ -5706,11 +5724,16 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
57065724
/*
57075725
* Call alternate submit routine for I/O accelerated commands.
57085726
* Retries always go down the normal I/O path.
5727+
* Note: If cmd->retries is non-zero, then this is a SML
5728+
* initiated retry and not a driver initiated retry.
5729+
* This command has been obtained from cmd_tagged_alloc
5730+
* and is therefore a brand-new command.
57095731
*/
57105732
if (likely(cmd->retries == 0 &&
57115733
!blk_rq_is_passthrough(cmd->request) &&
57125734
h->acciopath_status)) {
5713-
rc = hpsa_ioaccel_submit(h, c, cmd);
5735+
/* Submit with the retry_pending flag unset. */
5736+
rc = hpsa_ioaccel_submit(h, c, cmd, false);
57145737
if (rc == 0)
57155738
return 0;
57165739
if (rc == SCSI_MLQUEUE_HOST_BUSY) {
@@ -6105,6 +6128,7 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
61056128
* at init, and managed by cmd_tagged_alloc() and cmd_tagged_free() using the
61066129
* block request tag as an index into a table of entries. cmd_tagged_free() is
61076130
* the complement, although cmd_free() may be called instead.
6131+
* This function is only called for new requests from queue_command.
61086132
*/
61096133
static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h,
61106134
struct scsi_cmnd *scmd)
@@ -6139,8 +6163,14 @@ static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h,
61396163
}
61406164

61416165
atomic_inc(&c->refcount);
6142-
61436166
hpsa_cmd_partial_init(h, idx, c);
6167+
6168+
/*
6169+
* This is a new command obtained from queue_command so
6170+
* there have not been any driver initiated retry attempts.
6171+
*/
6172+
c->retry_pending = false;
6173+
61446174
return c;
61456175
}
61466176

@@ -6208,6 +6238,13 @@ static struct CommandList *cmd_alloc(struct ctlr_info *h)
62086238
}
62096239
hpsa_cmd_partial_init(h, i, c);
62106240
c->device = NULL;
6241+
6242+
/*
6243+
* cmd_alloc is for "internal" commands and they are never
6244+
* retried.
6245+
*/
6246+
c->retry_pending = false;
6247+
62116248
return c;
62126249
}
62136250

drivers/scsi/hpsa_cmd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ struct CommandList {
448448
*/
449449
struct hpsa_scsi_dev_t *phys_disk;
450450

451-
int abort_pending;
451+
bool retry_pending;
452452
struct hpsa_scsi_dev_t *device;
453453
atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() */
454454
} __aligned(COMMANDLIST_ALIGNMENT);

drivers/scsi/isci/request.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,8 +1480,6 @@ static enum sci_status
14801480
stp_request_pio_await_h2d_completion_tc_event(struct isci_request *ireq,
14811481
u32 completion_code)
14821482
{
1483-
enum sci_status status = SCI_SUCCESS;
1484-
14851483
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
14861484
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
14871485
ireq->scu_status = SCU_TASK_DONE_GOOD;
@@ -1500,7 +1498,7 @@ stp_request_pio_await_h2d_completion_tc_event(struct isci_request *ireq,
15001498
break;
15011499
}
15021500

1503-
return status;
1501+
return SCI_SUCCESS;
15041502
}
15051503

15061504
static enum sci_status
@@ -2152,8 +2150,6 @@ static enum sci_status stp_request_udma_await_tc_event(struct isci_request *ireq
21522150
static enum sci_status atapi_raw_completion(struct isci_request *ireq, u32 completion_code,
21532151
enum sci_base_request_states next)
21542152
{
2155-
enum sci_status status = SCI_SUCCESS;
2156-
21572153
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
21582154
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
21592155
ireq->scu_status = SCU_TASK_DONE_GOOD;
@@ -2172,7 +2168,7 @@ static enum sci_status atapi_raw_completion(struct isci_request *ireq, u32 compl
21722168
break;
21732169
}
21742170

2175-
return status;
2171+
return SCI_SUCCESS;
21762172
}
21772173

21782174
static enum sci_status atapi_data_tc_completion_handler(struct isci_request *ireq,

drivers/scsi/iscsi_tcp.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max,
847847
struct iscsi_session *session;
848848
struct iscsi_sw_tcp_host *tcp_sw_host;
849849
struct Scsi_Host *shost;
850+
int rc;
850851

851852
if (ep) {
852853
printk(KERN_ERR "iscsi_tcp: invalid ep %p.\n", ep);
@@ -864,6 +865,11 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max,
864865
shost->max_channel = 0;
865866
shost->max_cmd_len = SCSI_MAX_VARLEN_CDB_SIZE;
866867

868+
rc = iscsi_host_get_max_scsi_cmds(shost, cmds_max);
869+
if (rc < 0)
870+
goto free_host;
871+
shost->can_queue = rc;
872+
867873
if (iscsi_host_add(shost, NULL))
868874
goto free_host;
869875

@@ -878,7 +884,6 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max,
878884
tcp_sw_host = iscsi_host_priv(shost);
879885
tcp_sw_host->session = session;
880886

881-
shost->can_queue = session->scsi_cmds_max;
882887
if (iscsi_tcp_r2tpool_alloc(session))
883888
goto remove_session;
884889
return cls_session;
@@ -981,7 +986,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = {
981986
.name = "iSCSI Initiator over TCP/IP",
982987
.queuecommand = iscsi_queuecommand,
983988
.change_queue_depth = scsi_change_queue_depth,
984-
.can_queue = ISCSI_DEF_XMIT_CMDS_MAX - 1,
989+
.can_queue = ISCSI_TOTAL_CMDS_MAX,
985990
.sg_tablesize = 4096,
986991
.max_sectors = 0xFFFF,
987992
.cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,

0 commit comments

Comments
 (0)