nbd: don't set the device size until we're connected
authorJosef Bacik <jbacik@fb.com>
Mon, 9 Oct 2017 17:12:10 +0000 (13:12 -0400)
committerJens Axboe <axboe@kernel.dk>
Mon, 9 Oct 2017 18:29:22 +0000 (12:29 -0600)
commit639812a1ed9bf49ae2c026086fbf975339cd1eef
tree8159e04a521c4345eea2d6d47be9e2995d0b8f62
parent09aa97c78a784df2f781ff03b57b7dd6f1339edc
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: stable@vger.kernel.org
Fixes: 29eaadc ("nbd: stop using the bdev everywhere")
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c