zbd: Fix job zone size initialization
authorDamien Le Moal <damien.lemoal@wdc.com>
Fri, 30 Aug 2019 01:45:03 +0000 (10:45 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 30 Aug 2019 01:52:30 +0000 (19:52 -0600)
For a job accessing a zoned block device, the zone size is automatically
initialized to the device zone size. However, since zone information for
a zoned block device is parsed once only for the first job
initialization of a multi job workload, only the first job has its
zonesize option intialized, causing problem if the zoneskip option is
also used (assert exit).

Fix this by always initializing a job zonesize option using the job
file zbd information when verifying the job ZBD related sizes and
offsets.

Fixes: 4d37720ae029 ("zbd: Add support for zoneskip option")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c

diff --git a/zbd.c b/zbd.c
index fb81b532bc37b7f9d3406442d80f24f7d8e056d9..0a573692dc69ddb3b9cdefa003a6ae803ee1da98 100644 (file)
--- a/zbd.c
+++ b/zbd.c
@@ -120,6 +120,15 @@ static bool zbd_verify_sizes(void)
                        if (!zbd_is_seq_job(f))
                                continue;
 
+                       if (!td->o.zone_size) {
+                               td->o.zone_size = f->zbd_info->zone_size;
+                               if (!td->o.zone_size) {
+                                       log_err("%s: invalid 0 zone size\n",
+                                               f->file_name);
+                                       return false;
+                               }
+                       }
+
                        if (td->o.zone_skip &&
                            (td->o.zone_skip < td->o.zone_size ||
                             td->o.zone_skip % td->o.zone_size)) {