diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-11 13:02:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-11 13:02:30 -0400 |
commit | 5a433f7a6bc49b5745d5ccd4f1c84f57ab7013a9 (patch) | |
tree | 408b478ff46b4f466713908f9470420cc4b56ec0 | |
parent | f24fe98df8448d60867d2b81a1a67722a6568b19 (diff) | |
parent | 15e3d5a285ab9283136dba34bbf72886d9146706 (diff) |
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley:
"This is a set of three bug fixes, two of which are regressions from
recent updates (the 3ware one from 4.1 and the device handler fixes
from 4.2)"
* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
3w-9xxx: don't unmap bounce buffered commands
scsi_dh: Use the correct module name when loading device handler
libiscsi: Fix iscsi_check_transport_timeouts possible infinite loop
-rw-r--r-- | drivers/scsi/3w-9xxx.c | 28 | ||||
-rw-r--r-- | drivers/scsi/libiscsi.c | 17 | ||||
-rw-r--r-- | drivers/scsi/scsi_dh.c | 2 |
3 files changed, 33 insertions, 14 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index add419d6ff34..a56a7b243e91 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -212,6 +212,17 @@ static const struct file_operations twa_fops = { | |||
212 | .llseek = noop_llseek, | 212 | .llseek = noop_llseek, |
213 | }; | 213 | }; |
214 | 214 | ||
215 | /* | ||
216 | * The controllers use an inline buffer instead of a mapped SGL for small, | ||
217 | * single entry buffers. Note that we treat a zero-length transfer like | ||
218 | * a mapped SGL. | ||
219 | */ | ||
220 | static bool twa_command_mapped(struct scsi_cmnd *cmd) | ||
221 | { | ||
222 | return scsi_sg_count(cmd) != 1 || | ||
223 | scsi_bufflen(cmd) >= TW_MIN_SGL_LENGTH; | ||
224 | } | ||
225 | |||
215 | /* This function will complete an aen request from the isr */ | 226 | /* This function will complete an aen request from the isr */ |
216 | static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id) | 227 | static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id) |
217 | { | 228 | { |
@@ -1339,7 +1350,8 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) | |||
1339 | } | 1350 | } |
1340 | 1351 | ||
1341 | /* Now complete the io */ | 1352 | /* Now complete the io */ |
1342 | scsi_dma_unmap(cmd); | 1353 | if (twa_command_mapped(cmd)) |
1354 | scsi_dma_unmap(cmd); | ||
1343 | cmd->scsi_done(cmd); | 1355 | cmd->scsi_done(cmd); |
1344 | tw_dev->state[request_id] = TW_S_COMPLETED; | 1356 | tw_dev->state[request_id] = TW_S_COMPLETED; |
1345 | twa_free_request_id(tw_dev, request_id); | 1357 | twa_free_request_id(tw_dev, request_id); |
@@ -1582,7 +1594,8 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev) | |||
1582 | struct scsi_cmnd *cmd = tw_dev->srb[i]; | 1594 | struct scsi_cmnd *cmd = tw_dev->srb[i]; |
1583 | 1595 | ||
1584 | cmd->result = (DID_RESET << 16); | 1596 | cmd->result = (DID_RESET << 16); |
1585 | scsi_dma_unmap(cmd); | 1597 | if (twa_command_mapped(cmd)) |
1598 | scsi_dma_unmap(cmd); | ||
1586 | cmd->scsi_done(cmd); | 1599 | cmd->scsi_done(cmd); |
1587 | } | 1600 | } |
1588 | } | 1601 | } |
@@ -1765,12 +1778,14 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_ | |||
1765 | retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); | 1778 | retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); |
1766 | switch (retval) { | 1779 | switch (retval) { |
1767 | case SCSI_MLQUEUE_HOST_BUSY: | 1780 | case SCSI_MLQUEUE_HOST_BUSY: |
1768 | scsi_dma_unmap(SCpnt); | 1781 | if (twa_command_mapped(SCpnt)) |
1782 | scsi_dma_unmap(SCpnt); | ||
1769 | twa_free_request_id(tw_dev, request_id); | 1783 | twa_free_request_id(tw_dev, request_id); |
1770 | break; | 1784 | break; |
1771 | case 1: | 1785 | case 1: |
1772 | SCpnt->result = (DID_ERROR << 16); | 1786 | SCpnt->result = (DID_ERROR << 16); |
1773 | scsi_dma_unmap(SCpnt); | 1787 | if (twa_command_mapped(SCpnt)) |
1788 | scsi_dma_unmap(SCpnt); | ||
1774 | done(SCpnt); | 1789 | done(SCpnt); |
1775 | tw_dev->state[request_id] = TW_S_COMPLETED; | 1790 | tw_dev->state[request_id] = TW_S_COMPLETED; |
1776 | twa_free_request_id(tw_dev, request_id); | 1791 | twa_free_request_id(tw_dev, request_id); |
@@ -1831,8 +1846,7 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, | |||
1831 | /* Map sglist from scsi layer to cmd packet */ | 1846 | /* Map sglist from scsi layer to cmd packet */ |
1832 | 1847 | ||
1833 | if (scsi_sg_count(srb)) { | 1848 | if (scsi_sg_count(srb)) { |
1834 | if ((scsi_sg_count(srb) == 1) && | 1849 | if (!twa_command_mapped(srb)) { |
1835 | (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) { | ||
1836 | if (srb->sc_data_direction == DMA_TO_DEVICE || | 1850 | if (srb->sc_data_direction == DMA_TO_DEVICE || |
1837 | srb->sc_data_direction == DMA_BIDIRECTIONAL) | 1851 | srb->sc_data_direction == DMA_BIDIRECTIONAL) |
1838 | scsi_sg_copy_to_buffer(srb, | 1852 | scsi_sg_copy_to_buffer(srb, |
@@ -1905,7 +1919,7 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re | |||
1905 | { | 1919 | { |
1906 | struct scsi_cmnd *cmd = tw_dev->srb[request_id]; | 1920 | struct scsi_cmnd *cmd = tw_dev->srb[request_id]; |
1907 | 1921 | ||
1908 | if (scsi_bufflen(cmd) < TW_MIN_SGL_LENGTH && | 1922 | if (!twa_command_mapped(cmd) && |
1909 | (cmd->sc_data_direction == DMA_FROM_DEVICE || | 1923 | (cmd->sc_data_direction == DMA_FROM_DEVICE || |
1910 | cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { | 1924 | cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { |
1911 | if (scsi_sg_count(cmd) == 1) { | 1925 | if (scsi_sg_count(cmd) == 1) { |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 33c74d3436c9..6bffd91b973a 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -976,13 +976,13 @@ static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
976 | wake_up(&conn->ehwait); | 976 | wake_up(&conn->ehwait); |
977 | } | 977 | } |
978 | 978 | ||
979 | static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) | 979 | static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) |
980 | { | 980 | { |
981 | struct iscsi_nopout hdr; | 981 | struct iscsi_nopout hdr; |
982 | struct iscsi_task *task; | 982 | struct iscsi_task *task; |
983 | 983 | ||
984 | if (!rhdr && conn->ping_task) | 984 | if (!rhdr && conn->ping_task) |
985 | return; | 985 | return -EINVAL; |
986 | 986 | ||
987 | memset(&hdr, 0, sizeof(struct iscsi_nopout)); | 987 | memset(&hdr, 0, sizeof(struct iscsi_nopout)); |
988 | hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; | 988 | hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; |
@@ -996,13 +996,16 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) | |||
996 | hdr.ttt = RESERVED_ITT; | 996 | hdr.ttt = RESERVED_ITT; |
997 | 997 | ||
998 | task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); | 998 | task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); |
999 | if (!task) | 999 | if (!task) { |
1000 | iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); | 1000 | iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); |
1001 | else if (!rhdr) { | 1001 | return -EIO; |
1002 | } else if (!rhdr) { | ||
1002 | /* only track our nops */ | 1003 | /* only track our nops */ |
1003 | conn->ping_task = task; | 1004 | conn->ping_task = task; |
1004 | conn->last_ping = jiffies; | 1005 | conn->last_ping = jiffies; |
1005 | } | 1006 | } |
1007 | |||
1008 | return 0; | ||
1006 | } | 1009 | } |
1007 | 1010 | ||
1008 | static int iscsi_nop_out_rsp(struct iscsi_task *task, | 1011 | static int iscsi_nop_out_rsp(struct iscsi_task *task, |
@@ -2092,8 +2095,10 @@ static void iscsi_check_transport_timeouts(unsigned long data) | |||
2092 | if (time_before_eq(last_recv + recv_timeout, jiffies)) { | 2095 | if (time_before_eq(last_recv + recv_timeout, jiffies)) { |
2093 | /* send a ping to try to provoke some traffic */ | 2096 | /* send a ping to try to provoke some traffic */ |
2094 | ISCSI_DBG_CONN(conn, "Sending nopout as ping\n"); | 2097 | ISCSI_DBG_CONN(conn, "Sending nopout as ping\n"); |
2095 | iscsi_send_nopout(conn, NULL); | 2098 | if (iscsi_send_nopout(conn, NULL)) |
2096 | next_timeout = conn->last_ping + (conn->ping_timeout * HZ); | 2099 | next_timeout = jiffies + (1 * HZ); |
2100 | else | ||
2101 | next_timeout = conn->last_ping + (conn->ping_timeout * HZ); | ||
2097 | } else | 2102 | } else |
2098 | next_timeout = last_recv + recv_timeout; | 2103 | next_timeout = last_recv + recv_timeout; |
2099 | 2104 | ||
diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c index edb044a7b56d..0a2168e69bbc 100644 --- a/drivers/scsi/scsi_dh.c +++ b/drivers/scsi/scsi_dh.c | |||
@@ -111,7 +111,7 @@ static struct scsi_device_handler *scsi_dh_lookup(const char *name) | |||
111 | 111 | ||
112 | dh = __scsi_dh_lookup(name); | 112 | dh = __scsi_dh_lookup(name); |
113 | if (!dh) { | 113 | if (!dh) { |
114 | request_module(name); | 114 | request_module("scsi_dh_%s", name); |
115 | dh = __scsi_dh_lookup(name); | 115 | dh = __scsi_dh_lookup(name); |
116 | } | 116 | } |
117 | 117 | ||