[Devel] [PATCH rh7 2/2] nbd: move setting the bd_invalidated out of the loop

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


bdev->bd_invalidated should be set only once, not once per connection.
Move it out of the loop.

Fixes: de0be3358f9b ("nbd: invalidate bdev after size update")
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 drivers/block/nbd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 362fe546cb2c..e4e30f650f9e 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -974,10 +974,11 @@ 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);
-		if (max_part)
-			bdev->bd_invalidated = 1;
 	}
 	nbd_size_update(nbd);
+	if (max_part)
+		bdev->bd_invalidated = 1;
+
 	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