[rh7,6/8] nbd: update size when connected

Submitted by Andrey Ryabinin on Nov. 1, 2019, 7:12 p.m.


Message ID 20191101191218.31833-6-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin Nov. 1, 2019, 7:12 p.m.
From: Josef Bacik <jbacik@fb.com>

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>

(cherry picked from commit c3f7c9397609705ef848cc98a5fb429b3e90c3c4)
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
 drivers/block/nbd.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index ea5880077933..a0ebd61c19d8 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -208,6 +208,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_end_request(struct nbd_cmd *cmd)