[Bug 101371] OOPS: unplugging western digital passport drive

2015-07-20 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=101371

--- Comment #2 from Ilan Cohen  ---
Hi Joe,

I applied the patch Alan posted to kernel 4.0.8 and the crash does not occur
anymore.

Regards,

Ilan Cohen

-- 
You are receiving this mail because:
You are the assignee for the bug.
--
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 V3 10/10] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_exact()

2015-07-20 Thread Tomas Henzl
On 8.7.2015 01:16, rajinikanth.panduran...@pmcs.com wrote:
> From: Rajinikanth Pandurangan 
> 
> Description:
>   As pci_enable_msix() deprecated, replaced with pci_enable_msix_exact()
> 
> Changes from V2:
>  Newly created for V3 based on review comment.
> 
> Signed-off-by: Rajinikanth Pandurangan 
> ---
>  drivers/scsi/aacraid/comminit.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

> 
> diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
> index b4b6088..e4ff47e 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -366,7 +366,7 @@ void aac_define_int_mode(struct aac_dev *dev)
>  
>   if (msi_count > 1 &&
>   pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
> - i = pci_enable_msix(dev->pdev,
> + i = pci_enable_msix_exact(dev->pdev,
>   dev->msixentry,
>   msi_count);
>/* Check how many MSIX vectors are allocated */
> @@ -374,7 +374,7 @@ void aac_define_int_mode(struct aac_dev *dev)
>   dev->msi_enabled = 1;
>   if (i) {
Hi Rajinikanth,
the pci_enable_msix_exact is not a 1;1 replacement for pci_enable_msix,
you shouldn't use it this way - it never returns a positive value.
What you probably want is to use pci_enable_msix_range

Cheers,
Tomas

>   msi_count = i;
> - if (pci_enable_msix(dev->pdev,
> + if (pci_enable_msix_exact(dev->pdev,
>   dev->msixentry,
>   msi_count)) {
>   dev->msi_enabled = 0;
> 

--
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/2] target: remove unused lun_flags field from se_lun

2015-07-20 Thread Spencer Baugh
From: Spencer Baugh 

From: Chris Zankel 

The lun_flags field is not used, so drop it.

Signed-off-by: Chris Zankel 
---
 include/target/target_core_base.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/target/target_core_base.h 
b/include/target/target_core_base.h
index 17ae2d6..0a7c44e 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -685,7 +685,6 @@ struct se_lun {
 #define SE_LUN_LINK_MAGIC  0x7771
u32 lun_link_magic;
u32 lun_access;
-   u32 lun_flags;
u32 lun_index;
 
/* RELATIVE TARGET PORT IDENTIFER */
-- 
2.4.3

--
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/2] target: remove initiatorname field in se_acl_lun

2015-07-20 Thread Spencer Baugh
From: Spencer Baugh 

From: Chris Zankel 

The initiatorname field in se_acl_lun is only a copy of the same field
in se_node_acl, so remove it and use the version in se_node_acl where
needed (it's actually only used for pr_debug)

Signed-off-by: Chris Zankel 
---
 drivers/target/target_core_device.c  | 8 +++-
 drivers/target/target_core_fabric_configfs.c | 2 +-
 include/target/target_core_base.h| 1 -
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/target/target_core_device.c 
b/drivers/target/target_core_device.c
index 09e682b..c4a8db6 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -620,8 +620,6 @@ struct se_lun_acl *core_dev_init_initiator_node_lun_acl(
 
lacl->mapped_lun = mapped_lun;
lacl->se_lun_nacl = nacl;
-   snprintf(lacl->initiatorname, TRANSPORT_IQN_LEN, "%s",
-nacl->initiatorname);
 
return lacl;
 }
@@ -656,7 +654,7 @@ int core_dev_add_initiator_node_lun_acl(
" InitiatorNode: %s\n", tpg->se_tpg_tfo->get_fabric_name(),
tpg->se_tpg_tfo->tpg_get_tag(tpg), lun->unpacked_lun, 
lacl->mapped_lun,
(lun_access & TRANSPORT_LUNFLAGS_READ_WRITE) ? "RW" : "RO",
-   lacl->initiatorname);
+   nacl->initiatorname);
/*
 * Check to see if there are any existing persistent reservation APTPL
 * pre-registrations that need to be enabled for this LUN ACL..
@@ -688,7 +686,7 @@ int core_dev_del_initiator_node_lun_acl(
" InitiatorNode: %s Mapped LUN: %llu\n",
tpg->se_tpg_tfo->get_fabric_name(),
tpg->se_tpg_tfo->tpg_get_tag(tpg), lun->unpacked_lun,
-   lacl->initiatorname, lacl->mapped_lun);
+   nacl->initiatorname, lacl->mapped_lun);
 
return 0;
 }
@@ -701,7 +699,7 @@ void core_dev_free_initiator_node_lun_acl(
" Mapped LUN: %llu\n", tpg->se_tpg_tfo->get_fabric_name(),
tpg->se_tpg_tfo->tpg_get_tag(tpg),
tpg->se_tpg_tfo->get_fabric_name(),
-   lacl->initiatorname, lacl->mapped_lun);
+   lacl->se_lun_nacl->initiatorname, lacl->mapped_lun);
 
kfree(lacl);
 }
diff --git a/drivers/target/target_core_fabric_configfs.c 
b/drivers/target/target_core_fabric_configfs.c
index 48a3698..be42429 100644
--- a/drivers/target/target_core_fabric_configfs.c
+++ b/drivers/target/target_core_fabric_configfs.c
@@ -203,7 +203,7 @@ static ssize_t target_fabric_mappedlun_store_write_protect(
pr_debug("%s_ConfigFS: Changed Initiator ACL: %s"
" Mapped LUN: %llu Write Protect bit to %s\n",
se_tpg->se_tpg_tfo->get_fabric_name(),
-   lacl->initiatorname, lacl->mapped_lun, (op) ? "ON" : "OFF");
+   se_nacl->initiatorname, lacl->mapped_lun, (op) ? "ON" : "OFF");
 
return count;
 
diff --git a/include/target/target_core_base.h 
b/include/target/target_core_base.h
index 0a7c44e..b59b61a 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -598,7 +598,6 @@ struct se_ml_stat_grps {
 };
 
 struct se_lun_acl {
-   charinitiatorname[TRANSPORT_IQN_LEN];
u64 mapped_lun;
struct se_node_acl  *se_lun_nacl;
struct se_lun   *se_lun;
-- 
2.4.3

--
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 V3 10/10] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_exact()

2015-07-20 Thread Rajinikanth Pandurangan
Thanks for the comment Tomas.  I'll submit another patch with range.


-Original Message-
From: Tomas Henzl [mailto:the...@redhat.com] 
Sent: Monday, July 20, 2015 8:54 AM
To: Rajinikanth Pandurangan; jbottom...@parallels.com; 
linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat
Subject: Re: [PATCH V3 10/10] [SCSI] aacraid: Replace pci_enable_msix() with 
pci_enable_msix_exact()

On 8.7.2015 01:16, rajinikanth.panduran...@pmcs.com wrote:
> From: Rajinikanth Pandurangan 
> 
> Description:
>   As pci_enable_msix() deprecated, replaced with 
> pci_enable_msix_exact()
> 
> Changes from V2:
>  Newly created for V3 based on review comment.
> 
> Signed-off-by: Rajinikanth Pandurangan 
> 
> ---
>  drivers/scsi/aacraid/comminit.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

> 
> diff --git a/drivers/scsi/aacraid/comminit.c 
> b/drivers/scsi/aacraid/comminit.c index b4b6088..e4ff47e 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -366,7 +366,7 @@ void aac_define_int_mode(struct aac_dev *dev)
>  
>   if (msi_count > 1 &&
>   pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
> - i = pci_enable_msix(dev->pdev,
> + i = pci_enable_msix_exact(dev->pdev,
>   dev->msixentry,
>   msi_count);
>/* Check how many MSIX vectors are allocated */ @@ -374,7 
> +374,7 
> @@ void aac_define_int_mode(struct aac_dev *dev)
>   dev->msi_enabled = 1;
>   if (i) {
Hi Rajinikanth,
the pci_enable_msix_exact is not a 1;1 replacement for pci_enable_msix, you 
shouldn't use it this way - it never returns a positive value.
What you probably want is to use pci_enable_msix_range

Cheers,
Tomas

>   msi_count = i;
> - if (pci_enable_msix(dev->pdev,
> + if (pci_enable_msix_exact(dev->pdev,
>   dev->msixentry,
>   msi_count)) {
>   dev->msi_enabled = 0;
> 

--
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 resend] libsas: fix "sysfs group not found" warnings at port teardown time

2015-07-20 Thread Dan Williams
Praveen reports:

After some debugging this is what I have found

sas_phye_loss_of_signal gets triggered on phy_event from mvsas
sas_phye_loss_of_signal calls sas_deform_port
 sas_deform_port posts a DISCE_DESTRUCT event 
(sas_unregister_domain_devices-> sas_unregister_dev)
 sas_deform_port calls sas_port_delete
 sas_port_delete calls sas_port_delete_link
 sysfs_remove_group: kobject 'port-X:Y'
 sas_port_delete calls device_del
 sysfs_remove_group: kobject 'port-X:Y'

sas_destruct_devices gets triggered for the destruct event (DISCE_DESTRUCT)
sas_destruct_devices calls sas_rphy_delete
sas_rphy_delete calls scsi_remove_device
 scsi_remove_device calls __scsi_remove_device
 __scsi_remove_device calls bsg_unregister_queue
 bsg_unregister_queue -> device_unregister -> 
device_del -> sysfs_remove_group: kobject 'X:0:0:0'

Since X:0:0:0 falls under port-X:Y (which got deleted during
sas_port_delete), this call results in the warning. All the later
warnings in the dmesg output I sent earlier are trying to delete objects
under port-X:Y. Since port-X:Y got recursively deleted, all these calls
result in warnings. Since, the PHY and DISC events are processed in two
different work queues (and one triggers the other), is there any way
other than checking if the object exists in sysfs (in device_del) before
deleting?

WARNING: CPU: 2 PID: 6 at fs/sysfs/group.c:219 device_del+0x40/0x1c0()
sysfs group 818b97e0 not found for kobject '2:0:4:0'
[..]
CPU: 2 PID: 6 Comm: kworker/u8:0 Tainted: PW  O  
3.16.7-ckt9-logicube-ng.3 #1
Hardware name: To be filled by O.E.M. To be filled by O.E.M./VT6085, BIOS 
4.6.5 01/23/2015
Workqueue: scsi_wq_2 sas_destruct_devices [libsas]
 0009 8151cd18 88011b35bcd8 810687b7
 88011a661400 88011b35bd28 8800c6e5e968 88028810
 8800c89f2c00 8106881c 81733b68 0028
Call Trace:
 [] ? dump_stack+0x41/0x51
 [] ? warn_slowpath_common+0x77/0x90
 [] ? warn_slowpath_fmt+0x4c/0x50
 [] ? device_del+0x40/0x1c0
 [] ? device_unregister+0x1a/0x70
 [] ? bsg_unregister_queue+0x5e/0xb0
 [] ? __scsi_remove_device+0xa9/0xd0 [scsi_mod]

It appears we've always been double deleting the devices below sas_port,
but recent sysfs changes now exposes this problem.  Libsas should delete
all the devices from rphy down before deleting the parent port.

Cc: 
Reported-by: Praveen Murali 
Tested-by: Praveen Murali 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Dan Williams 
---

Hi Andrew,

Can you take this through -mm.  It's been on linux-scsi for a couple
months, and Hannes has reviewed it.

 drivers/scsi/libsas/sas_discover.c |6 +++---
 drivers/scsi/libsas/sas_port.c |1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/libsas/sas_discover.c 
b/drivers/scsi/libsas/sas_discover.c
index 60de66252fa2..a4db770fe8b0 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -362,11 +362,14 @@ static void sas_destruct_devices(struct work_struct *work)
clear_bit(DISCE_DESTRUCT, &port->disc.pending);
 
list_for_each_entry_safe(dev, n, &port->destroy_list, disco_list_node) {
+   struct sas_port *sas_port = 
dev_to_sas_port(dev->rphy->dev.parent);
+
list_del_init(&dev->disco_list_node);
 
sas_remove_children(&dev->rphy->dev);
sas_rphy_delete(dev->rphy);
sas_unregister_common_dev(port, dev);
+   sas_port_delete(sas_port);
}
 }
 
@@ -400,9 +403,6 @@ void sas_unregister_domain_devices(struct asd_sas_port 
*port, int gone)
 
list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node)
sas_unregister_dev(port, dev);
-
-   port->port->rphy = NULL;
-
 }
 
 void sas_device_set_phy(struct domain_device *dev, struct sas_port *port)
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
index d3c5297c6c89..9a25ae3a52a4 100644
--- a/drivers/scsi/libsas/sas_port.c
+++ b/drivers/scsi/libsas/sas_port.c
@@ -219,7 +219,6 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone)
 
if (port->num_phys == 1) {
sas_unregister_domain_devices(port, gone);
-   sas_port_delete(port->port);
port->port = NULL;
} else {
sas_port_delete_phy(port->port, phy->phy);

--
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] target/iscsi: fix digest computation for chained SGs

2015-07-20 Thread Spencer Baugh
From: Alexei Potashnik 

Current implementation assumes that all the buffers of an IO are linked
with a single SG list. Which makes it fail if SG chaining is used.

Signed-off-by: Alexei Potashnik 
---
 drivers/target/iscsi/iscsi_target.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target.c 
b/drivers/target/iscsi/iscsi_target.c
index 4e68b62..a4cf58c 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1209,7 +1209,6 @@ static u32 iscsit_do_crypto_hash_sg(
u8 *pad_bytes)
 {
u32 data_crc;
-   u32 i;
struct scatterlist *sg;
unsigned int page_off;
 
@@ -1218,15 +1217,15 @@ static u32 iscsit_do_crypto_hash_sg(
sg = cmd->first_data_sg;
page_off = cmd->first_data_sg_off;
 
-   i = 0;
while (data_length) {
-   u32 cur_len = min_t(u32, data_length, (sg[i].length - 
page_off));
+   u32 cur_len = min_t(u32, data_length, (sg->length - page_off));
 
-   crypto_hash_update(hash, &sg[i], cur_len);
+   crypto_hash_update(hash, sg, cur_len);
 
data_length -= cur_len;
page_off = 0;
-   i++;
+   /* iscsit_map_iovec has already checked for invalid sg pointers 
*/
+   sg = sg_next(sg);
}
 
if (padding) {
-- 
2.4.3

--
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


[Bug 101781] New: kernel BUG at block/blk-core.c:1217!

2015-07-20 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=101781

Bug ID: 101781
   Summary: kernel BUG at block/blk-core.c:1217!
   Product: IO/Storage
   Version: 2.5
Kernel Version: 3.10.0
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: SCSI
  Assignee: linux-scsi@vger.kernel.org
  Reporter: tomsunc...@gmail.com
Regression: No

Created attachment 183221
  --> https://bugzilla.kernel.org/attachment.cgi?id=183221&action=edit
the request, request_queue, scsi_cmnd struct info

[ 1001.043824] Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[ 1001.043827] sd 1:0:0:5: [sdg] CDB: 
[ 1001.043828] Read(10): 28 00 00 00 00 88 00 00 78 00
[ 1001.043834] end_request: I/O error, dev sdg, sector 136
[ 1031.878134] qla2xxx [:08:00.0]-801c:1: Abort command issued nexus=1:0:5
--  1 2002.
[ 1072.919498] qla2xxx [:08:00.0]-801c:1: Abort command issued nexus=1:0:5
--  1 2002.
[ 1103.819949] qla2xxx [:08:00.0]-801c:1: Abort command issued nexus=1:0:3
--  1 2002.
[ 1105.029568] qla2xxx [:08:00.0]-801c:1: Abort command issued nexus=1:0:5
--  1 2002.
[ 1106.032392] qla2xxx [:08:00.0]-801c:1: Abort command issued nexus=1:0:5
--  1 2002.
[ 1137.070991] qla2xxx [:08:00.0]-8009:1: DEVICE RESET ISSUED nexus=1:0:3
cmd=880424b68e00.
[ 1137.073202] qla2xxx [:08:00.0]-800e:1: DEVICE RESET SUCCEEDED
nexus:1:0:3 cmd=880424b68e00.
[ 1137.074163] sd 1:0:0:5: [sdg]  
[ 1137.074197] Sense Key : No Sense [current] 
[ 1137.074203] sd 1:0:0:5: [sdg]  
[ 1137.074206] Add. Sense: No additional sense information
[ 1153.562495] [ cut here ]
[ 1153.562607] kernel BUG at block/blk-core.c:1217!
[ 1153.562678] invalid opcode:  [#1] SMP 
[ 1153.562746] Modules linked in: gfs2 dlm sctp sg xt_CHECKSUM iptable_mangle
ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4
xt_conntrack nf_conntrack ipt_REJECT tun bridge stp llc ebtable_filter ebtables
ip6table_filter ip6_tables iptable_filter ip_tables iscsi_tcp libiscsi_tcp
libiscsi scsi_transport_iscsi openvswitch vxlan ip_tunnel gre iTCO_wdt
iTCO_vendor_support coretemp crct10dif_pclmul crc32_pclmul dm_service_time
crc32c_intel ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper
ablk_helper ipmi_devintf cryptd serio_raw pcspkr hpilo hpwdt i7core_edac
lpc_ich ipmi_si mfd_core edac_core shpchp ipmi_msghandler acpi_power_meter
pcc_cpufreq mperf register_ipmc_reboot(OF) ifb kvm_intel kvm binfmt_misc
dm_multipath xfs libcrc32c sr_mod cdrom sd_mod ata_generic pata_acpi
[ 1153.564866]  crc_t10dif crct10dif_common radeon i2c_algo_bit drm_kms_helper
qla2xxx ttm tg3 ata_piix drm scsi_transport_fc ptp libata i2c_core hpsa
scsi_tgt pps_core dm_mirror dm_region_hash dm_log dm_mod
[ 1153.565195] CPU: 33 PID: 0 Comm: swapper/33 Tainted: GF 
O--   3.10.0-123.el7.x86_64 #1
[ 1153.565331] Hardware name: HP ProLiant DL580 G7, BIOS P65 07/01/2013
[ 1153.565420] task: 880427ceb8e0 ti: 880427cf8000 task.ti:
880427cf8000
[ 1153.565621] RIP: 0010:[]  []
blk_requeue_request+0x97/0xa0
[ 1153.566136] RSP: 0018:88143f6c3e08  EFLAGS: 00010082
[ 1153.566365] RAX: fff2 RBX: 881425f73000 RCX:
dead00200200
[ 1153.566548] RDX:  RSI: 881427745380 RDI:
0002
[ 1153.566652] RBP: 88143f6c3e20 R08: 8814277454d0 R09:

[ 1153.566751] R10:  R11: 0001 R12:
881427745380
[ 1153.571678] R13: 880424b79680 R14: 8800be4e9180 R15:
880427f3e828
[ 1153.576748] FS:  () GS:88143f6c()
knlGS:
[ 1153.582295] CS:  0010 DS:  ES:  CR0: 8005003b
[ 1153.587101] CR2: 7fcadd7e7ee8 CR3: 018e CR4:
07e0
[ 1153.592485] DR0:  DR1:  DR2:

[ 1153.597998] DR3:  DR6: 0ff0 DR7:
0400
[ 1153.602863] Stack:
[ 1153.608184]  881425f73000 880424b79680 0202
88143f6c3e68
[ 1153.613920]  813e7a48 0097 0286
8800be4e9180
[ 1153.619616]  2001 0002bf20 0006
0001
[ 1153.625120] Call Trace:
[ 1153.630042]   
[ 1153.630171] 
[ 1153.635622]  [] __scsi_queue_insert+0x98/0x120
[ 1153.641325]  [] scsi_softirq_done+0xd2/0x160
[ 1153.646999]  [] blk_done_softirq+0x90/0xc0
[ 1153.652708]  [] __do_softirq+0xf7/0x290
[ 1153.658445]  [] call_softirq+0x1c/0x30
[ 1153.664254]  [] do_softirq+0x55/0xa0
[ 1153.670070]  [] irq_exit+0x25d/0x270
[ 1153.675837]  []
smp_call_function_single_interrupt+0x35/0x40
[ 1153.681772]  [] call_function_single_interrupt+0x6d/0x80
[ 1153.687744]   
[ 1153.687773] 
[ 1153.693735]  [] ? lapic_next_event+0x1d/0x30
[ 1153.699792]  [] ? finish_task_switch+0x53/0x170
[ 1153.705869]  [] __