Skip to content

Commit c8c6c9b

Browse files
committed
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull misc SCSI patches from James Bottomley: "This is a short patch set representing a couple of left overs from the merge window (debug removal and MAINTAINER changes). Plus one merge window regression (the local workqueue for hpsa) and a set of bug fixes for several issues (two for scsi-mq and the rest an assortment of long standing stuff, all cc'd to stable)" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: sg: fix EWOULDBLOCK errors with scsi-mq sg: fix unkillable I/O wait deadlock with scsi-mq sg: fix read() error reporting wd719x: add missing .module to wd719x_template hpsa: correct compiler warnings introduced by hpsa-add-local-workqueue patch fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit. fcoe: Transition maintainership to Vasu am53c974: remove left-over debugging code
2 parents 93aaa83 + 7772855 commit c8c6c9b

File tree

6 files changed

+36
-18
lines changed

6 files changed

+36
-18
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3937,7 +3937,7 @@ S: Maintained
39373937
F: drivers/staging/fbtft/
39383938

39393939
FCOE SUBSYSTEM (libfc, libfcoe, fcoe)
3940-
M: Robert Love <robert.w.love@intel.com>
3940+
M: Vasu Dev <vasu.dev@intel.com>
39413941
L: fcoe-devel@open-fcoe.org
39423942
W: www.Open-FCoE.org
39433943
S: Supported

drivers/scsi/am53c974.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,6 @@ static void pci_esp_dma_drain(struct esp *esp)
178178
break;
179179
cpu_relax();
180180
}
181-
if (resid > 1) {
182-
/* FIFO not cleared */
183-
shost_printk(KERN_INFO, esp->host,
184-
"FIFO not cleared, %d bytes left\n",
185-
resid);
186-
}
187181

188182
/*
189183
* When there is a residual BCMPLT will never be set

drivers/scsi/be2iscsi/be_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)
585585
"beiscsi_hba_alloc - iscsi_host_alloc failed\n");
586586
return NULL;
587587
}
588-
shost->dma_boundary = pcidev->dma_mask;
589588
shost->max_id = BE2_MAX_SESSIONS;
590589
shost->max_channel = 0;
591590
shost->max_cmd_len = BEISCSI_MAX_CMD_LEN;

drivers/scsi/hpsa.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6831,10 +6831,8 @@ static struct workqueue_struct *hpsa_create_controller_wq(struct ctlr_info *h,
68316831
char *name)
68326832
{
68336833
struct workqueue_struct *wq = NULL;
6834-
char wq_name[20];
68356834

6836-
snprintf(wq_name, sizeof(wq_name), "%s_%d_hpsa", name, h->ctlr);
6837-
wq = alloc_ordered_workqueue(wq_name, 0);
6835+
wq = alloc_ordered_workqueue("%s_%d_hpsa", 0, name, h->ctlr);
68386836
if (!wq)
68396837
dev_err(&h->pdev->dev, "failed to create %s workqueue\n", name);
68406838

drivers/scsi/sg.c

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ static ssize_t
546546
sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
547547
{
548548
sg_io_hdr_t *hp = &srp->header;
549-
int err = 0;
549+
int err = 0, err2;
550550
int len;
551551

552552
if (count < SZ_SG_IO_HDR) {
@@ -575,8 +575,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
575575
goto err_out;
576576
}
577577
err_out:
578-
err = sg_finish_rem_req(srp);
579-
return (0 == err) ? count : err;
578+
err2 = sg_finish_rem_req(srp);
579+
return err ? : err2 ? : count;
580580
}
581581

582582
static ssize_t
@@ -1335,6 +1335,17 @@ sg_rq_end_io(struct request *rq, int uptodate)
13351335
}
13361336
/* Rely on write phase to clean out srp status values, so no "else" */
13371337

1338+
/*
1339+
* Free the request as soon as it is complete so that its resources
1340+
* can be reused without waiting for userspace to read() the
1341+
* result. But keep the associated bio (if any) around until
1342+
* blk_rq_unmap_user() can be called from user context.
1343+
*/
1344+
srp->rq = NULL;
1345+
if (rq->cmd != rq->__cmd)
1346+
kfree(rq->cmd);
1347+
__blk_put_request(rq->q, rq);
1348+
13381349
write_lock_irqsave(&sfp->rq_list_lock, iflags);
13391350
if (unlikely(srp->orphan)) {
13401351
if (sfp->keep_orphan)
@@ -1669,7 +1680,22 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
16691680
return -ENOMEM;
16701681
}
16711682

1672-
rq = blk_get_request(q, rw, GFP_ATOMIC);
1683+
/*
1684+
* NOTE
1685+
*
1686+
* With scsi-mq enabled, there are a fixed number of preallocated
1687+
* requests equal in number to shost->can_queue. If all of the
1688+
* preallocated requests are already in use, then using GFP_ATOMIC with
1689+
* blk_get_request() will return -EWOULDBLOCK, whereas using GFP_KERNEL
1690+
* will cause blk_get_request() to sleep until an active command
1691+
* completes, freeing up a request. Neither option is ideal, but
1692+
* GFP_KERNEL is the better choice to prevent userspace from getting an
1693+
* unexpected EWOULDBLOCK.
1694+
*
1695+
* With scsi-mq disabled, blk_get_request() with GFP_KERNEL usually
1696+
* does not sleep except under memory pressure.
1697+
*/
1698+
rq = blk_get_request(q, rw, GFP_KERNEL);
16731699
if (IS_ERR(rq)) {
16741700
kfree(long_cmdp);
16751701
return PTR_ERR(rq);
@@ -1759,10 +1785,10 @@ sg_finish_rem_req(Sg_request *srp)
17591785
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp,
17601786
"sg_finish_rem_req: res_used=%d\n",
17611787
(int) srp->res_used));
1762-
if (srp->rq) {
1763-
if (srp->bio)
1764-
ret = blk_rq_unmap_user(srp->bio);
1788+
if (srp->bio)
1789+
ret = blk_rq_unmap_user(srp->bio);
17651790

1791+
if (srp->rq) {
17661792
if (srp->rq->cmd != srp->rq->__cmd)
17671793
kfree(srp->rq->cmd);
17681794
blk_put_request(srp->rq);

drivers/scsi/wd719x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@ static int wd719x_board_found(struct Scsi_Host *sh)
870870
}
871871

872872
static struct scsi_host_template wd719x_template = {
873+
.module = THIS_MODULE,
873874
.name = "Western Digital 719x",
874875
.queuecommand = wd719x_queuecommand,
875876
.eh_abort_handler = wd719x_abort,

0 commit comments

Comments
 (0)