[Devel] [PATCH RHEL7 COMMIT] ms/nbd: don't set the device size until we're connected
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Nov 5 11:06:16 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-1062.4.1.vz7.115.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.4.1.vz7.115.7
------>
commit 5f668a634ca9a60c2636698c8825a97f3abd430a
Author: Josef Bacik <jbacik at fb.com>
Date: Tue Nov 5 11:06:15 2019 +0300
ms/nbd: don't set the device size until we're connected
A user reported a regression with using the normal ioctl interface on
newer kernels. This happens because I was setting the device size
before the device was actually connected, which caused us to error out
and close everything down. This didn't happen on netlink because we
hold the device lock the whole time we're setting things up, but we
don't do that for the ioctl path. This fixes the problem.
Cc: stable at vger.kernel.org
Fixes: 29eaadc ("nbd: stop using the bdev everywhere")
Signed-off-by: Josef Bacik <jbacik at fb.com>
Signed-off-by: Jens Axboe <axboe at kernel.dk>
https://jira.sw.ru/browse/PSBM-99102
(cherry picked from commit 639812a1ed9bf49ae2c026086fbf975339cd1eef)
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
drivers/block/nbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 6713deae68cb..9e0450300cc1 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -205,7 +205,6 @@ 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;
- nbd_size_update(nbd);
}
static void nbd_end_request(struct nbd_cmd *cmd)
@@ -966,6 +965,7 @@ static int nbd_start_device(struct nbd_device *nbd, struct block_device *bdev)
args->nbd = nbd;
args->index = i;
queue_work(recv_workqueue, &args->work);
+ nbd_size_update(nbd);
}
error = wait_event_interruptible(config->recv_wq,
atomic_read(&config->recv_threads) == 0);
More information about the Devel
mailing list