[PATCH] [scsi] enclosure: remove all possible sysfs entries before add device

2013-09-09 Thread Joe Jin
When do disk pull/insert test we encountered below:

WARNING: at fs/sysfs/dir.c:455 sysfs_add_one+0xbc/0xe0()
Hardware name: SUN FIRE X4370 M2 SERVER
sysfs: cannot create duplicate filename 
'/devices/pci:00/:00:03.0/:0d:00.0/host6/port-6:1/expander-6:1/port-6:1:14/end_device-6:1:14/target6:0:27/6:0:27:0/enclosure_device:HDD10'
Modules linked in: oracleacfs(P)(U) oracleadvm(P)(U) oracleoks(P)(U) mptctl 
mptbase autofs4 hidp bluetooth rfkill lockd sunrpc bonding be2iscsi 
iscsi_boot_sysfs ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr 
iscsi_tcp bnx2i cnic uio ipv6 cxgb3i libcxgbi cxgb3 mdio libiscsi_tcp libiscsi 
scsi_transport_iscsi dm_round_robin dm_multipath video sbs sbshc acpi_pad 
acpi_memhotplug acpi_ipmi parport_pc lp parport ipmi_si ipmi_devintf 
ipmi_msghandler sg ses enclosure ixgbe e1000e hwmon igb snd_seq_dummy 
snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss 
snd_pcm snd_timer snd soundcore snd_page_alloc iTCO_wdt pcspkr i2c_i801 ioatdma 
ghes iTCO_vendor_support hed dca i2c_core i7core_edac edac_core dm_snapshot 
dm_zero dm_mirror dm_region_hash dm_log dm_mod usb_storage shpchp mpt2sas 
scsi_transport_sas raid_class ahci libahci sd_mod crc_t10dif raid1 ext3 jbd 
mbcache
Pid: 23302, comm: kworker/u:2 Tainted: P2.6.39-400.124.1.el5uek #1
Call Trace:
 [811daf8c] ? sysfs_add_one+0xbc/0xe0
 [8106f030] warn_slowpath_common+0x90/0xc0
 [8106f15e] warn_slowpath_fmt+0x6e/0x70
 [81258bd4] ? strlcat+0x54/0x70
 [811daf8c] sysfs_add_one+0xbc/0xe0
 [811dbec8] sysfs_do_create_link+0x148/0x1d0
 [811dbf83] sysfs_create_link+0x13/0x20
 [a00de307] enclosure_add_links+0xe7/0x110 [enclosure]
 [8125325d] ? kobject_release+0xd/0x10
 [812549e7] ? kref_put+0x37/0x70
 [a00de3c3] enclosure_add_device+0x93/0xa0 [enclosure]
 [a00c8666] ses_enclosure_find_by_addr+0x76/0xc0 [ses]
 [a00c85f0] ? ses_get_fault+0x40/0x40 [ses]
 [a00de433] enclosure_for_each_device+0x63/0x90 [enclosure]
 [a00c8a8a] ses_match_to_enclosure+0x11a/0x1d0 [ses]
 [a00c8e08] ses_intf_add+0x2c8/0x5c0 [ses]
 [8125327a] ? kobject_get+0x1a/0x30
 [814e8b56] ? add_tail+0x36/0x50
 [81345ae4] device_add+0x2d4/0x380
 [8136b096] scsi_sysfs_add_sdev+0xe6/0x2a0
 [813682cc] scsi_add_lun+0x41c/0x560
 [81368a80] scsi_probe_and_add_lun+0x1e0/0x3e0
 [81041009] ? default_spin_lock_flags+0x9/0x10
 [813696e7] __scsi_scan_target+0xe7/0x120
 [81369b8d] scsi_scan_target+0xcd/0xf0
 [a003faab] sas_rphy_add+0x11b/0x170 [scsi_transport_sas]
 [a009a74f] mpt2sas_transport_port_add+0x2cf/0x430 [mpt2sas]
 [a008d437] _scsih_sas_device_add+0x87/0x110 [mpt2sas]
 [a0094eb8] _scsih_add_device+0x248/0x340 [mpt2sas]
 [a0098cb1] ? mpt2sas_transport_update_links+0xf1/0x190 [mpt2sas]
 [a00977b6] _scsih_sas_topology_change_event+0x3c6/0x490 [mpt2sas]
 [81080698] ? add_timer+0x18/0x20
 [8108a405] ? queue_delayed_work_on+0xc5/0x170
 [a0097a85] _mpt2sas_fw_work+0x205/0x240 [mpt2sas]
 [a0097ad9] _firmware_event_work_delayed+0x19/0x20 [mpt2sas]
 [8108c0d9] process_one_work+0xf9/0x370
 [a0097ac0] ? _mpt2sas_fw_work+0x240/0x240 [mpt2sas]
 [8108ca1a] worker_thread+0xca/0x240
 [8108c950] ? manage_workers+0x90/0x90
 [81090ff7] kthread+0x97/0xa0
 [8150fdc4] kernel_thread_helper+0x4/0x10
 [81090f60] ? kthread_bind+0x80/0x80
 [8150fdc0] ? gs_change+0x13/0x13
---[ end trace 89a1351702ab360f ]---

During our test, multipath used, each LUN has 2 paths. when adding second
path enclousure did not check if will adding device's symlink existed or no.

Cc: James Bottomley james.bottom...@hansenpartnership.com
Signed-off-by: Joe Jin joe@oracle.com
---
 drivers/misc/enclosure.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 0e8df41..efc0e86 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -325,6 +325,13 @@ int enclosure_add_device(struct enclosure_device *edev, 
int component,
if (cdev-dev)
enclosure_remove_links(cdev);
 
+   if (dev) {
+   char name[ENCLOSURE_NAME_SIZE];
+
+   enclosure_link_name(cdev, name);
+   sysfs_remove_link(dev-kobj, name);
+   }
+
put_device(cdev-dev);
cdev-dev = get_device(dev);
return enclosure_add_links(cdev);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] SCSI: Fix potential out-of-bounds access in drivers/scsi/sd.c

2013-09-09 Thread Hannes Reinecke
On 09/06/2013 06:24 PM, Paolo Bonzini wrote:
 Il 06/09/2013 17:49, Alan Stern ha scritto:
 This patch fixes an out-of-bounds error in sd_read_cache_type(), found
 by Google's AddressSanitizer tool.  When the loop ends, we know that
 offset lies beyond the end of the data in the buffer, so no Caching
 mode page was found.  In theory it may be present, but the buffer size
 is limited to 512 bytes.

 Signed-off-by: Alan Stern st...@rowland.harvard.edu
 Reported-by: Dmitry Vyukov dvyu...@google.com
 CC: sta...@vger.kernel.org
 
 Reviewed-by: Paolo Bonzini pbonz...@redhat.com
 
Acked-by: Hannes Reinecke h...@suse.de

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries  Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Greetings From Morris Thompson.

2013-09-09 Thread Morris Thompson
Dear Friend,

I am Morris Thompson, a Banker and credit system programmer. I saw your
email address while browsing through the bank D.T.C Screen in
my office yesterday so I decided to use this very chance to know you.

I am contacting as to front you as the beneficiary and receive A
Diplomatic Package which I used by office and dispatched through Our
Central Bank Diplomatic Accredited Courier Agent to Europe and now
confirmed in their Vault. In the Package A Trunk was con-sealed with
United States 100 Dollar Bills Cash amounted to a total sum of U.S$10
Million belonging to one of the serving state Governor and please he do
not want his identity disclose.

He approached me to use my office and have the concealed package
containing the cash funds move out from the country and recommend a
reliable person in your country who will receives the consignments and
have the funds invest in good profitable investments which necessitated
my contacting you. He agreed to let you have 30% of the total funds, 10%
for me while you will invest the rest for him. If you are interested in
this transaction,

kindly revert back to me immediately and let me have your direct contacts
(Telephone numbers) and your receiving address where the Vault company
will arrange for A Diplomatic Delivery of the Packages to you.

Please like I requested earlier treat this with utmost secret. Forward your 
respond 
to my private email address : morris_thomps...@yahoo.com

Thanks and remain bless,

Regards,

Morris Thompson.
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH V2 1/3] scsi: ufs: Allow vendor specific initialization

2013-09-09 Thread Seungwon Jeon
Hi Sujit,

On Tue, August 27, 2013, Sujit Reddy Thumma wrote:
 Some vendor specific controller versions might need to configure
 vendor specific - registers, clocks, voltage regulators etc. to
 initialize the host controller UTP layer and Uni-Pro stack.
 Provide some common initialization operations that can be used
 to configure vendor specifics. The methods can be extended in
 future, for example, for power mode transitions.
 
 The operations are vendor/board specific and hence determined with
 the help of compatible property in device tree.
 
 Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
 ---
  drivers/scsi/ufs/ufshcd-pci.c|   8 +-
  drivers/scsi/ufs/ufshcd-pltfrm.c |  24 +-
  drivers/scsi/ufs/ufshcd.c| 157 
 +++
  drivers/scsi/ufs/ufshcd.h|  34 -
  4 files changed, 187 insertions(+), 36 deletions(-)
 
 diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c
 index a823cf4..6b0d299 100644
 --- a/drivers/scsi/ufs/ufshcd-pci.c
 +++ b/drivers/scsi/ufs/ufshcd-pci.c
 @@ -191,7 +191,13 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct 
 pci_device_id *id)
   return err;
   }
 
 - err = ufshcd_init(pdev-dev, hba, mmio_base, pdev-irq);
 + err = ufshcd_alloc_host(pdev-dev, hba);
 + if (err) {
 + dev_err(pdev-dev, Allocation failed\n);
 + return err;
 + }
 +
 + err = ufshcd_init(hba, mmio_base, pdev-irq);
   if (err) {
   dev_err(pdev-dev, Initialization failed\n);
   return err;
 diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c 
 b/drivers/scsi/ufs/ufshcd-pltfrm.c
 index 5e46232..9c94052 100644
 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c
 +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
 @@ -35,9 +35,23 @@
 
  #include linux/platform_device.h
  #include linux/pm_runtime.h
 +#include linux/of.h
 
  #include ufshcd.h
 
 +static const struct of_device_id ufs_of_match[];
 +static struct ufs_hba_variant_ops *get_variant_ops(struct device *dev)
 +{
 + if (dev-of_node) {
 + const struct of_device_id *match;
 + match = of_match_node(ufs_of_match, dev-of_node);
 + if (match)
 + return (struct ufs_hba_variant_ops *)match-data;
 + }
 +
 + return NULL;
 +}
 +
  #ifdef CONFIG_PM
  /**
   * ufshcd_pltfrm_suspend - suspend power management function
 @@ -150,10 +164,18 @@ static int ufshcd_pltfrm_probe(struct platform_device 
 *pdev)
   goto out;
   }
 
 + err = ufshcd_alloc_host(dev, hba);
 + if (err) {
 + dev_err(pdev-dev, Allocation failed\n);
 + goto out;
 + }
 +
 + hba-vops = get_variant_ops(pdev-dev);
 +
   pm_runtime_set_active(pdev-dev);
   pm_runtime_enable(pdev-dev);
 
 - err = ufshcd_init(dev, hba, mmio_base, irq);
 + err = ufshcd_init(hba, mmio_base, irq);
   if (err) {
   dev_err(dev, Intialization failed\n);
   goto out_disable_rpm;
 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
 index a0f5ac2..743696a 100644
 --- a/drivers/scsi/ufs/ufshcd.c
 +++ b/drivers/scsi/ufs/ufshcd.c
 @@ -174,13 +174,14 @@ static inline u32 ufshcd_get_ufs_version(struct ufs_hba 
 *hba)
  /**
   * ufshcd_is_device_present - Check if any device connected to
   * the host controller
 - * @reg_hcs - host controller status register value
 + * @hba: pointer to adapter instance
   *
   * Returns 1 if device present, 0 if no device detected
   */
 -static inline int ufshcd_is_device_present(u32 reg_hcs)
 +static inline int ufshcd_is_device_present(struct ufs_hba *hba)
  {
 - return (DEVICE_PRESENT  reg_hcs) ? 1 : 0;
 + return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) 
 + DEVICE_PRESENT) ? 1 : 0;
  }
 
  /**
 @@ -1483,11 +1484,10 @@ out:
   * @hba: per adapter instance
   *
   * To bring UFS host controller to operational state,
 - * 1. Check if device is present
 - * 2. Enable required interrupts
 - * 3. Configure interrupt aggregation
 - * 4. Program UTRL and UTMRL base addres
 - * 5. Configure run-stop-registers
 + * 1. Enable required interrupts
 + * 2. Configure interrupt aggregation
 + * 3. Program UTRL and UTMRL base addres
 + * 4. Configure run-stop-registers
   *
   * Returns 0 on success, non-zero value on failure
   */
 @@ -1496,14 +1496,6 @@ static int ufshcd_make_hba_operational(struct ufs_hba 
 *hba)
   int err = 0;
   u32 reg;
 
 - /* check if device present */
 - reg = ufshcd_readl(hba, REG_CONTROLLER_STATUS);
 - if (!ufshcd_is_device_present(reg)) {
 - dev_err(hba-dev, cc: Device not present\n);
 - err = -ENXIO;
 - goto out;
 - }
 -
   /* Enable required interrupts */
   ufshcd_enable_intr(hba, UFSHCD_ENABLE_INTRS);
 
 @@ -1524,6 +1516,7 @@ static int ufshcd_make_hba_operational(struct ufs_hba 
 *hba)
