mbox series

[0/2] Fix handling of host-aware ZBC disks

Message ID 20200913060304.294898-1-damien.lemoal@wdc.com
Headers show
Series Fix handling of host-aware ZBC disks | expand

Message

Damien Le Moal Sept. 13, 2020, 6:03 a.m. UTC
Martin,

Two patches for this cycle (with a cc stable) to fix handling of
host-aware ZBC disks that have partitions, that is, used as regular
disks.

The first patch fixes host-aware disk initialization and command
completion processing. It also enables the use of host-aware disks as
regular disks when CONFIG_BLK_DEV_ZONED is disabled.

The second patch fixes the CONFIG_BLK_DEV_ZONED enabled configuration
so that zone append emulation is not initialized for host-aware disks
with partitions/used as regular disks. While at it, this patch also
removes a problem with sd_zbc_init_disk() error handling in
sd_revalidate_disk() by moving this function execution inside
sd_zbc_revalidate_zones().

Boris,

I tested all this. I could recreate the hang you are seeing with
CONFIG_BLK_DEV_ZONED disabled. The cause for this hang was that
good_bytes always ended up being 0 for all IOs to the host-aware disk.
The fix for this is in the first patch.
If you could test this (on top of 5.9-rc), it would be great. Thanks !

Damien Le Moal (2):
  scsi: Fix handling of host-aware ZBC disks
  scsi: Fix ZBC disk initialization

 drivers/scsi/sd.c     | 26 +++++++++++------
 drivers/scsi/sd.h     |  8 +-----
 drivers/scsi/sd_zbc.c | 66 ++++++++++++++++++++++++++-----------------
 3 files changed, 59 insertions(+), 41 deletions(-)

Comments

Borislav Petkov Sept. 13, 2020, 7:05 a.m. UTC | #1
Mornin',

On Sun, Sep 13, 2020 at 03:03:02PM +0900, Damien Le Moal wrote:
> I tested all this. I could recreate the hang you are seeing with
> CONFIG_BLK_DEV_ZONED disabled. The cause for this hang was that
> good_bytes always ended up being 0 for all IOs to the host-aware disk.
> The fix for this is in the first patch.
> If you could test this (on top of 5.9-rc), it would be great. Thanks !

Sure, below is the diff of both boot dmesgs, with CONFIG_BLK_DEV_ZONED
and without it. So for both:

Tested-by: Borislav Petkov <bp@suse.de>

Thanks Damien and sorry for ruining your weekend.

---
--- 09-rc4+.CONFIG_BLK_DEV_ZONED	2020-09-13 08:36:13.423999302 +0200
+++ 09-rc4+.CONFIG_BLK_DEV_ZONED.off	2020-09-13 08:43:45.371999496 +0200
@@ -825,28 +825,26 @@ input: DATACOMP SteelS쀁̄Љ̒DATA Cons
 hid-generic 0003:04B4:0101.0002: input,hidraw1: USB HID v1.00 Device [DATACOMP SteelS쀁̄Љ̒DATA] on usb-0000:03:00.0-12/input1
 usb 1-13: new low-speed USB device number 3 using xhci_hcd
 usb 1-13: New USB device found, idVendor=046d, idProduct=c018, bcdDevice=43.01
-ata4: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
 usb 1-13: New USB device strings: Mfr=1, Product=2, SerialNumber=0
-ata4.00: NCQ Send/Recv Log not supported
 usb 1-13: Product: USB Optical Mouse
 usb 1-13: Manufacturer: Logitech
+ata4: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
+ata4.00: NCQ Send/Recv Log not supported
 ata4.00: ATA-10: ST8000AS0022-1WL17Z, SN01, max UDMA/133
-ata4.00: 15628053168 sectors, multi 16: LBA48 NCQ (depth 32), AA
 input: Logitech USB Optical Mouse as /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-13/1-13:1.0/0003:046D:C018.0003/input/input5
+ata4.00: 15628053168 sectors, multi 16: LBA48 NCQ (depth 32), AA
 ata4.00: NCQ Send/Recv Log not supported
 hid-generic 0003:046D:C018.0003: input,hidraw2: USB HID v1.11 Mouse [Logitech USB Optical Mouse] on usb-0000:03:00.0-13/input0
 ata4.00: configured for UDMA/133
 scsi 3:0:0:0: Direct-Access     ATA      ST8000AS0022-1WL SN01 PQ: 0 ANSI: 5
 sd 3:0:0:0: Attached scsi generic sg1 type 0
-sd 3:0:0:0: [sdb] Host-aware zoned block device
+sd 3:0:0:0: [sdb] Host-aware SMR disk used as regular disk
 sd 3:0:0:0: [sdb] 15628053168 512-byte logical blocks: (8.00 TB/7.28 TiB)
 sd 3:0:0:0: [sdb] 4096-byte physical blocks
 sd 3:0:0:0: [sdb] Write Protect is off
 sd 3:0:0:0: [sdb] Mode Sense: 00 3a 00 00
 sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
-sd 3:0:0:0: [sdb] 29808 zones of 524288 logical blocks + 1 runt zone
  sdb: sdb1
-sdb: disabling host aware zoned block device support due to partitions
 sd 3:0:0:0: [sdb] Attached SCSI disk
 ata5: failed to resume link (SControl 0)
 ata5: SATA link down (SStatus 0 SControl 0)
Johannes Thumshirn Sept. 13, 2020, 8:03 a.m. UTC | #2
With Boris' comment worked in,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>