aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-23 17:09:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-23 17:09:43 -0500
commit170e07bf6b5068d95ec28b5f24810fae9fac741f (patch)
tree9f81cc93e8b114f96b592f070700d6f3f210a1bd
parent8961ca441bde211bd4c620333bee615d806bcfcb (diff)
parent1bc5ad3a6acdcf56f83272f2de1cd2389ea9e9e2 (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "These are mostly fixes for problems with merge window code. In addition we have one doc update (alua) and two dead code removals (aiclib and octogon) a spurious assignment removal (csiostor) and a performance improvement for storvsc involving better interrupt spreading and increasing the command per lun handling" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: qla4xxx: skip error recovery in case of register disconnect. scsi: aacraid: fix shutdown crash when init fails scsi: qedi: Cleanup local str variable scsi: qedi: Fix truncation of CHAP name and secret scsi: qla2xxx: Fix incorrect handle for abort IOCB scsi: qla2xxx: Fix double free bug after firmware timeout scsi: storvsc: Increase cmd_per_lun for higher speed devices scsi: qla2xxx: Fix a locking imbalance in qlt_24xx_handle_els() scsi: scsi_dh: Document alua_rtpg_queue() arguments scsi: Remove Makefile entry for oktagon files scsi: aic7xxx: remove aiclib.c scsi: qla2xxx: Avoid triggering undefined behavior in qla2x00_mbx_completion() scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo() scsi: sym53c8xx_2: iterator underflow in sym_getsync() scsi: bnx2fc: Fix check in SCSI completion handler for timed out request scsi: csiostor: remove redundant assignment to pointer 'ln' scsi: ufs: Enable quirk to ignore sending WRITE_SAME command scsi: ibmvfc: fix misdefined reserved field in ibmvfc_fcp_rsp_info scsi: qla2xxx: Fix memory corruption during hba reset test scsi: mpt3sas: fix an out of bound write
-rw-r--r--drivers/message/fusion/mptctl.c2
-rw-r--r--drivers/scsi/Makefile1
-rw-r--r--drivers/scsi/aacraid/linit.c4
-rw-r--r--drivers/scsi/aic7xxx/aiclib.c34
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c1
-rw-r--r--drivers/scsi/csiostor/csio_lnode.c2
-rw-r--r--drivers/scsi/device_handler/scsi_dh_alua.c5
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.h2
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_base.c5
-rw-r--r--drivers/scsi/qedi/qedi_main.c55
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c23
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c7
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_def.h2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c46
-rw-r--r--drivers/scsi/storvsc_drv.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c2
-rw-r--r--drivers/scsi/ufs/ufshcd.c2
20 files changed, 107 insertions, 98 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 8d12017b9893..4470630dd545 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -2687,6 +2687,8 @@ mptctl_hp_targetinfo(unsigned long arg)
2687 __FILE__, __LINE__, iocnum); 2687 __FILE__, __LINE__, iocnum);
2688 return -ENODEV; 2688 return -ENODEV;
2689 } 2689 }
2690 if (karg.hdr.id >= MPT_MAX_FC_DEVICES)
2691 return -EINVAL;
2690 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n", 2692 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n",
2691 ioc->name)); 2693 ioc->name));
2692 2694
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index fcfd28d2884c..de1b3fce936d 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -185,7 +185,6 @@ ncr53c8xx-flags-$(CONFIG_SCSI_ZALON) \
185CFLAGS_ncr53c8xx.o := $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m) 185CFLAGS_ncr53c8xx.o := $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m)
186zalon7xx-objs := zalon.o ncr53c8xx.o 186zalon7xx-objs := zalon.o ncr53c8xx.o
187NCR_Q720_mod-objs := NCR_Q720.o ncr53c8xx.o 187NCR_Q720_mod-objs := NCR_Q720.o ncr53c8xx.o
188oktagon_esp_mod-objs := oktagon_esp.o oktagon_io.o
189 188
190# Files generated that shall be removed upon make clean 189# Files generated that shall be removed upon make clean
191clean-files := 53c700_d.h 53c700_u.h 190clean-files := 53c700_d.h 53c700_u.h
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index b3b931ab77eb..2664ea0df35f 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1693,8 +1693,10 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1693 * Map in the registers from the adapter. 1693 * Map in the registers from the adapter.
1694 */ 1694 */
1695 aac->base_size = AAC_MIN_FOOTPRINT_SIZE; 1695 aac->base_size = AAC_MIN_FOOTPRINT_SIZE;
1696 if ((*aac_drivers[index].init)(aac)) 1696 if ((*aac_drivers[index].init)(aac)) {
1697 error = -ENODEV;
1697 goto out_unmap; 1698 goto out_unmap;
1699 }
1698 1700
1699 if (aac->sync_mode) { 1701 if (aac->sync_mode) {
1700 if (aac_sync_mode) 1702 if (aac_sync_mode)
diff --git a/drivers/scsi/aic7xxx/aiclib.c b/drivers/scsi/aic7xxx/aiclib.c
deleted file mode 100644
index 828ae3d9a510..000000000000
--- a/drivers/scsi/aic7xxx/aiclib.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Implementation of Utility functions for all SCSI device types.
3 *
4 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs.
5 * Copyright (c) 1997, 1998 Kenneth D. Merry.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions, and the following disclaimer,
13 * without modification, immediately at the beginning of the file.
14 * 2. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: src/sys/cam/scsi/scsi_all.c,v 1.38 2002/09/23 04:56:35 mjacob Exp $
30 * $Id$
31 */
32
33#include "aiclib.h"
34
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 8e2f767147cb..5a645b8b9af1 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1889,6 +1889,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
1889 /* we will not receive ABTS response for this IO */ 1889 /* we will not receive ABTS response for this IO */
1890 BNX2FC_IO_DBG(io_req, "Timer context finished processing " 1890 BNX2FC_IO_DBG(io_req, "Timer context finished processing "
1891 "this scsi cmd\n"); 1891 "this scsi cmd\n");
1892 return;
1892 } 1893 }
1893 1894
1894 /* Cancel the timeout_work, as we received IO completion */ 1895 /* Cancel the timeout_work, as we received IO completion */
diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c
index be5ee2d37815..7dbbbb81a1e7 100644
--- a/drivers/scsi/csiostor/csio_lnode.c
+++ b/drivers/scsi/csiostor/csio_lnode.c
@@ -114,7 +114,7 @@ static enum csio_ln_ev fwevt_to_lnevt[] = {
114static struct csio_lnode * 114static struct csio_lnode *
115csio_ln_lookup_by_portid(struct csio_hw *hw, uint8_t portid) 115csio_ln_lookup_by_portid(struct csio_hw *hw, uint8_t portid)
116{ 116{
117 struct csio_lnode *ln = hw->rln; 117 struct csio_lnode *ln;
118 struct list_head *tmp; 118 struct list_head *tmp;
119 119
120 /* Match siblings lnode with portid */ 120 /* Match siblings lnode with portid */
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 022e421c2185..4b44325d1a82 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -876,6 +876,11 @@ static void alua_rtpg_work(struct work_struct *work)
876 876
877/** 877/**
878 * alua_rtpg_queue() - cause RTPG to be submitted asynchronously 878 * alua_rtpg_queue() - cause RTPG to be submitted asynchronously
879 * @pg: ALUA port group associated with @sdev.
880 * @sdev: SCSI device for which to submit an RTPG.
881 * @qdata: Information about the callback to invoke after the RTPG.
882 * @force: Whether or not to submit an RTPG if a work item that will submit an
883 * RTPG already has been scheduled.
879 * 884 *
880 * Returns true if and only if alua_rtpg_work() will be called asynchronously. 885 * Returns true if and only if alua_rtpg_work() will be called asynchronously.
881 * That function is responsible for calling @qdata->fn(). 886 * That function is responsible for calling @qdata->fn().
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index 9a0696f68f37..b81a53c4a9a8 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -367,7 +367,7 @@ enum ibmvfc_fcp_rsp_info_codes {
367}; 367};
368 368
369struct ibmvfc_fcp_rsp_info { 369struct ibmvfc_fcp_rsp_info {
370 __be16 reserved; 370 u8 reserved[3];
371 u8 rsp_code; 371 u8 rsp_code;
372 u8 reserved2[4]; 372 u8 reserved2[4];
373}__attribute__((packed, aligned (2))); 373}__attribute__((packed, aligned (2)));
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 13d6e4ec3022..59a87ca328d3 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -2410,8 +2410,11 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc)
2410 continue; 2410 continue;
2411 } 2411 }
2412 2412
2413 for_each_cpu(cpu, mask) 2413 for_each_cpu_and(cpu, mask, cpu_online_mask) {
2414 if (cpu >= ioc->cpu_msix_table_sz)
2415 break;
2414 ioc->cpu_msix_table[cpu] = reply_q->msix_index; 2416 ioc->cpu_msix_table[cpu] = reply_q->msix_index;
2417 }
2415 } 2418 }
2416 return; 2419 return;
2417 } 2420 }
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 029e2e69b29f..f57a94b4f0d9 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1724,7 +1724,6 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf)
1724{ 1724{
1725 struct qedi_ctx *qedi = data; 1725 struct qedi_ctx *qedi = data;
1726 struct nvm_iscsi_initiator *initiator; 1726 struct nvm_iscsi_initiator *initiator;
1727 char *str = buf;
1728 int rc = 1; 1727 int rc = 1;
1729 u32 ipv6_en, dhcp_en, ip_len; 1728 u32 ipv6_en, dhcp_en, ip_len;
1730 struct nvm_iscsi_block *block; 1729 struct nvm_iscsi_block *block;
@@ -1758,32 +1757,32 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf)
1758 1757
1759 switch (type) { 1758 switch (type) {
1760 case ISCSI_BOOT_ETH_IP_ADDR: 1759 case ISCSI_BOOT_ETH_IP_ADDR:
1761 rc = snprintf(str, ip_len, fmt, ip); 1760 rc = snprintf(buf, ip_len, fmt, ip);
1762 break; 1761 break;
1763 case ISCSI_BOOT_ETH_SUBNET_MASK: 1762 case ISCSI_BOOT_ETH_SUBNET_MASK:
1764 rc = snprintf(str, ip_len, fmt, sub); 1763 rc = snprintf(buf, ip_len, fmt, sub);
1765 break; 1764 break;
1766 case ISCSI_BOOT_ETH_GATEWAY: 1765 case ISCSI_BOOT_ETH_GATEWAY:
1767 rc = snprintf(str, ip_len, fmt, gw); 1766 rc = snprintf(buf, ip_len, fmt, gw);
1768 break; 1767 break;
1769 case ISCSI_BOOT_ETH_FLAGS: 1768 case ISCSI_BOOT_ETH_FLAGS:
1770 rc = snprintf(str, 3, "%hhd\n", 1769 rc = snprintf(buf, 3, "%hhd\n",
1771 SYSFS_FLAG_FW_SEL_BOOT); 1770 SYSFS_FLAG_FW_SEL_BOOT);
1772 break; 1771 break;
1773 case ISCSI_BOOT_ETH_INDEX: 1772 case ISCSI_BOOT_ETH_INDEX:
1774 rc = snprintf(str, 3, "0\n"); 1773 rc = snprintf(buf, 3, "0\n");
1775 break; 1774 break;
1776 case ISCSI_BOOT_ETH_MAC: 1775 case ISCSI_BOOT_ETH_MAC:
1777 rc = sysfs_format_mac(str, qedi->mac, ETH_ALEN); 1776 rc = sysfs_format_mac(buf, qedi->mac, ETH_ALEN);
1778 break; 1777 break;
1779 case ISCSI_BOOT_ETH_VLAN: 1778 case ISCSI_BOOT_ETH_VLAN:
1780 rc = snprintf(str, 12, "%d\n", 1779 rc = snprintf(buf, 12, "%d\n",
1781 GET_FIELD2(initiator->generic_cont0, 1780 GET_FIELD2(initiator->generic_cont0,
1782 NVM_ISCSI_CFG_INITIATOR_VLAN)); 1781 NVM_ISCSI_CFG_INITIATOR_VLAN));
1783 break; 1782 break;
1784 case ISCSI_BOOT_ETH_ORIGIN: 1783 case ISCSI_BOOT_ETH_ORIGIN:
1785 if (dhcp_en) 1784 if (dhcp_en)
1786 rc = snprintf(str, 3, "3\n"); 1785 rc = snprintf(buf, 3, "3\n");
1787 break; 1786 break;
1788 default: 1787 default:
1789 rc = 0; 1788 rc = 0;
@@ -1819,7 +1818,6 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf)
1819{ 1818{
1820 struct qedi_ctx *qedi = data; 1819 struct qedi_ctx *qedi = data;
1821 struct nvm_iscsi_initiator *initiator; 1820 struct nvm_iscsi_initiator *initiator;
1822 char *str = buf;
1823 int rc; 1821 int rc;
1824 struct nvm_iscsi_block *block; 1822 struct nvm_iscsi_block *block;
1825 1823
@@ -1831,8 +1829,8 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf)
1831 1829
1832 switch (type) { 1830 switch (type) {
1833 case ISCSI_BOOT_INI_INITIATOR_NAME: 1831 case ISCSI_BOOT_INI_INITIATOR_NAME:
1834 rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n", 1832 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN,
1835 initiator->initiator_name.byte); 1833 initiator->initiator_name.byte);
1836 break; 1834 break;
1837 default: 1835 default:
1838 rc = 0; 1836 rc = 0;
@@ -1860,7 +1858,6 @@ static ssize_t
1860qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type, 1858qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
1861 char *buf, enum qedi_nvm_tgts idx) 1859 char *buf, enum qedi_nvm_tgts idx)
1862{ 1860{
1863 char *str = buf;
1864 int rc = 1; 1861 int rc = 1;
1865 u32 ctrl_flags, ipv6_en, chap_en, mchap_en, ip_len; 1862 u32 ctrl_flags, ipv6_en, chap_en, mchap_en, ip_len;
1866 struct nvm_iscsi_block *block; 1863 struct nvm_iscsi_block *block;
@@ -1899,48 +1896,48 @@ qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
1899 1896
1900 switch (type) { 1897 switch (type) {
1901 case ISCSI_BOOT_TGT_NAME: 1898 case ISCSI_BOOT_TGT_NAME:
1902 rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n", 1899 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN,
1903 block->target[idx].target_name.byte); 1900 block->target[idx].target_name.byte);
1904 break; 1901 break;
1905 case ISCSI_BOOT_TGT_IP_ADDR: 1902 case ISCSI_BOOT_TGT_IP_ADDR:
1906 if (ipv6_en) 1903 if (ipv6_en)
1907 rc = snprintf(str, ip_len, "%pI6\n", 1904 rc = snprintf(buf, ip_len, "%pI6\n",
1908 block->target[idx].ipv6_addr.byte); 1905 block->target[idx].ipv6_addr.byte);
1909 else 1906 else
1910 rc = snprintf(str, ip_len, "%pI4\n", 1907 rc = snprintf(buf, ip_len, "%pI4\n",
1911 block->target[idx].ipv4_addr.byte); 1908 block->target[idx].ipv4_addr.byte);
1912 break; 1909 break;
1913 case ISCSI_BOOT_TGT_PORT: 1910 case ISCSI_BOOT_TGT_PORT:
1914 rc = snprintf(str, 12, "%d\n", 1911 rc = snprintf(buf, 12, "%d\n",
1915 GET_FIELD2(block->target[idx].generic_cont0, 1912 GET_FIELD2(block->target[idx].generic_cont0,
1916 NVM_ISCSI_CFG_TARGET_TCP_PORT)); 1913 NVM_ISCSI_CFG_TARGET_TCP_PORT));
1917 break; 1914 break;
1918 case ISCSI_BOOT_TGT_LUN: 1915 case ISCSI_BOOT_TGT_LUN:
1919 rc = snprintf(str, 22, "%.*d\n", 1916 rc = snprintf(buf, 22, "%.*d\n",
1920 block->target[idx].lun.value[1], 1917 block->target[idx].lun.value[1],
1921 block->target[idx].lun.value[0]); 1918 block->target[idx].lun.value[0]);
1922 break; 1919 break;
1923 case ISCSI_BOOT_TGT_CHAP_NAME: 1920 case ISCSI_BOOT_TGT_CHAP_NAME:
1924 rc = snprintf(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, "%s\n", 1921 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
1925 chap_name); 1922 chap_name);
1926 break; 1923 break;
1927 case ISCSI_BOOT_TGT_CHAP_SECRET: 1924 case ISCSI_BOOT_TGT_CHAP_SECRET:
1928 rc = snprintf(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, "%s\n", 1925 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
1929 chap_secret); 1926 chap_secret);
1930 break; 1927 break;
1931 case ISCSI_BOOT_TGT_REV_CHAP_NAME: 1928 case ISCSI_BOOT_TGT_REV_CHAP_NAME:
1932 rc = snprintf(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, "%s\n", 1929 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
1933 mchap_name); 1930 mchap_name);
1934 break; 1931 break;
1935 case ISCSI_BOOT_TGT_REV_CHAP_SECRET: 1932 case ISCSI_BOOT_TGT_REV_CHAP_SECRET:
1936 rc = snprintf(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, "%s\n", 1933 rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
1937 mchap_secret); 1934 mchap_secret);
1938 break; 1935 break;
1939 case ISCSI_BOOT_TGT_FLAGS: 1936 case ISCSI_BOOT_TGT_FLAGS:
1940 rc = snprintf(str, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT); 1937 rc = snprintf(buf, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT);
1941 break; 1938 break;
1942 case ISCSI_BOOT_TGT_NIC_ASSOC: 1939 case ISCSI_BOOT_TGT_NIC_ASSOC:
1943 rc = snprintf(str, 3, "0\n"); 1940 rc = snprintf(buf, 3, "0\n");
1944 break; 1941 break;
1945 default: 1942 default:
1946 rc = 0; 1943 rc = 0;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index aececf664654..2dea1129d396 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -59,8 +59,6 @@ qla2x00_sp_timeout(struct timer_list *t)
59 req->outstanding_cmds[sp->handle] = NULL; 59 req->outstanding_cmds[sp->handle] = NULL;
60 iocb = &sp->u.iocb_cmd; 60 iocb = &sp->u.iocb_cmd;
61 iocb->timeout(sp); 61 iocb->timeout(sp);
62 if (sp->type != SRB_ELS_DCMD)
63 sp->free(sp);
64 spin_unlock_irqrestore(&vha->hw->hardware_lock, flags); 62 spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
65} 63}
66 64
@@ -102,7 +100,6 @@ qla2x00_async_iocb_timeout(void *data)
102 srb_t *sp = data; 100 srb_t *sp = data;
103 fc_port_t *fcport = sp->fcport; 101 fc_port_t *fcport = sp->fcport;
104 struct srb_iocb *lio = &sp->u.iocb_cmd; 102 struct srb_iocb *lio = &sp->u.iocb_cmd;
105 struct event_arg ea;
106 103
107 if (fcport) { 104 if (fcport) {
108 ql_dbg(ql_dbg_disc, fcport->vha, 0x2071, 105 ql_dbg(ql_dbg_disc, fcport->vha, 0x2071,
@@ -117,25 +114,13 @@ qla2x00_async_iocb_timeout(void *data)
117 114
118 switch (sp->type) { 115 switch (sp->type) {
119 case SRB_LOGIN_CMD: 116 case SRB_LOGIN_CMD:
120 if (!fcport)
121 break;
122 /* Retry as needed. */ 117 /* Retry as needed. */
123 lio->u.logio.data[0] = MBS_COMMAND_ERROR; 118 lio->u.logio.data[0] = MBS_COMMAND_ERROR;
124 lio->u.logio.data[1] = lio->u.logio.flags & SRB_LOGIN_RETRIED ? 119 lio->u.logio.data[1] = lio->u.logio.flags & SRB_LOGIN_RETRIED ?
125 QLA_LOGIO_LOGIN_RETRIED : 0; 120 QLA_LOGIO_LOGIN_RETRIED : 0;
126 memset(&ea, 0, sizeof(ea)); 121 sp->done(sp, QLA_FUNCTION_TIMEOUT);
127 ea.event = FCME_PLOGI_DONE;
128 ea.fcport = sp->fcport;
129 ea.data[0] = lio->u.logio.data[0];
130 ea.data[1] = lio->u.logio.data[1];
131 ea.sp = sp;
132 qla24xx_handle_plogi_done_event(fcport->vha, &ea);
133 break; 122 break;
134 case SRB_LOGOUT_CMD: 123 case SRB_LOGOUT_CMD:
135 if (!fcport)
136 break;
137 qlt_logo_completion_handler(fcport, QLA_FUNCTION_TIMEOUT);
138 break;
139 case SRB_CT_PTHRU_CMD: 124 case SRB_CT_PTHRU_CMD:
140 case SRB_MB_IOCB: 125 case SRB_MB_IOCB:
141 case SRB_NACK_PLOGI: 126 case SRB_NACK_PLOGI:
@@ -235,12 +220,10 @@ static void
235qla2x00_async_logout_sp_done(void *ptr, int res) 220qla2x00_async_logout_sp_done(void *ptr, int res)
236{ 221{
237 srb_t *sp = ptr; 222 srb_t *sp = ptr;
238 struct srb_iocb *lio = &sp->u.iocb_cmd;
239 223
240 sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); 224 sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
241 if (!test_bit(UNLOADING, &sp->vha->dpc_flags)) 225 sp->fcport->login_gen++;
242 qla2x00_post_async_logout_done_work(sp->vha, sp->fcport, 226 qlt_logo_completion_handler(sp->fcport, res);
243 lio->u.logio.data);
244 sp->free(sp); 227 sp->free(sp);
245} 228}
246 229
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 1b62e943ec49..8d00d559bd26 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -3275,12 +3275,11 @@ qla24xx_abort_iocb(srb_t *sp, struct abort_entry_24xx *abt_iocb)
3275 memset(abt_iocb, 0, sizeof(struct abort_entry_24xx)); 3275 memset(abt_iocb, 0, sizeof(struct abort_entry_24xx));
3276 abt_iocb->entry_type = ABORT_IOCB_TYPE; 3276 abt_iocb->entry_type = ABORT_IOCB_TYPE;
3277 abt_iocb->entry_count = 1; 3277 abt_iocb->entry_count = 1;
3278 abt_iocb->handle = 3278 abt_iocb->handle = cpu_to_le32(MAKE_HANDLE(req->id, sp->handle));
3279 cpu_to_le32(MAKE_HANDLE(aio->u.abt.req_que_no,
3280 aio->u.abt.cmd_hndl));
3281 abt_iocb->nport_handle = cpu_to_le16(sp->fcport->loop_id); 3279 abt_iocb->nport_handle = cpu_to_le16(sp->fcport->loop_id);
3282 abt_iocb->handle_to_abort = 3280 abt_iocb->handle_to_abort =
3283 cpu_to_le32(MAKE_HANDLE(req->id, aio->u.abt.cmd_hndl)); 3281 cpu_to_le32(MAKE_HANDLE(aio->u.abt.req_que_no,
3282 aio->u.abt.cmd_hndl));
3284 abt_iocb->port_id[0] = sp->fcport->d_id.b.al_pa; 3283 abt_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
3285 abt_iocb->port_id[1] = sp->fcport->d_id.b.area; 3284 abt_iocb->port_id[1] = sp->fcport->d_id.b.area;
3286 abt_iocb->port_id[2] = sp->fcport->d_id.b.domain; 3285 abt_iocb->port_id[2] = sp->fcport->d_id.b.domain;
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 14109d86c3f6..89f93ebd819d 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -272,7 +272,8 @@ qla2x00_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)
272 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 272 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
273 273
274 /* Read all mbox registers? */ 274 /* Read all mbox registers? */
275 mboxes = (1 << ha->mbx_count) - 1; 275 WARN_ON_ONCE(ha->mbx_count > 32);
276 mboxes = (1ULL << ha->mbx_count) - 1;
276 if (!ha->mcp) 277 if (!ha->mcp)
277 ql_dbg(ql_dbg_async, vha, 0x5001, "MBX pointer ERROR.\n"); 278 ql_dbg(ql_dbg_async, vha, 0x5001, "MBX pointer ERROR.\n");
278 else 279 else
@@ -2880,7 +2881,8 @@ qla24xx_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)
2880 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 2881 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
2881 2882
2882 /* Read all mbox registers? */ 2883 /* Read all mbox registers? */
2883 mboxes = (1 << ha->mbx_count) - 1; 2884 WARN_ON_ONCE(ha->mbx_count > 32);
2885 mboxes = (1ULL << ha->mbx_count) - 1;
2884 if (!ha->mcp) 2886 if (!ha->mcp)
2885 ql_dbg(ql_dbg_async, vha, 0x504e, "MBX pointer ERROR.\n"); 2887 ql_dbg(ql_dbg_async, vha, 0x504e, "MBX pointer ERROR.\n");
2886 else 2888 else
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 12ee6e02d146..afcb5567998a 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3625,6 +3625,8 @@ qla2x00_remove_one(struct pci_dev *pdev)
3625 } 3625 }
3626 qla2x00_wait_for_hba_ready(base_vha); 3626 qla2x00_wait_for_hba_ready(base_vha);
3627 3627
3628 qla2x00_wait_for_sess_deletion(base_vha);
3629
3628 /* 3630 /*
3629 * if UNLOAD flag is already set, then continue unload, 3631 * if UNLOAD flag is already set, then continue unload,
3630 * where it was set first. 3632 * where it was set first.
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index fc89af8fe256..896b2d8bd803 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -4871,8 +4871,6 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha,
4871 sess); 4871 sess);
4872 qlt_send_term_imm_notif(vha, iocb, 1); 4872 qlt_send_term_imm_notif(vha, iocb, 1);
4873 res = 0; 4873 res = 0;
4874 spin_lock_irqsave(&tgt->ha->tgt.sess_lock,
4875 flags);
4876 break; 4874 break;
4877 } 4875 }
4878 4876
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index fc233717355f..817f312023a9 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -168,6 +168,8 @@
168#define DEV_DB_NON_PERSISTENT 0 168#define DEV_DB_NON_PERSISTENT 0
169#define DEV_DB_PERSISTENT 1 169#define DEV_DB_PERSISTENT 1
170 170
171#define QL4_ISP_REG_DISCONNECT 0xffffffffU
172
171#define COPY_ISID(dst_isid, src_isid) { \ 173#define COPY_ISID(dst_isid, src_isid) { \
172 int i, j; \ 174 int i, j; \
173 for (i = 0, j = ISID_SIZE - 1; i < ISID_SIZE;) \ 175 for (i = 0, j = ISID_SIZE - 1; i < ISID_SIZE;) \
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 82e889bbe0ed..fc2c97d9a0d6 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -262,6 +262,24 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
262 262
263static struct scsi_transport_template *qla4xxx_scsi_transport; 263static struct scsi_transport_template *qla4xxx_scsi_transport;
264 264
265static int qla4xxx_isp_check_reg(struct scsi_qla_host *ha)
266{
267 u32 reg_val = 0;
268 int rval = QLA_SUCCESS;
269
270 if (is_qla8022(ha))
271 reg_val = readl(&ha->qla4_82xx_reg->host_status);
272 else if (is_qla8032(ha) || is_qla8042(ha))
273 reg_val = qla4_8xxx_rd_direct(ha, QLA8XXX_PEG_ALIVE_COUNTER);
274 else
275 reg_val = readw(&ha->reg->ctrl_status);
276
277 if (reg_val == QL4_ISP_REG_DISCONNECT)
278 rval = QLA_ERROR;
279
280 return rval;
281}
282
265static int qla4xxx_send_ping(struct Scsi_Host *shost, uint32_t iface_num, 283static int qla4xxx_send_ping(struct Scsi_Host *shost, uint32_t iface_num,
266 uint32_t iface_type, uint32_t payload_size, 284 uint32_t iface_type, uint32_t payload_size,
267 uint32_t pid, struct sockaddr *dst_addr) 285 uint32_t pid, struct sockaddr *dst_addr)
@@ -9186,10 +9204,17 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)
9186 struct srb *srb = NULL; 9204 struct srb *srb = NULL;
9187 int ret = SUCCESS; 9205 int ret = SUCCESS;
9188 int wait = 0; 9206 int wait = 0;
9207 int rval;
9189 9208
9190 ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Abort command issued cmd=%p, cdb=0x%x\n", 9209 ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Abort command issued cmd=%p, cdb=0x%x\n",
9191 ha->host_no, id, lun, cmd, cmd->cmnd[0]); 9210 ha->host_no, id, lun, cmd, cmd->cmnd[0]);
9192 9211
9212 rval = qla4xxx_isp_check_reg(ha);
9213 if (rval != QLA_SUCCESS) {
9214 ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
9215 return FAILED;
9216 }
9217
9193 spin_lock_irqsave(&ha->hardware_lock, flags); 9218 spin_lock_irqsave(&ha->hardware_lock, flags);
9194 srb = (struct srb *) CMD_SP(cmd); 9219 srb = (struct srb *) CMD_SP(cmd);
9195 if (!srb) { 9220 if (!srb) {
@@ -9241,6 +9266,7 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
9241 struct scsi_qla_host *ha = to_qla_host(cmd->device->host); 9266 struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
9242 struct ddb_entry *ddb_entry = cmd->device->hostdata; 9267 struct ddb_entry *ddb_entry = cmd->device->hostdata;
9243 int ret = FAILED, stat; 9268 int ret = FAILED, stat;
9269 int rval;
9244 9270
9245 if (!ddb_entry) 9271 if (!ddb_entry)
9246 return ret; 9272 return ret;
@@ -9260,6 +9286,12 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
9260 cmd, jiffies, cmd->request->timeout / HZ, 9286 cmd, jiffies, cmd->request->timeout / HZ,
9261 ha->dpc_flags, cmd->result, cmd->allowed)); 9287 ha->dpc_flags, cmd->result, cmd->allowed));
9262 9288
9289 rval = qla4xxx_isp_check_reg(ha);
9290 if (rval != QLA_SUCCESS) {
9291 ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
9292 return FAILED;
9293 }
9294
9263 /* FIXME: wait for hba to go online */ 9295 /* FIXME: wait for hba to go online */
9264 stat = qla4xxx_reset_lun(ha, ddb_entry, cmd->device->lun); 9296 stat = qla4xxx_reset_lun(ha, ddb_entry, cmd->device->lun);
9265 if (stat != QLA_SUCCESS) { 9297 if (stat != QLA_SUCCESS) {
@@ -9303,6 +9335,7 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)
9303 struct scsi_qla_host *ha = to_qla_host(cmd->device->host); 9335 struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
9304 struct ddb_entry *ddb_entry = cmd->device->hostdata; 9336 struct ddb_entry *ddb_entry = cmd->device->hostdata;
9305 int stat, ret; 9337 int stat, ret;
9338 int rval;
9306 9339
9307 if (!ddb_entry) 9340 if (!ddb_entry)
9308 return FAILED; 9341 return FAILED;
@@ -9320,6 +9353,12 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)
9320 ha->host_no, cmd, jiffies, cmd->request->timeout / HZ, 9353 ha->host_no, cmd, jiffies, cmd->request->timeout / HZ,
9321 ha->dpc_flags, cmd->result, cmd->allowed)); 9354 ha->dpc_flags, cmd->result, cmd->allowed));
9322 9355
9356 rval = qla4xxx_isp_check_reg(ha);
9357 if (rval != QLA_SUCCESS) {
9358 ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
9359 return FAILED;
9360 }
9361
9323 stat = qla4xxx_reset_target(ha, ddb_entry); 9362 stat = qla4xxx_reset_target(ha, ddb_entry);
9324 if (stat != QLA_SUCCESS) { 9363 if (stat != QLA_SUCCESS) {
9325 starget_printk(KERN_INFO, scsi_target(cmd->device), 9364 starget_printk(KERN_INFO, scsi_target(cmd->device),
@@ -9374,9 +9413,16 @@ static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd)
9374{ 9413{
9375 int return_status = FAILED; 9414 int return_status = FAILED;
9376 struct scsi_qla_host *ha; 9415 struct scsi_qla_host *ha;
9416 int rval;
9377 9417
9378 ha = to_qla_host(cmd->device->host); 9418 ha = to_qla_host(cmd->device->host);
9379 9419
9420 rval = qla4xxx_isp_check_reg(ha);
9421 if (rval != QLA_SUCCESS) {
9422 ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
9423 return FAILED;
9424 }
9425
9380 if ((is_qla8032(ha) || is_qla8042(ha)) && ql4xdontresethba) 9426 if ((is_qla8032(ha) || is_qla8042(ha)) && ql4xdontresethba)
9381 qla4_83xx_set_idc_dontreset(ha); 9427 qla4_83xx_set_idc_dontreset(ha);
9382 9428
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 40fc7a590e81..6be5ab32c94f 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1657,7 +1657,7 @@ static struct scsi_host_template scsi_driver = {
1657 .eh_timed_out = storvsc_eh_timed_out, 1657 .eh_timed_out = storvsc_eh_timed_out,
1658 .slave_alloc = storvsc_device_alloc, 1658 .slave_alloc = storvsc_device_alloc,
1659 .slave_configure = storvsc_device_configure, 1659 .slave_configure = storvsc_device_configure,
1660 .cmd_per_lun = 255, 1660 .cmd_per_lun = 2048,
1661 .this_id = -1, 1661 .this_id = -1,
1662 .use_clustering = ENABLE_CLUSTERING, 1662 .use_clustering = ENABLE_CLUSTERING,
1663 /* Make sure we dont get a sg segment crosses a page boundary */ 1663 /* Make sure we dont get a sg segment crosses a page boundary */
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index ca360daa6a25..378af306fda1 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -536,7 +536,7 @@ sym_getsync(struct sym_hcb *np, u_char dt, u_char sfac, u_char *divp, u_char *fa
536 * Look for the greatest clock divisor that allows an 536 * Look for the greatest clock divisor that allows an
537 * input speed faster than the period. 537 * input speed faster than the period.
538 */ 538 */
539 while (div-- > 0) 539 while (--div > 0)
540 if (kpc >= (div_10M[div] << 2)) break; 540 if (kpc >= (div_10M[div] << 2)) break;
541 541
542 /* 542 /*
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index a355d989b414..c7da2c185990 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4352,6 +4352,8 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
4352 /* REPORT SUPPORTED OPERATION CODES is not supported */ 4352 /* REPORT SUPPORTED OPERATION CODES is not supported */
4353 sdev->no_report_opcodes = 1; 4353 sdev->no_report_opcodes = 1;
4354 4354
4355 /* WRITE_SAME command is not supported */
4356 sdev->no_write_same = 1;
4355 4357
4356 ufshcd_set_queue_depth(sdev); 4358 ufshcd_set_queue_depth(sdev);
4357 4359