]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nbd: update size when connected
authorJosef Bacik <jbacik@fb.com>
Wed, 16 May 2018 18:51:18 +0000 (14:51 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Jun 2018 23:54:01 +0000 (07:54 +0800)
commit c3f7c9397609705ef848cc98a5fb429b3e90c3c4 upstream.

I messed up changing the size of an NBD device while it was connected by
not actually updating the device or doing the uevent.  Fix this by
updating everything if we're connected and we change the size.

cc: stable@vger.kernel.org
Fixes: 639812a ("nbd: don't set the device size until we're connected")
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/nbd.c

index 7a2101030683c39db8ceb7b32a5c91a2b0564b43..7dc01bbb851f6473e246fef3afe2a331d88bbde1 100644 (file)
@@ -246,6 +246,8 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
        struct nbd_config *config = nbd->config;
        config->blksize = blocksize;
        config->bytesize = blocksize * nr_blocks;
+       if (nbd->task_recv != NULL)
+               nbd_size_update(nbd);
 }
 
 static void nbd_complete_rq(struct request *req)