zbd: Fix read with verify
authorDamien Le Moal <damien.lemoal@wdc.com>
Fri, 8 May 2020 07:56:41 +0000 (16:56 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 15 May 2020 13:41:36 +0000 (07:41 -0600)
For a read only workload with verify option enabled, executing
zbd_replay_write_order() will ignore target zones that are full and try
to open another zone. This either triggers an assert if max_open_zones
is unused, or result in verify failing. Fix this by executing
zbd_replay_write_order() only for writing workloads. This fix is also
consistent with the fact that zoned devices do not implicitly open
zones for read operations.

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 5aaf1e2cf19c7e9645c56f1585bd47fc34b1f147..c30454b91daaa29a1bd0e622dcc8913f0102ea80 100644 (file)
--- a/zbd.c
+++ b/zbd.c
@@ -1409,7 +1409,8 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
        switch (io_u->ddir) {
        case DDIR_READ:
                if (td->runstate == TD_VERIFYING) {
-                       zb = zbd_replay_write_order(td, io_u, zb);
+                       if (td_write(td))
+                               zb = zbd_replay_write_order(td, io_u, zb);
                        goto accept;
                }
                /*