Skip to content

Commit 639812a

Browse files
Josef Bacikaxboe
authored andcommitted
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: [email protected] Fixes: 29eaadc ("nbd: stop using the bdev everywhere") Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 09aa97c commit 639812a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/block/nbd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
243243
struct nbd_config *config = nbd->config;
244244
config->blksize = blocksize;
245245
config->bytesize = blocksize * nr_blocks;
246-
nbd_size_update(nbd);
247246
}
248247

249248
static void nbd_complete_rq(struct request *req)
@@ -1094,6 +1093,7 @@ static int nbd_start_device(struct nbd_device *nbd)
10941093
args->index = i;
10951094
queue_work(recv_workqueue, &args->work);
10961095
}
1096+
nbd_size_update(nbd);
10971097
return error;
10981098
}
10991099

0 commit comments

Comments
 (0)