zbd: Fix zone report handling
authorDamien Le Moal <damien.lemoal@wdc.com>
Fri, 19 Apr 2019 03:40:49 +0000 (12:40 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 19 Apr 2019 15:11:34 +0000 (09:11 -0600)
commit7f125e7f3879d23e79bc2ef5eed678ddab3b5c70
tree94acde227fd18d263d15f60503b5002b0ce22bb3
parentff547caad147b437f654881717fedc750c0c9b17
zbd: Fix zone report handling

fio may be executed concurrently with a block device revalidation by
the kernel. Device revalidation may lead to the block device capacity
to be changed to a smaller value (device changed) or to even 0 in case
of revalidation failure. In such case, the BLKREPORTZONE ioctl
executed from read_zone_info() may report a success with an empty zone
report when the start sector for the report is above the new capacity
of the device. This leads to an infinite loop inside parse_zone_info()
and the fio run never terminating.

Fix this problem by returning -EIO from read_zone_info() thus
avoiding the infinite loop in parse_zone_info(). This change does not
affect the normal case with a stable device as read_zone_info() is
always called with a valid start sector that does not result in an
empty zone report.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c