zbd: ensure that global max open zones limit is respected
authorNiklas Cassel <niklas.cassel@wdc.com>
Thu, 24 Jun 2021 17:23:08 +0000 (17:23 +0000)
committerJens Axboe <axboe@kernel.dk>
Tue, 29 Jun 2021 13:43:30 +0000 (07:43 -0600)
commitea51055cbb2fcbca3935e25c78e8b6d358ca2b3f
tree94d6b6098be3ce3501b0c1a67c3b77dc17fd0760
parentb346af906f76533bc0db63b73c0da9bbff34e6d1
zbd: ensure that global max open zones limit is respected

Commit 219c662d3b12 ("zbd: introduce per job maximum open zones limit")
Introduced a global max open zones limit stored in zbd_info->max_open_zones.

This commit also changed checks against td->o.max_open_zones in zbd_open_zone()
with checks against zbd_info->max_open_zones.

It is obvious that zbd_info->max_open_zones was intended to replace
td->o.max_open_zones in all code that is executed after zbd_setup_files().

The commit itself was needed since zbd_info is shared over different jobs,
so it is important that the global limit of max open zones is the same,
for different jobs targeting the same device.

The problem with this commit is that in zbd_convert_to_open_zone(),
instead of replacing td->o.max_open_zones with zbd_info->max_open_zones,
it incorrectly just removed the references to td->o.max_open_zones.

This caused commit 00ca8df5468e ("zbd: Fix max_open_zones checks")
(written by another author) to incorrectly re-add the removed
td->o.max_open_zones checks in zbd_convert_to_open_zone().
The proper fix here should have been to add checks against
zbd_info->max_open_zones instead of td->o.max_open_zones,
just like the original author did for zbd_open_zone().

Replace all td->o.max_open_zones uses past zbd_setup_files() with
zbd_info->max_open_zones, and force set td->o.max_open_zones to
zbd_info->max_open_zones in zbd_setup_files(), so that even if checks are
introduced against the wrong limit, fio will still respect the global limit.

Fixes: 00ca8df5468e ("zbd: Fix max_open_zones checks")
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c