linux/drivers/block
Damien Le Moal 9dd44c7e99 null_blk: Fix zoned command handling
For write operations issued to a null_blk device with zoned mode
enabled, the state and write pointer position of the zone targeted by
the command should be checked before badblocks and memory backing
are handled as the write may be first failed due to, for instance, a
sector position not aligned with the zone write pointer. This order of
checking for errors reflects more accuratly the behavior of physical
zoned devices.

Furthermore, the write pointer position of the target zone should be
incremented only and only if no errors are reported by badblocks and
memory backing handling.

To fix this, introduce the small helper function null_process_cmd()
which execute null_handle_badblocks() and null_handle_memory_backed()
and use this function in null_zone_write() to correctly handle write
requests to zoned null devices depending on the type and state of the
write target zone. Also call this function in null_handle_zoned() to
process read requests to zoned null devices.

null_process_cmd() is called directly from null_handle_cmd() for
regular null devices, resulting in no functional change for these type
of devices. To have symmetric names, the function null_handle_zoned()
is renamed to null_process_zoned_cmd().

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-04-23 09:35:09 -06:00
..
aoe block: aoe: Use scnprintf() for avoiding potential buffer overflow 2020-03-12 07:39:04 -06:00
drbd for-5.7/drivers-2020-03-29 2020-03-30 11:43:51 -07:00
mtip32xx block: mtip32xx: Spelling s/configration/configuration/ 2019-10-25 14:31:07 -06:00
paride scsi: compat_ioctl: cdrom: Replace .ioctl with .compat_ioctl in four appropriate places 2020-02-24 15:06:07 -05:00
rsxx for-5.7/drivers-2020-03-29 2020-03-30 11:43:51 -07:00
xen-blkback xen/blkback: Consistently insert one empty line between functions 2020-01-29 07:35:49 -06:00
zram block: simplify queue allocation 2020-03-27 10:23:43 -06:00
amiflop.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ataflop.c ataflop: Remove unneeded semicolon 2019-11-28 10:40:47 -07:00
brd.c block: simplify queue allocation 2020-03-27 10:23:43 -06:00
cryptoloop.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 30 2019-05-24 17:27:10 +02:00
floppy.c floppy: rename the global "fdc" variable to "current_fdc" 2020-03-16 08:26:58 -06:00
Kconfig virtio-blk: remove VIRTIO_BLK_F_SCSI support 2020-02-06 03:40:26 -05:00
loop.c loop: Better discard support for block devices 2020-04-03 13:44:22 -06:00
loop.h block/loop: Use global lock for ioctl() operation. 2018-11-08 06:30:11 -07:00
Makefile null_blk: add tracepoint helpers for zoned mode 2020-03-27 13:39:10 -06:00
nbd.c nbd: requeue command if the soecket is changed 2020-03-12 08:01:24 -06:00
null_blk_main.c null_blk: Fix zoned command handling 2020-04-23 09:35:09 -06:00
null_blk_trace.c null_blk: add tracepoint helpers for zoned mode 2020-03-27 13:39:10 -06:00
null_blk_trace.h null_blk: add tracepoint helpers for zoned mode 2020-03-27 13:39:10 -06:00
null_blk_zoned.c null_blk: Fix zoned command handling 2020-04-23 09:35:09 -06:00
null_blk.h null_blk: Fix zoned command handling 2020-04-23 09:35:09 -06:00
pktcdvd.c block: simplify queue allocation 2020-03-27 10:23:43 -06:00
ps3disk.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 164 2019-05-30 11:26:38 -07:00
ps3vram.c block: simplify queue allocation 2020-03-27 10:23:43 -06:00
rbd_types.h rbd: support for object-map and fast-diff 2019-07-08 14:01:45 +02:00
rbd.c rbd: don't mess with a page vector in rbd_notify_op_lock() 2020-04-13 08:55:49 +02:00
skd_main.c Linux 5.2-rc6 2019-07-01 08:16:08 -06:00
skd_s1120.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 497 2019-06-19 17:09:53 +02:00
sunvdc.c compat_ioctl: block: handle cdrom compat ioctl in non-cdrom drivers 2020-01-03 09:33:15 +01:00
swim3.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
swim_asm.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
swim.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sx8.c sx8: use a per-host tag_set 2018-11-09 08:14:14 -07:00
umem.c block: simplify queue allocation 2020-03-27 10:23:43 -06:00
umem.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 348 2019-06-05 17:37:08 +02:00
virtio_blk.c for-5.7/block-2020-03-29 2020-03-30 11:20:13 -07:00
xen-blkfront.c xen: branch for v5.7-rc1b 2020-04-10 17:20:06 -07:00
xsysace.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
z2ram.c powerpc updates for 4.20 2018-10-26 14:36:21 -07:00