From: Damien Le Moal Date: Fri, 11 Nov 2016 05:53:26 +0000 (+0900) Subject: sd_zbc: Force use of READ16/WRITE16 X-Git-Tag: Ubuntu-4.10.0-19.21~2046^2~85 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c6463c651d7ab599a4878115723a5bcb6ae5b470;p=mirror_ubuntu-artful-kernel.git sd_zbc: Force use of READ16/WRITE16 Normally, sd_read_capacity sets sdp->use_16_for_rw to 1 based on the disk capacity so that READ16/WRITE16 are used for large drives. However, for a zoned disk with RC_BASIS set to 0, the capacity reported through READ_CAPACITY may be very small, leading to use_16_for_rw not being set and READ10/WRITE10 commands being used, even after the actual zoned disk capacity is corrected in sd_zbc_read_zones. This causes LBA offset overflow for accesses beyond 2TB. As the ZBC standard makes it mandatory for ZBC drives to support the READ16/WRITE16 commands anyway, make sure that use_16_for_rw is set. Signed-off-by: Damien Le Moal eviewed-by: Christoph Hellwig Signed-off-by: Jens Axboe --- diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 394ab490919c..92620c8ea8ad 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -612,6 +612,10 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, if (ret) goto err; + /* READ16/WRITE16 is mandatory for ZBC disks */ + sdkp->device->use_16_for_rw = 1; + sdkp->device->use_10_for_rw = 0; + return 0; err: