Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

zloop: fix zone append check in zloop_rw()

While commit cf28f6f923cb ("zloop: fail zone append operations that are
targeting full zones") added a check in zloop_rw() that a zone append is
not issued to a full zone, commit e3a96ca90462 ("zloop: simplify checks
for writes to sequential zones") inadvertently removed the check to
verify that there is enough unwritten space in a zone for an incoming
zone append opration.

Re-add this check in zloop_rw() to make sure we do not write beyond the
end of a zone. Of note is that this same check is already present in the
function zloop_set_zone_append_sector() when ordered zone append is in
use.

Reported-by: Hans Holmberg <Hans.Holmberg@wdc.com>
Fixes: e3a96ca90462 ("zloop: simplify checks for writes to sequential zones")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Damien Le Moal and committed by
Jens Axboe
a9637ab9 ebcc028b

+2 -1
+2 -1
drivers/block/zloop.c
··· 448 448 * and set the target sector in zloop_queue_rq(). 449 449 */ 450 450 if (!zlo->ordered_zone_append) { 451 - if (zone->cond == BLK_ZONE_COND_FULL) { 451 + if (zone->cond == BLK_ZONE_COND_FULL || 452 + zone->wp + nr_sectors > zone_end) { 452 453 spin_unlock_irqrestore(&zone->wp_lock, 453 454 flags); 454 455 ret = -EIO;