rbd: don't test rbd_dev->opts in rbd_dev_image_release()
authorIlya Dryomov <idryomov@gmail.com>
Mon, 16 Mar 2020 16:16:28 +0000 (17:16 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 13 Apr 2020 06:55:49 +0000 (08:55 +0200)
rbd_dev->opts is used to distinguish between the image that is being
mapped and a parent.  However, because we no longer establish watch for
read-only mappings, this test is imprecise and results in unnecessary
rbd_unregister_watch() calls.

Make it consistent with need_watch in rbd_dev_image_probe().

Fixes: b9ef2b8858a0 ("rbd: don't establish watch for read-only mappings")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jason Dillaman <dillaman@redhat.com>
drivers/block/rbd.c

index 7aec8bc5df6e23a7134ec9b22b2adbaf9af59dff..205192a5ec8ffcbd84449a107bce7e5b491d70c0 100644 (file)
@@ -6898,7 +6898,7 @@ static void rbd_print_dne(struct rbd_device *rbd_dev, bool is_snap)
 
 static void rbd_dev_image_release(struct rbd_device *rbd_dev)
 {
-       if (rbd_dev->opts)
+       if (!rbd_is_ro(rbd_dev))
                rbd_unregister_watch(rbd_dev);
 
        rbd_dev_unprobe(rbd_dev);