summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2018-05-16 14:51:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-06-26 07:54:01 +0800
commit246041de1b886ff446db4fe6a6ae4af0f39e5b99 (patch)
tree6a1ddf1f5dbf9c01ec4a6ea3bb324454e4ffde10
parent481684cacb2cc00cbdb35d52edb4aa5d5e3bec39 (diff)
downloadlinux-stable-246041de1b886ff446db4fe6a6ae4af0f39e5b99.tar.gz
linux-stable-246041de1b886ff446db4fe6a6ae4af0f39e5b99.zip
nbd: update size when connected
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>
-rw-r--r--drivers/block/nbd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 7a2101030683..7dc01bbb851f 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -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)