Linux block layer
 help / color / mirror / Atom feed
* [PATCH] nbd: don't set the device size until we're connected
@ 2017-10-09 17:12 Josef Bacik
  2017-10-09 18:29 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2017-10-09 17:12 UTC (permalink / raw)
  To: axboe, nbd-general, linux-block, kernel-team; +Cc: stable

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>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 883dfeb..baebbdf 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -243,7 +243,6 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
 	struct nbd_config *config = nbd->config;
 	config->blksize = blocksize;
 	config->bytesize = blocksize * nr_blocks;
-	nbd_size_update(nbd);
 }
 
 static void nbd_complete_rq(struct request *req)
@@ -1094,6 +1093,7 @@ static int nbd_start_device(struct nbd_device *nbd)
 		args->index = i;
 		queue_work(recv_workqueue, &args->work);
 	}
+	nbd_size_update(nbd);
 	return error;
 }
 
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nbd: don't set the device size until we're connected
  2017-10-09 17:12 [PATCH] nbd: don't set the device size until we're connected Josef Bacik
@ 2017-10-09 18:29 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2017-10-09 18:29 UTC (permalink / raw)
  To: Josef Bacik, nbd-general, linux-block, kernel-team; +Cc: stable

On 10/09/2017 11:12 AM, Josef Bacik wrote:
> 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.

Applied, thanks Josef.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-09 18:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-09 17:12 [PATCH] nbd: don't set the device size until we're connected Josef Bacik
2017-10-09 18:29 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox