[RHEL7,COMMIT] nbd: move setting the bd_invalidated out of the loop

Submitted by Konstantin Khorenko on Nov. 6, 2019, 5:29 a.m.

Details

Message ID 201911060529.xA65Ta9J030706@finist-ce7.sw.ru
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko Nov. 6, 2019, 5:29 a.m.
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.10
------>
commit ec27fd87086adfa65b39d8aae3a50177ed93bc1e
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Wed Nov 6 08:29:36 2019 +0300

    nbd: move setting the bd_invalidated out of the loop
    
    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@virtuozzo.com>
---
 drivers/block/nbd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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)