Commit 242a49e5c878 ("nbd: freeze the queue for queue limits updates") added the freeze to keep in-flight commands from seeing torn queue_limits. But at startup the capacity is still 0 (invalidate_disk cleared it) and the write cache is off (the previous patch cleared it on disconnect, and nbd_set_size sets it back only after the commit), so submit_bio_noacct() rejects any bio before it reaches the driver and no I/O is in flight. Drop the freeze by checking capacity and write cache state in nbd_set_size. Reviewed-by: Yu Kuai Signed-off-by: Yang Erkun --- drivers/block/nbd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index cb7c1f8502f4..cb662ae4b91d 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -375,7 +375,11 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize, loff_t blksize) nbd_apply_limits(&lim, nbd->config->flags); lim.logical_block_size = blksize; lim.physical_block_size = blksize; - error = queue_limits_commit_update_frozen(nbd->disk->queue, &lim); + /* No need freeze with 0 capacity and write cache disabled */ + if (!get_capacity(nbd->disk) && !blk_queue_write_cache(nbd->disk->queue)) + error = queue_limits_commit_update(nbd->disk->queue, &lim); + else + error = queue_limits_commit_update_frozen(nbd->disk->queue, &lim); if (error) return error; -- 2.52.0