* UCRDY, UTMRLDY and 

[PATCH] scsi: ufs: export the helper functions for vender probe/remove

2013-09-09 Thread Seungwon Jeon
This change provides the common routines for driver's probe/remove.
Especially host driver including specific operations can invoke the
initial routine at the own probing phase and pass its operations to
ufshcd's common part.

Signed-off-by: Seungwon Jeon tgih@samsung.com
---
 drivers/scsi/ufs/ufshcd-pltfrm.c |   49 +++--
 drivers/scsi/ufs/ufshcd-pltfrm.h |   19 ++
 2 files changed, 55 insertions(+), 13 deletions(-)
 create mode 100644 drivers/scsi/ufs/ufshcd-pltfrm.h

diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index 9c94052..4900597 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -38,6 +38,7 @@
 #include linux/of.h
 
 #include ufshcd.h
+#include ufshcd-pltfrm.h
 
 static const struct of_device_id ufs_of_match[];
 static struct ufs_hba_variant_ops *get_variant_ops(struct device *dev)
@@ -137,12 +138,13 @@ static int ufshcd_pltfrm_runtime_idle(struct device *dev)
 #endif /* CONFIG_PM_RUNTIME */
 
 /**
- * ufshcd_pltfrm_probe - probe routine of the driver
+ * ufshcd_pltfrm_init - common routine for the driver's initialization
  * @pdev: pointer to Platform device handle
  *
  * Returns 0 on success, non-zero value on failure
  */
-static int ufshcd_pltfrm_probe(struct platform_device *pdev)
+int ufshcd_pltfrm_init(struct platform_device *pdev,
+  const struct ufs_hba_variant_ops *vops)
 {
struct ufs_hba *hba;
void __iomem *mmio_base;
@@ -166,14 +168,13 @@ static int ufshcd_pltfrm_probe(struct platform_device 
*pdev)
 
err = ufshcd_alloc_host(dev, hba);
if (err) {
-   dev_err(pdev-dev, Allocation failed\n);
+   dev_err(dev, Allocation failed\n);
goto out;
}
 
-   hba-vops = get_variant_ops(pdev-dev);
-
-   pm_runtime_set_active(pdev-dev);
-   pm_runtime_enable(pdev-dev);
+   hba-vops = vops;
+   pm_runtime_set_active(dev);
+   pm_runtime_enable(dev);
 
err = ufshcd_init(hba, mmio_base, irq);
if (err) {
@@ -186,24 +187,46 @@ static int ufshcd_pltfrm_probe(struct platform_device 
*pdev)
return 0;
 
 out_disable_rpm:
-   pm_runtime_disable(pdev-dev);
-   pm_runtime_set_suspended(pdev-dev);
+   pm_runtime_disable(dev);
+   pm_runtime_set_suspended(dev);
 out:
return err;
 }
+EXPORT_SYMBOL_GPL(ufshcd_pltfrm_init);
 
 /**
- * ufshcd_pltfrm_remove - remove platform driver routine
+ * ufshcd_pltfrm_exit - common routine for the driver's exit
  * @pdev: pointer to platform device handle
- *
- * Returns 0 on success, non-zero value on failure
  */
-static int ufshcd_pltfrm_remove(struct platform_device *pdev)
+void ufshcd_pltfrm_exit(struct platform_device *pdev)
 {
struct ufs_hba *hba =  platform_get_drvdata(pdev);
 
pm_runtime_get_sync((pdev)-dev);
ufshcd_remove(hba);
+}
+EXPORT_SYMBOL_GPL(ufshcd_pltfrm_exit);
+
+/**
+ * ufshcd_pltfrm_probe - probe the platform driver
+ * @pdev: pointer to Platform device handle
+ *
+ * Returns 0 on success, non-zero value on failure
+ */
+static int ufshcd_pltfrm_probe(struct platform_device *pdev)
+{
+   return ufshcd_pltfrm_init(pdev, get_variant_ops(pdev-dev));
+}
+
+/**
+ * ufshcd_pltfrm_remove - remove the platform driver
+ * @pdev: pointer to platform device handle
+ *
+ * Returns 0 on success, non-zero value on failure
+ */
+static int ufshcd_pltfrm_remove(struct platform_device *pdev)
+{
+   ufshcd_pltfrm_exit(pdev);
return 0;
 }
 
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.h b/drivers/scsi/ufs/ufshcd-pltfrm.h
new file mode 100644
index 000..6adab05
--- /dev/null
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.h
@@ -0,0 +1,19 @@
+/*
+ * Universal Flash Storage Host controller Platform bus based glue driver
+ *
+ * Copyright (C) 2013, Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * at your option) any later version.
+ */
+
+#ifndef _UFSHCD_PLTFRM_H_
+#define _UFSHCD_PLTFRM_H_
+
+extern int ufshcd_pltfrm_init(struct platform_device *pdev,
+ const struct ufs_hba_variant_ops *vops);
+extern void ufshcd_pltfrm_exit(struct platform_device *pdev);
+
+#endif /* _UFSHCD_PLTFRM_H_ */
-- 
1.7.0.4


--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [scsi] enclosure: remove all possible sysfs entries before add device

2013-09-09 Thread Christoph Hellwig
 Modules linked in: oracleacfs(P)(U) oracleadvm(P)(U) oracleoks(P)(U)

Please reproduce without this weird crap loaded.

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 17/18] lpfc 8.3.42: Fixed issue of task management commands having a fixed timeout

