[PATCH] lpfc: check for valid scsi cmnd in lpfc_scsi_cmd_iocb_cmpl()

2017-11-12 Thread Hannes Reinecke
When the 'host_scribble' backpointer doesn't match we need to
skip processing this command.

Signed-off-by: Hannes Reinecke 
---
 drivers/scsi/lpfc/lpfc_scsi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 1a6f122..dfdca1d 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -3938,6 +3938,8 @@ int lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba,
cmd = lpfc_cmd->pCmd;
if (!cmd)
return;
+   if (cmd->host_scribble != lpfc_cmd)
+   return;
shost = cmd->device->host;
 
lpfc_cmd->result = (pIocbOut->iocb.un.ulpWord[4] & IOERR_PARAM_MASK);
-- 
1.8.5.6



Re: [PATCH] uas: Add US_FL_NO_ATA_1X quirk for one more Seagate device

2017-11-12 Thread Jérôme Carretero
On Mon, 13 Nov 2017 09:16:39 +0300
Andrey Astafyev <1...@246060.ru> wrote:

> 13.11.2017 09:14, Jérôme Carretero пишет:
> > For my devices, adding US_FL_NO_ATA_1X to unusual_uas.h didn't
> > change anything, and while adding US_FL_IGNORE_UAS (using
> > quirks=0bc2:ab34:u,0bc2:ab38:u) there are still device resets,
> > but they cause shorter hangs in system activity (~1 second when
> > UAS was more like ~20).  
> 
> Maybe you should try like this: quirks=0bc2:ab34:ut,0bc2:ab38:ut ?

It looks like "ut" would do the same as "u" alone, as US_FL_NO_ATA_1X
is only used inside uas.ko.
For some reason, first I wanted to go in the .h, and it's only after,
when the trial and error went more intense, that I used the command-line
parameters.

Will follow up later... I hope the drives won't end up costing more
than 12Gb/s SAS drives on an expensive HBA... as they are definitely
not hassle-free so far.
I had gotten the first 8 TB model in 2015 and had issues, but my
simple, background workload (attic/borg) could afford to use a
workaround of throttling writes*.

-- 
Jérôme

* https://bugzilla.kernel.org/show_bug.cgi?id=93581#c129


Re: [PATCH] uas: Add US_FL_NO_ATA_1X quirk for one more Seagate device

2017-11-12 Thread Andrey Astafyev

13.11.2017 09:14, Jérôme Carretero пишет:

For my devices, adding US_FL_NO_ATA_1X to unusual_uas.h didn't
change anything, and while adding US_FL_IGNORE_UAS (using
quirks=0bc2:ab34:u,0bc2:ab38:u) there are still device resets,
but they cause shorter hangs in system activity (~1 second when
UAS was more like ~20).


Maybe you should try like this: quirks=0bc2:ab34:ut,0bc2:ab38:ut ?



Re: [PATCH] uas: Add US_FL_NO_ATA_1X quirk for one more Seagate device

2017-11-12 Thread Jérôme Carretero
On Mon, 13 Nov 2017 07:01:30 +0300
Andrey Astafyev <1...@246060.ru> wrote:

> 13.11.2017 00:42, Jérôme Carretero пишет:
> > Nov 12 16:20:59 Bidule kernel: sd 22:0:0:0: [sdaa] tag#2 
> > uas_eh_abort_handler 0 uas-tag 3 inflight: CMD OUT
> > [...]
> > Do you see such things?
> >  
> Hi, I've seen dmesg output like this so I've added my device to
> quirks list like any other Seagate USB drive.

Hi Andrey, Hans,


For my devices, adding US_FL_NO_ATA_1X to unusual_uas.h didn't
change anything, and while adding US_FL_IGNORE_UAS (using
quirks=0bc2:ab34:u,0bc2:ab38:u) there are still device resets,
but they cause shorter hangs in system activity (~1 second when
UAS was more like ~20).

Is the US_FL_NO_ATA_1X supposed to get rid of the R/W errors?
The first entry I saw about this quirk was so that the device can
be used at all (wouldn't be able to mount without it).


I'll follow up: when scrubbing the devices after a sequence of
experiments, there were checksum errors, so I'll retry with a more
reproducible sequence to try and get something more solid.
I wouldn't want to disable UAS just to see that reliability has
been reduced (one Arch bug report mentions something like that
https://bugs.archlinux.org/task/48362).


Regards,

-- 
Jérôme

PS: The controllers I tested do the same:

09:00.0 USB controller: Fresco Logic FL1100 USB 3.0 Host Controller (rev 10)
0c:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 
03)


Re: [PATCH] uas: Add US_FL_NO_ATA_1X quirk for one more Seagate device

2017-11-12 Thread Andrey Astafyev

13.11.2017 00:42, Jérôme Carretero пишет:
Nov 12 16:20:59 Bidule kernel: sd 22:0:0:0: [sdaa] tag#2 
uas_eh_abort_handler 0 uas-tag 3 inflight: CMD OUT

Nov 12 16:20:59 Bidule kernel: sd 22:0:0:0: [sdaa] tag#2 CDB: Write(16) 
8a 00 00 00 00 00 20 00 08 00 00 00 00 08 00 00
Nov 12 16:20:59 Bidule kernel: sd 22:0:0:0: [sdaa] tag#1 
uas_eh_abort_handler 0 uas-tag 2 inflight: CMD OUT
Nov 12 16:20:59 Bidule kernel: sd 22:0:0:0: [sdaa] tag#1 CDB: Write(16) 
8a 00 00 00 00 00 00 02 08 00 00 00 00 08 00 00
Nov 12 16:21:29 Bidule kernel: sd 22:0:0:0: [sdaa] tag#0 
uas_eh_abort_handler 0 uas-tag 1 inflight: CMD
Nov 12 16:21:29 Bidule kernel: sd 22:0:0:0: [sdaa] tag#0 CDB: 
Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00
Nov 12 16:21:29 Bidule kernel: scsi host22: uas_eh_device_reset_handler 
start
Nov 12 16:21:29 Bidule kernel: usb 6-4.3.2.1: reset SuperSpeed USB 
device number 9 using xhci_hcd
Nov 12 16:21:29 Bidule kernel: scsi host22: uas_eh_device_reset_handler 
success


Do you see such things?

Hi, I've seen dmesg output like this so I've added my device to quirks 
list like any other Seagate USB drive.




Re: [PATCH] uas: Add US_FL_NO_ATA_1X quirk for one more Seagate device

2017-11-12 Thread Jérôme Carretero
On Fri, 10 Nov 2017 16:13:44 +0100
Hans de Goede  wrote:

> Just like all previous UAS capable Seagate disk enclosures, this
> one needs a US_FL_NO_ATA_1X quirk.
> [...]
> +/* Reported-by: Andrey Astafyev  */

Hi Andrey,


I notice that you have an external Seagate SMR drive, I am encountering
some trouble and was wondering if you (or anyone in CC) could have some
feedback.

While the drives I have (PID 0xab45, "Backup+ Hub BK") are used
without problem with very light loads, I'm starting to get annoyed when
doing more serious work.
Here is a series of messages (v4.14) I have when simply trying to balance 1
chunk of BTRFS data, ie. write 5 GiB, and waiting a long time in-between:

Nov 12 16:15:35 Bidule kernel: sd 22:0:0:0: [sdaa] tag#7 
uas_eh_abort_handler 0 uas-tag 8 inflight: CMD OUT
Nov 12 16:15:35 Bidule kernel: sd 22:0:0:0: [sdaa] tag#7 CDB: Write(16) 
8a 00 00 00 00 00 00 00 11 00 00 00 00 80 00 00
Nov 12 16:15:35 Bidule kernel: sd 22:0:0:0: [sdaa] tag#6 
uas_eh_abort_handler 0 uas-tag 7 inflight: CMD OUT
Nov 12 16:15:35 Bidule kernel: sd 22:0:0:0: [sdaa] tag#6 CDB: Write(16) 
8a 00 00 00 00 00 00 00 11 80 00 00 00 80 00 00
Nov 12 16:15:35 Bidule kernel: sd 22:0:0:0: [sdaa] tag#5 
uas_eh_abort_handler 0 uas-tag 6 inflight: CMD OUT
Nov 12 16:15:35 Bidule kernel: sd 22:0:0:0: [sdaa] tag#5 CDB: Write(16) 
8a 00 00 00 00 00 00 bf fd 80 00 00 00 80 00 00
Nov 12 16:15:35 Bidule kernel: sd 22:0:0:0: [sdaa] tag#4 
uas_eh_abort_handler 0 uas-tag 5 inflight: CMD OUT
Nov 12 16:15:35 Bidule kernel: sd 22:0:0:0: [sdaa] tag#4 CDB: Write(16) 
8a 00 00 00 00 00 00 bf fd 00 00 00 00 80 00 00
Nov 12 16:15:35 Bidule kernel: scsi host22: uas_eh_device_reset_handler 
start
Nov 12 16:15:35 Bidule kernel: usb 6-4.3.2.1: reset SuperSpeed USB 
device number 9 using xhci_hcd
Nov 12 16:15:35 Bidule kernel: scsi host22: uas_eh_device_reset_handler 
success


Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#3 
uas_eh_abort_handler 0 uas-tag 4 inflight: CMD IN
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#3 CDB: Read(16) 
88 00 00 00 00 00 01 02 53 80 00 00 00 80 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#13 
uas_eh_abort_handler 0 uas-tag 14 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#13 CDB: 
Write(16) 8a 00 00 00 00 00 01 02 3b c0 00 00 00 20 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#2 
uas_eh_abort_handler 0 uas-tag 3 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#2 CDB: Write(16) 
8a 00 00 00 00 00 01 02 41 00 00 00 01 00 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#12 
uas_eh_abort_handler 0 uas-tag 13 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#12 CDB: 
Write(16) 8a 00 00 00 00 00 01 02 3c a0 00 00 00 20 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#11 
uas_eh_abort_handler 0 uas-tag 12 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#11 CDB: 
Write(16) 8a 00 00 00 00 00 01 02 62 00 00 00 00 80 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#1 
uas_eh_abort_handler 0 uas-tag 2 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#1 CDB: Write(16) 
8a 00 00 00 00 00 01 02 61 80 00 00 00 80 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#10 
uas_eh_abort_handler 0 uas-tag 11 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#10 CDB: 
Write(16) 8a 00 00 00 00 00 01 02 61 00 00 00 00 80 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#9 
uas_eh_abort_handler 0 uas-tag 10 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#9 CDB: Write(16) 
8a 00 00 00 00 00 01 02 60 80 00 00 00 80 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#8 
uas_eh_abort_handler 0 uas-tag 9 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#8 CDB: Write(16) 
8a 00 00 00 00 00 01 02 60 00 00 00 00 80 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#7 
uas_eh_abort_handler 0 uas-tag 8 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#7 CDB: Write(16) 
8a 00 00 00 00 00 01 02 5f 80 00 00 00 80 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#6 
uas_eh_abort_handler 0 uas-tag 7 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#6 CDB: Write(16) 
8a 00 00 00 00 00 01 02 5f 00 00 00 00 80 00 00
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#5 
uas_eh_abort_handler 0 uas-tag 6 inflight: CMD OUT
Nov 12 16:20:28 Bidule kernel: sd 22:0:0:0: [sdaa] tag#5 CDB: Write(16) 
8a 00 00 00 00 00 01 02 50 00 00 00 00 80 00 00
Nov 12 16:20:28 Bidule kernel: 

[PATCH] scsi: aic7xxx_core: remove unnecessary null check before kfree

2017-11-12 Thread Gustavo A. R. Silva
NULL check before freeing functions like kfree is not needed.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c 
b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 6612ff3..8d96e11 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -4549,10 +4549,8 @@ ahc_free(struct ahc_softc *ahc)
kfree(ahc->black_hole);
}
 #endif
-   if (ahc->name != NULL)
-   kfree(ahc->name);
-   if (ahc->seep_config != NULL)
-   kfree(ahc->seep_config);
+   kfree(ahc->name);
+   kfree(ahc->seep_config);
 #ifndef __FreeBSD__
kfree(ahc);
 #endif
-- 
2.7.4