]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nbd: call nbd_bdev_reset instead of bd_set_size on disconnect
authorJosef Bacik <jbacik@fb.com>
Wed, 16 May 2018 18:51:22 +0000 (14:51 -0400)
committerJens Axboe <axboe@kernel.dk>
Wed, 16 May 2018 18:54:13 +0000 (12:54 -0600)
We need to make sure we don't just set the size of the bdev to 0 while
it's being used by a file system.  We have the appropriate check in
nbd_bdev_reset, simply use that helper instead.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c

index 24788bd10c8b85e5d40a478128cc1fc4264bb1a5..abc0a815354f16b786c575c03967cec22bad4396 100644 (file)
@@ -1127,7 +1127,7 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b
        if (ret)
                sock_shutdown(nbd);
        mutex_lock(&nbd->config_lock);
-       bd_set_size(bdev, 0);
+       nbd_bdev_reset(bdev);
        /* user requested, ignore socket errors */
        if (test_bit(NBD_DISCONNECT_REQUESTED, &config->runtime_flags))
                ret = 0;