2013-09-09 Thread Jeremy Linton
On 9/8/2013 8:59 AM, James Smart wrote:

 The other issue - we seem to have missed your prior post. I'll look into it
 shortly.


Thanks,

Those patches were the result of various error injection test cases we 
were
performing. The ones that come to mind were, hung sequences, TM rejects,
failures to respond to the TM, etc.








--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [scsi] enclosure: remove all possible sysfs entries before add device

2013-09-09 Thread Brian King
On 09/09/2013 01:19 AM, Joe Jin wrote:
 When do disk pull/insert test we encountered below:
 
 WARNING: at fs/sysfs/dir.c:455 sysfs_add_one+0xbc/0xe0()
 Hardware name: SUN FIRE X4370 M2 SERVER
 sysfs: cannot create duplicate filename 
 '/devices/pci:00/:00:03.0/:0d:00.0/host6/port-6:1/expander-6:1/port-6:1:14/end_device-6:1:14/target6:0:27/6:0:27:0/enclosure_device:HDD10'
 Modules linked in: oracleacfs(P)(U) oracleadvm(P)(U) oracleoks(P)(U) mptctl 
 mptbase autofs4 hidp bluetooth rfkill lockd sunrpc bonding be2iscsi 
 iscsi_boot_sysfs ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr 
 iscsi_tcp bnx2i cnic uio ipv6 cxgb3i libcxgbi cxgb3 mdio libiscsi_tcp 
 libiscsi scsi_transport_iscsi dm_round_robin dm_multipath video sbs sbshc 
 acpi_pad acpi_memhotplug acpi_ipmi parport_pc lp parport ipmi_si ipmi_devintf 
 ipmi_msghandler sg ses enclosure ixgbe e1000e hwmon igb snd_seq_dummy 
 snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss 
 snd_mixer_oss snd_pcm snd_timer snd soundcore snd_page_alloc iTCO_wdt pcspkr 
 i2c_i801 ioatdma ghes iTCO_vendor_support hed dca i2c_core i7core_edac 
 edac_core dm_snapshot dm_zero dm_mirror dm_region_hash dm_log dm_mod 
 usb_storage shpchp mpt2sas scsi_transport_sas raid_class ahci libahci sd_mod 
 crc_t10dif raid1 ext3 jbd mbcache
 Pid: 23302, comm: kworker/u:2 Tainted: P2.6.39-400.124.1.el5uek #1
 Call Trace:
  [811daf8c] ? sysfs_add_one+0xbc/0xe0
  [8106f030] warn_slowpath_common+0x90/0xc0
  [8106f15e] warn_slowpath_fmt+0x6e/0x70
  [81258bd4] ? strlcat+0x54/0x70
  [811daf8c] sysfs_add_one+0xbc/0xe0
  [811dbec8] sysfs_do_create_link+0x148/0x1d0
  [811dbf83] sysfs_create_link+0x13/0x20
  [a00de307] enclosure_add_links+0xe7/0x110 [enclosure]
  [8125325d] ? kobject_release+0xd/0x10
  [812549e7] ? kref_put+0x37/0x70
  [a00de3c3] enclosure_add_device+0x93/0xa0 [enclosure]
  [a00c8666] ses_enclosure_find_by_addr+0x76/0xc0 [ses]
  [a00c85f0] ? ses_get_fault+0x40/0x40 [ses]
  [a00de433] enclosure_for_each_device+0x63/0x90 [enclosure]
  [a00c8a8a] ses_match_to_enclosure+0x11a/0x1d0 [ses]
  [a00c8e08] ses_intf_add+0x2c8/0x5c0 [ses]
  [8125327a] ? kobject_get+0x1a/0x30
  [814e8b56] ? add_tail+0x36/0x50
  [81345ae4] device_add+0x2d4/0x380
  [8136b096] scsi_sysfs_add_sdev+0xe6/0x2a0
  [813682cc] scsi_add_lun+0x41c/0x560
  [81368a80] scsi_probe_and_add_lun+0x1e0/0x3e0
  [81041009] ? default_spin_lock_flags+0x9/0x10
  [813696e7] __scsi_scan_target+0xe7/0x120
  [81369b8d] scsi_scan_target+0xcd/0xf0
  [a003faab] sas_rphy_add+0x11b/0x170 [scsi_transport_sas]
  [a009a74f] mpt2sas_transport_port_add+0x2cf/0x430 [mpt2sas]
  [a008d437] _scsih_sas_device_add+0x87/0x110 [mpt2sas]
  [a0094eb8] _scsih_add_device+0x248/0x340 [mpt2sas]
  [a0098cb1] ? mpt2sas_transport_update_links+0xf1/0x190 [mpt2sas]
  [a00977b6] _scsih_sas_topology_change_event+0x3c6/0x490 [mpt2sas]
  [81080698] ? add_timer+0x18/0x20
  [8108a405] ? queue_delayed_work_on+0xc5/0x170
  [a0097a85] _mpt2sas_fw_work+0x205/0x240 [mpt2sas]
  [a0097ad9] _firmware_event_work_delayed+0x19/0x20 [mpt2sas]
  [8108c0d9] process_one_work+0xf9/0x370
  [a0097ac0] ? _mpt2sas_fw_work+0x240/0x240 [mpt2sas]
  [8108ca1a] worker_thread+0xca/0x240
  [8108c950] ? manage_workers+0x90/0x90
  [81090ff7] kthread+0x97/0xa0
  [8150fdc4] kernel_thread_helper+0x4/0x10
  [81090f60] ? kthread_bind+0x80/0x80
  [8150fdc0] ? gs_change+0x13/0x13
 ---[ end trace 89a1351702ab360f ]---
 
 During our test, multipath used, each LUN has 2 paths. when adding second
 path enclousure did not check if will adding device's symlink existed or no.
 
 Cc: James Bottomley james.bottom...@hansenpartnership.com
 Signed-off-by: Joe Jin joe@oracle.com
 ---
  drivers/misc/enclosure.c | 7 +++
  1 file changed, 7 insertions(+)
 
 diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
 index 0e8df41..efc0e86 100644
 --- a/drivers/misc/enclosure.c
 +++ b/drivers/misc/enclosure.c
 @@ -325,6 +325,13 @@ int enclosure_add_device(struct enclosure_device *edev, 
 int component,
   if (cdev-dev)
   enclosure_remove_links(cdev);
 
 + if (dev) {
 + char name[ENCLOSURE_NAME_SIZE];
 +
 + enclosure_link_name(cdev, name);
 + sysfs_remove_link(dev-kobj, name);
 + }
 +
   put_device(cdev-dev);
   cdev-dev = get_device(dev);
   return enclosure_add_links(cdev);
 

We've been looking at a similar issue with SAS multipath using the ipr driver.

Wendy, does this patch fix the issue you are seeing as well or is this a 
different
issue?

Thanks,

Brian

-- 
Brian King
Power Linux I/O
IBM Linux Technology Center


--
To unsubscribe from this 

Re:Very Urgent!!!

2013-09-09 Thread Doris Omar
Greetings from BURKINA FASO:
Let me start by introduce myself,I am Mrs Doris Omar, BILL AND EXCHANGE MANAGER 
(Bank of Africa) Ouagadougou, Burkina Faso.I am writting you this letter based 
on the latest development at our bank which I will like to bring to your 
personal edification. $12,250million transfer claims. this is a legitimate 
transaction and I agreed to offer you 40% of this money as my foreign partner 
after confirmation of the fund in your bank account,If you are interested, 
please get back to me for more clarification.

Yours faithful,
Mrs Doris Omar.
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/9] fnic: On system with 1.1TB RAM, VIC fails multipath after boot up

2013-09-09 Thread Hiral Patel
From: Brian Uchino buch...@cisco.com

Issue was seen when SCSI buffer address is more than 40 bits in system
with more than 1.1TB RAM. When SCSI buffer is passed to VIC, it is failing
to map to correct buffer address, as DMA mask is set to 40 bits in driver
initialization. Corrected DMA_MASK from 40-bits to 64-bits to avoid masking
41-64 bits addresses.

Signed-off-by: Brian Uchino buch...@cisco.com
Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic_main.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index b619dab..835a9cd 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -581,10 +581,10 @@ static int fnic_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
pci_set_master(pdev);
 
/* Query PCI controller on system for DMA addressing
-* limitation for the device.  Try 40-bit first, and
+* limitation for the device.  Try 64-bit first, and
 * fail to 32-bit.
 */
-   err = pci_set_dma_mask(pdev, DMA_BIT_MASK(40));
+   err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
if (err) {
err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (err) {
@@ -601,10 +601,10 @@ static int fnic_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
goto err_out_release_regions;
}
} else {
-   err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(40));
+   err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
if (err) {
shost_printk(KERN_ERR, fnic-lport-host,
-Unable to obtain 40-bit DMA 
+Unable to obtain 64-bit DMA 
 for consistent allocations, aborting.\n);
goto err_out_release_regions;
}
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/9] fnic: host reset returns nonzero value(errno) on success

2013-09-09 Thread Hiral Patel
From: Narsimhulu Musini nmus...@cisco.com

Fixed appropriate error codes that returns -1 on failure, and 0 on success

Signed-off-by: Narsimhulu Musini nmus...@cisco.com
Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic_scsi.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index a97e6e5..ef3c463 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -2208,7 +2208,7 @@ int fnic_reset(struct Scsi_Host *shost)
 {
struct fc_lport *lp;
struct fnic *fnic;
-   int ret = SUCCESS;
+   int ret = 0;
 
lp = shost_priv(shost);
fnic = lport_priv(lp);
@@ -2221,11 +2221,11 @@ int fnic_reset(struct Scsi_Host *shost)
 * reset remote port sessions, and if link is up, begin flogi
 */
if (lp-tt.lport_reset(lp))
-   ret = FAILED;
+   ret = -1;
 
FNIC_SCSI_DBG(KERN_DEBUG, fnic-lport-host,
  Returning from fnic reset %s\n,
- (ret == SUCCESS) ?
+ (ret == 0) ?
  SUCCESS : FAILED);
 
return ret;
@@ -2252,7 +2252,7 @@ int fnic_host_reset(struct scsi_cmnd *sc)
 * scsi-ml tries to send a TUR to every device if host reset is
 * successful, so before returning to scsi, fabric should be up
 */
-   ret = fnic_reset(shost);
+   ret = (fnic_reset(shost) == 0) ? SUCCESS : FAILED;
if (ret == SUCCESS) {
wait_host_tmo = jiffies + FNIC_HOST_RESET_SETTLE_TIME * HZ;
ret = FAILED;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/9] fnic: Hitting BUG_ON(io_req-abts_done) in fnic_rport_exch_reset

2013-09-09 Thread Hiral Patel
From: Sesidhar Beddel sebad...@cisco.com

Hitting BUG_ON(io_req-abts_done) in fnic_rport_exch_reset in case of
timing issue and also to some extent locking issue where abts and terminate
is happening around same timing.

The code changes are intended to update CMD_STATE(sc) and
io_req-abts_done together.

Signed-off-by: Sesidhar Beddel sebad...@cisco.com
Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic_scsi.c |   70 -
 1 file changed, 42 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index a09dd8d..100cdba 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -111,6 +111,12 @@ static inline spinlock_t *fnic_io_lock_hash(struct fnic 
*fnic,
return fnic-io_req_lock[hash];
 }
 
+static inline spinlock_t *fnic_io_lock_tag(struct fnic *fnic,
+   int tag)
+{
+   return fnic-io_req_lock[tag  (FNIC_IO_LOCKS - 1)];
+}
+
 /*
  * Unmap the data buffer and sense buffer for an io_req,
  * also unmap and free the device-private scatter/gather list.
@@ -956,9 +962,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
spin_unlock_irqrestore(io_lock, flags);
return;
}
-   CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE;
CMD_ABTS_STATUS(sc) = hdr_status;
-
CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_DONE;
FNIC_SCSI_DBG(KERN_DEBUG, fnic-lport-host,
  abts cmpl recd. id %d status %s\n,
@@ -1116,7 +1120,7 @@ int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int 
copy_work_to_do)
 
 static void fnic_cleanup_io(struct fnic *fnic, int exclude_id)
 {
-   unsigned int i;
+   int i;
struct fnic_io_req *io_req;
unsigned long flags = 0;
struct scsi_cmnd *sc;
@@ -1127,12 +1131,14 @@ static void fnic_cleanup_io(struct fnic *fnic, int 
exclude_id)
if (i == exclude_id)
continue;
 
+   io_lock = fnic_io_lock_tag(fnic, i);
+   spin_lock_irqsave(io_lock, flags);
sc = scsi_host_find_tag(fnic-lport-host, i);
-   if (!sc)
+   if (!sc) {
+   spin_unlock_irqrestore(io_lock, flags);
continue;
+   }
 
-   io_lock = fnic_io_lock_hash(fnic, sc);
-   spin_lock_irqsave(io_lock, flags);
io_req = (struct fnic_io_req *)CMD_SP(sc);
if ((CMD_FLAGS(sc)  FNIC_DEVICE_RESET) 
!(CMD_FLAGS(sc)  FNIC_DEV_RST_DONE)) {
@@ -1310,12 +1316,13 @@ static void fnic_rport_exch_reset(struct fnic *fnic, 
u32 port_id)
 
for (tag = 0; tag  FNIC_MAX_IO_REQ; tag++) {
abt_tag = tag;
+   io_lock = fnic_io_lock_tag(fnic, tag);
+   spin_lock_irqsave(io_lock, flags);
sc = scsi_host_find_tag(fnic-lport-host, tag);
-   if (!sc)
+   if (!sc) {
+   spin_unlock_irqrestore(io_lock, flags);
continue;
-
-   io_lock = fnic_io_lock_hash(fnic, sc);
-   spin_lock_irqsave(io_lock, flags);
+   }
 
io_req = (struct fnic_io_req *)CMD_SP(sc);
 
@@ -1426,16 +1433,19 @@ void fnic_terminate_rport_io(struct fc_rport *rport)
 
for (tag = 0; tag  FNIC_MAX_IO_REQ; tag++) {
abt_tag = tag;
+   io_lock = fnic_io_lock_tag(fnic, tag);
+   spin_lock_irqsave(io_lock, flags);
sc = scsi_host_find_tag(fnic-lport-host, tag);
-   if (!sc)
+   if (!sc) {
+   spin_unlock_irqrestore(io_lock, flags);
continue;
+   }
 
cmd_rport = starget_to_rport(scsi_target(sc-device));
-   if (rport != cmd_rport)
+   if (rport != cmd_rport) {
+   spin_unlock_irqrestore(io_lock, flags);
continue;
-
-   io_lock = fnic_io_lock_hash(fnic, sc);
-   spin_lock_irqsave(io_lock, flags);
+   }
 
io_req = (struct fnic_io_req *)CMD_SP(sc);
 
@@ -1648,13 +1658,15 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
io_req-abts_done = NULL;
 
/* fw did not complete abort, timed out */
-   if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) {
+   if (CMD_ABTS_STATUS(sc) == FCPIO_INVALID_CODE) {
spin_unlock_irqrestore(io_lock, flags);
CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_TIMED_OUT;
ret = FAILED;
goto fnic_abort_cmd_end;
}
 
+   CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE;
+
/*
 * firmware completed the abort, check the status,
 * free the io_req irrespective of failure or success
@@ 

[PATCH 9/9] fnic: Incremented driver version

2013-09-09 Thread Hiral Patel
Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index db7a950..528d43b 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@
 
 #define DRV_NAME   fnic
 #define DRV_DESCRIPTIONCisco FCoE HBA Driver
-#define DRV_VERSION1.5.0.23
+#define DRV_VERSION1.5.0.45
 #define PFXDRV_NAME : 
 #define DFX DRV_NAME %d: 
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9] fnic: Kernel panic while running sh/nosh with max lun cfg

2013-09-09 Thread Hiral Patel
From: Sesidhar Beddel sebad...@cisco.com

Kernel panics due to NULL lport while executing the log message because
of synchronization issues between libfc and scsi transport fc. Checking
for NULL pointers at the beginning of this routine would resolve the issue
from kernel panic point of view.

Signed-off-by: Sesidhar Baddel sebad...@cisco.com
Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic_scsi.c |   23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 100cdba..b1d1921 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -1416,12 +1416,29 @@ void fnic_terminate_rport_io(struct fc_rport *rport)
unsigned long flags;
struct scsi_cmnd *sc;
struct scsi_lun fc_lun;
-   struct fc_rport_libfc_priv *rdata = rport-dd_data;
-   struct fc_lport *lport = rdata-local_port;
-   struct fnic *fnic = lport_priv(lport);
+   struct fc_rport_libfc_priv *rdata;
+   struct fc_lport *lport;
+   struct fnic *fnic;
struct fc_rport *cmd_rport;
enum fnic_ioreq_state old_ioreq_state;
 
+   if (!rport) {
+   printk(KERN_ERR fnic_terminate_rport_io: rport is NULL\n);
+   return;
+   }
+   rdata = rport-dd_data;
+
+   if (!rdata) {
+   printk(KERN_ERR fnic_terminate_rport_io: rdata is NULL\n);
+   return;
+   }
+   lport = rdata-local_port;
+
+   if (!lport) {
+   printk(KERN_ERR fnic_terminate_rport_io: lport is NULL\n);
+   return;
+   }
+   fnic = lport_priv(lport);
FNIC_SCSI_DBG(KERN_DEBUG,
  fnic-lport-host, fnic_terminate_rport_io called
   wwpn 0x%llx, wwnn0x%llx, rport 0x%p, portid 0x%06x\n,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/9] fnic: FC stat param seconds_since_last_reset not getting updated

2013-09-09 Thread Hiral Patel
From: Narsimhulu Musini nmus...@cisco.com

Code to reset fc_host statistics.
echo 1  /sys/class/fc_host/hostX/statistics/reset_statistics clears fc_host 
stats,
the code also issues command to fnic firmware to clear vnic stats.

Signed-off-by: Narsimhulu Musini nmus...@cisco.com
Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic.h  |5 ++
 drivers/scsi/fnic/fnic_main.c |  108 -
 2 files changed, 112 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index c18c681..d276aaf 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -154,6 +154,9 @@ do {
\
FNIC_CHECK_LOGGING(FNIC_ISR_LOGGING,\
 shost_printk(kern_level, host, fmt, ##args);)
 
+#define FNIC_MAIN_NOTE(kern_level, host, fmt, args...)  \
+   shost_printk(kern_level, host, fmt, ##args)
+
 extern const char *fnic_state_str[];
 
 enum fnic_intx_intr_index {
@@ -215,6 +218,7 @@ struct fnic {
 
struct vnic_stats *stats;
unsigned long stats_time;   /* time of stats update */
+   unsigned long stats_reset_time; /* time of stats reset */
struct vnic_nic_cfg *nic_cfg;
char name[IFNAMSIZ];
struct timer_list notify_timer; /* used for MSI interrupts */
@@ -359,4 +363,5 @@ fnic_chk_state_flags_locked(struct fnic *fnic, unsigned 
long st_flags)
return ((fnic-state_flags  st_flags) == st_flags);
 }
 void __fnic_set_state_flags(struct fnic *, unsigned long, unsigned long);
+void fnic_dump_fchost_stats(struct Scsi_Host *, struct fc_host_statistics *);
 #endif /* _FNIC_H_ */
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 42e15ee..b619dab 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -126,6 +126,7 @@ fnic_set_rport_dev_loss_tmo(struct fc_rport *rport, u32 
timeout)
 static void fnic_get_host_speed(struct Scsi_Host *shost);
 static struct scsi_transport_template *fnic_fc_transport;
 static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *);
+static void fnic_reset_host_stats(struct Scsi_Host *);
 
 static struct fc_function_template fnic_fc_functions = {
 
@@ -153,6 +154,7 @@ static struct fc_function_template fnic_fc_functions = {
.set_rport_dev_loss_tmo = fnic_set_rport_dev_loss_tmo,
.issue_fc_host_lip = fnic_reset,
.get_fc_host_stats = fnic_get_stats,
+   .reset_fc_host_stats = fnic_reset_host_stats,
.dd_fcrport_size = sizeof(struct fc_rport_libfc_priv),
.terminate_rport_io = fnic_terminate_rport_io,
.bsg_request = fc_lport_bsg_request,
@@ -206,13 +208,116 @@ static struct fc_host_statistics *fnic_get_stats(struct 
Scsi_Host *host)
stats-error_frames = vs-tx.tx_errors + vs-rx.rx_errors;
stats-dumped_frames = vs-tx.tx_drops + vs-rx.rx_drop;
stats-invalid_crc_count = vs-rx.rx_crc_errors;
-   stats-seconds_since_last_reset = (jiffies - lp-boot_time) / HZ;
+   stats-seconds_since_last_reset =
+   (jiffies - fnic-stats_reset_time) / HZ;
stats-fcp_input_megabytes = div_u64(fnic-fcp_input_bytes, 100);
stats-fcp_output_megabytes = div_u64(fnic-fcp_output_bytes, 100);
 
return stats;
 }
 
+/*
+ * fnic_dump_fchost_stats
+ * note : dumps fc_statistics into system logs
+ */
+void fnic_dump_fchost_stats(struct Scsi_Host *host,
+   struct fc_host_statistics *stats)
+{
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   fnic: seconds since last reset = %llu\n,
+   stats-seconds_since_last_reset);
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   fnic: tx frames= %llu\n,
+   stats-tx_frames);
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   fnic: tx words = %llu\n,
+   stats-tx_words);
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   fnic: rx frames= %llu\n,
+   stats-rx_frames);
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   fnic: rx words = %llu\n,
+   stats-rx_words);
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   fnic: lip count= %llu\n,
+   stats-lip_count);
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   fnic: nos count= %llu\n,
+   stats-nos_count);
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   fnic: error frames = %llu\n,
+   stats-error_frames);
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   fnic: dumped frames= %llu\n,
+   stats-dumped_frames);
+   FNIC_MAIN_NOTE(KERN_NOTICE, host,
+   

[PATCH 7/9] fnic: fnic Driver Tuneables Exposed through CLI

2013-09-09 Thread Hiral Patel
Introduced module params to provide dynamic way of configuring
queue depth.

Added support to get max io throttle count through UCSM to
configure maximum outstanding IOs supported by fnic and push
that value to scsi mid-layer.

  Supported IO throttle values:

  UCSM IO THROTTLE VALUEFNIC MAX OUTSTANDING IOS
  --
16 (Default)2048
= 256  256
 256   ucsm value

Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic.h  |3 +++
 drivers/scsi/fnic/fnic_main.c |   29 +
 drivers/scsi/fnic/fnic_scsi.c |   16 
 drivers/scsi/fnic/vnic_scsi.h |4 ++--
 4 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index d276aaf..e4dd3d7 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -43,6 +43,8 @@
 #define DFX DRV_NAME %d: 
 
 #define DESC_CLEAN_LOW_WATERMARK 8
+#define FNIC_UCSM_DFLT_THROTTLE_CNT_BLD16 /* UCSM default throttle 
count */
+#define FNIC_MIN_IO_REQ256 /* Min IO throttle count */
 #define FNIC_MAX_IO_REQ2048 /* scsi_cmnd tag map entries */
 #defineFNIC_IO_LOCKS   64 /* IO locks: power of 2 */
 #define FNIC_DFLT_QUEUE_DEPTH  32
@@ -223,6 +225,7 @@ struct fnic {
char name[IFNAMSIZ];
struct timer_list notify_timer; /* used for MSI interrupts */
 
+   unsigned int fnic_max_tag_id;
unsigned int err_intr_offset;
unsigned int link_intr_offset;
 
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 835a9cd..bbf81ea 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -74,6 +74,10 @@ module_param(fnic_trace_max_pages, uint, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(fnic_trace_max_pages, Total allocated memory pages 
for fnic trace buffer);
 
+static unsigned int fnic_max_qdepth = FNIC_DFLT_QUEUE_DEPTH;
+module_param(fnic_max_qdepth, uint, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(fnic_max_qdepth, Queue depth to report for each LUN);
+
 static struct libfc_function_template fnic_transport_template = {
.frame_send = fnic_send,
.lport_set_port_id = fnic_set_port_id,
@@ -91,7 +95,7 @@ static int fnic_slave_alloc(struct scsi_device *sdev)
if (!rport || fc_remote_port_chkready(rport))
return -ENXIO;
 
-   scsi_activate_tcq(sdev, FNIC_DFLT_QUEUE_DEPTH);
+   scsi_activate_tcq(sdev, fnic_max_qdepth);
return 0;
 }
 
@@ -552,13 +556,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
 
host-transportt = fnic_fc_transport;
 
-   err = scsi_init_shared_tag_map(host, FNIC_MAX_IO_REQ);
-   if (err) {
-   shost_printk(KERN_ERR, fnic-lport-host,
-Unable to alloc shared tag map\n);
-   goto err_out_free_hba;
-   }
-
/* Setup PCI resources */
pci_set_drvdata(pdev, fnic);
 
@@ -671,6 +668,22 @@ static int fnic_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
 aborting.\n);
goto err_out_dev_close;
}
+
+   /* Configure Maximum Outstanding IO reqs*/
+   if (fnic-config.io_throttle_count != FNIC_UCSM_DFLT_THROTTLE_CNT_BLD) {
+   host-can_queue = min_t(u32, FNIC_MAX_IO_REQ,
+   max_t(u32, FNIC_MIN_IO_REQ,
+   fnic-config.io_throttle_count));
+   }
+   fnic-fnic_max_tag_id = host-can_queue;
+
+   err = scsi_init_shared_tag_map(host, fnic-fnic_max_tag_id);
+   if (err) {
+   shost_printk(KERN_ERR, fnic-lport-host,
+ Unable to alloc shared tag map\n);
+   goto err_out_dev_close;
+   }
+
host-max_lun = fnic-config.luns_per_tgt;
host-max_id = FNIC_MAX_FCP_TARGET;
host-max_cmd_len = FCOE_MAX_CMD_LEN;
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index b1d1921..fdb2b8b 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -736,7 +736,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
fcpio_tag_id_dec(tag, id);
icmnd_cmpl = desc-u.icmnd_cmpl;
 
-   if (id = FNIC_MAX_IO_REQ) {
+   if (id = fnic-fnic_max_tag_id) {
shost_printk(KERN_ERR, fnic-lport-host,
Tag out of range tag %x hdr status = %s\n,
 id, fnic_fcpio_status_to_str(hdr_status));
@@ -913,7 +913,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
fcpio_header_dec(desc-hdr, type, hdr_status, tag);
fcpio_tag_id_dec(tag, id);
 
-   if ((id  FNIC_TAG_MASK) = FNIC_MAX_IO_REQ) {
+   

[PATCH 4/9] fnic: Remove QUEUE_FULL handling code

2013-09-09 Thread Hiral Patel
From: Suma Ramars sram...@cisco.com

Remove fnic driver QUEUE_FULL handling code instead let SCSI mid layer
handle queue full and use its algorithm to ramp down/up queue

Signed-off-by: Suma Ramars sram...@cisco.com
Signed-off-by: Hiral Patel hiral...@cisco.com
---
 drivers/scsi/fnic/fnic_scsi.c |   32 
 1 file changed, 32 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index ef3c463..a09dd8d 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -818,38 +818,6 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic 
*fnic,
if (icmnd_cmpl-flags  FCPIO_ICMND_CMPL_RESID_UNDER)
xfer_len -= icmnd_cmpl-residual;
 
-   /*
-* If queue_full, then try to reduce queue depth for all
-* LUNS on the target. Todo: this should be accompanied
-* by a periodic queue_depth rampup based on successful
-* IO completion.
-*/
-   if (icmnd_cmpl-scsi_status == QUEUE_FULL) {
-   struct scsi_device *t_sdev;
-   int qd = 0;
-
-   shost_for_each_device(t_sdev, sc-device-host) {
-   if (t_sdev-id != sc-device-id)
-   continue;
-
-   if (t_sdev-queue_depth  1) {
-   qd = scsi_track_queue_full
-   (t_sdev,
-t_sdev-queue_depth - 1);
-   if (qd == -1)
-   qd = t_sdev-host-cmd_per_lun;
-   shost_printk(KERN_INFO,
-fnic-lport-host,
-scsi[%d:%d:%d:%d
-] queue full detected,
-new depth = %d\n,
-t_sdev-host-host_no,
-t_sdev-channel,
-t_sdev-id, t_sdev-lun,
-t_sdev-queue_depth);
-   }
-   }
-   }
break;
 
case FCPIO_TIMEOUT:  /* request was timed out */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [scsi] enclosure: remove all possible sysfs entries before add device

2013-09-09 Thread Joe Jin
On 09/09/13 21:41, Christoph Hellwig wrote:
 Modules linked in: oracleacfs(P)(U) oracleadvm(P)(U) oracleoks(P)(U)
 
 Please reproduce without this weird crap loaded.
 
These modules is filesystem and will not impact enclosure.

Thanks,
Joe




--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/8] IB SRP initiator patches for kernel 3.12

2013-09-09 Thread David Dillow
On Tue, 2013-08-20 at 14:41 +0200, Bart Van Assche wrote:
 Changes since the previous patch series are:
 - Rewrote the srp_tmo_valid() to improve readability (requested by Dave
Dillow).
 - The combination (reconnect_delay  0  fast_io_fail_tmo  0 
dev_loss_tmo  0) is now rejected as requested by Dave Dillow.
 - Fixed a race between transport layer failure handling and device
removal. This issue was reported by Vu Pham.

For patches 1-6,

Acked-by: David Dillow dillo...@ornl.gov
-- 
Dave Dillow
National Center for Computational Science
Oak Ridge National Laboratory
(865) 241-6602 office


--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html