[Devel] [PATCH rh7 1/2] nbd: move nbd_size_update() of of the loop.

Andrey Ryabinin aryabinin at virtuozzo.com
Tue Nov 5 13:39:56 MSK 2019


nbd_size_update() should be called only once, not once per-connection.
Move it out of the loop.

Fixes: 584f48d40cbc ("nbd: don't set the device size until we're connected")
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 drivers/block/nbd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 79de456643cf..362fe546cb2c 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -974,11 +974,10 @@ 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);
 		if (max_part)
 			bdev->bd_invalidated = 1;
-
 	}
+	nbd_size_update(nbd);
 	error = wait_event_interruptible(config->recv_wq,
 					 atomic_read(&config->recv_threads) == 0);
 	if (error)
-- 
2.23.0



More information about the Devel mailing list