zbd: relocate Coverity annotation
authorDmitry Fomichev <dmitry.fomichev@wdc.com>
Sat, 30 Jan 2021 03:35:24 +0000 (12:35 +0900)
committerJens Axboe <axboe@kernel.dk>
Sat, 30 Jan 2021 05:06:49 +0000 (22:06 -0700)
The Coverity annotation added earlier to suppress a false positive
about missing unlock in zbd_adjust_block() didn't work because it
was placed not before the return statement, but earlier in the code.

Move the annotation to the right place to avoid the warning.

Reported-by: Bart Van Assche <bvanassche@acm.org>
Fixes: 8e4b2e55512f("zbd: don't unlock zone mutex after verify replay")
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c

diff --git a/zbd.c b/zbd.c
index 4710645dae7a003b742f393a78e153d0fe90395b..6a26fe108a68acf55c7ad2b7e59e8fccb97f0dc8 100644 (file)
--- a/zbd.c
+++ b/zbd.c
@@ -1620,12 +1620,6 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
        case DDIR_READ:
                if (td->runstate == TD_VERIFYING && td_write(td)) {
                        zb = zbd_replay_write_order(td, io_u, zb);
-                       /*
-                        * Since we return with the zone lock still held,
-                        * add an annotation to let Coverity know that it
-                        * is intentional.
-                        */
-                       /* coverity[missing_unlock] */
                        goto accept;
                }
                /*
@@ -1786,6 +1780,12 @@ accept:
        assert(!io_u->zbd_put_io);
        io_u->zbd_queue_io = zbd_queue_io;
        io_u->zbd_put_io = zbd_put_io;
+       /*
+        * Since we return with the zone lock still held,
+        * add an annotation to let Coverity know that it
+        * is intentional.
+        */
+       /* coverity[missing_unlock] */
        return io_u_accept;
 
 eof: