linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] block: fix MAINTAINERS email for nbd
@ 2018-05-16 18:36 Josef Bacik
  2018-05-16 18:36 ` [PATCH 2/5] nbd: do queue cleanup after del_gendisk Josef Bacik
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Josef Bacik @ 2018-05-16 18:36 UTC (permalink / raw)
  To: axboe, nbd, linux-block, kernel-team; +Cc: Josef Bacik

From: Josef Bacik <jbacik@fb.com>

I've been missing stuff because it's been going into my work email which
is a black hole.  Update to the email I actually use so I stop missing
patches and bug reports.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index df6e9bb2559a..10eca48b11b4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9700,7 +9700,7 @@ S:	Maintained
 F:	drivers/net/ethernet/netronome/
 
 NETWORK BLOCK DEVICE (NBD)
-M:	Josef Bacik <jbacik@fb.com>
+M:	Josef Bacik <josef@toxicpanda.com>
 S:	Maintained
 L:	linux-block@vger.kernel.org
 L:	nbd@other.debian.org
-- 
2.14.3

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

* [PATCH 2/5] nbd: do queue cleanup after del_gendisk
  2018-05-16 18:36 [PATCH 1/5] block: fix MAINTAINERS email for nbd Josef Bacik
@ 2018-05-16 18:36 ` Josef Bacik
  2018-05-16 18:36 ` [PATCH 3/5] nbd: clear_sock on netlink disconnect Josef Bacik
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2018-05-16 18:36 UTC (permalink / raw)
  To: axboe, nbd, linux-block, kernel-team; +Cc: Josef Bacik

From: Josef Bacik <jbacik@fb.com>

Apparently del_gendisk is actually supposed to happen first to cleanup
the sysfs stuff.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 drivers/block/nbd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 7b7b6143a126..7e83d6364b35 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -173,9 +173,12 @@ static const struct device_attribute pid_attr = {
 static void nbd_dev_remove(struct nbd_device *nbd)
 {
 	struct gendisk *disk = nbd->disk;
+	struct request_queue *q;
+
 	if (disk) {
-		blk_cleanup_queue(disk->queue);
+		q = disk->queue;
 		del_gendisk(disk);
+		blk_cleanup_queue(q);
 		blk_mq_free_tag_set(&nbd->tag_set);
 		disk->private_data = NULL;
 		put_disk(disk);
-- 
2.14.3

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

* [PATCH 3/5] nbd: clear_sock on netlink disconnect
  2018-05-16 18:36 [PATCH 1/5] block: fix MAINTAINERS email for nbd Josef Bacik
  2018-05-16 18:36 ` [PATCH 2/5] nbd: do queue cleanup after del_gendisk Josef Bacik
@ 2018-05-16 18:36 ` Josef Bacik
  2018-05-16 18:36 ` [PATCH 4/5] nbd: fix how we set bd_invalidated Josef Bacik
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2018-05-16 18:36 UTC (permalink / raw)
  To: axboe, nbd, linux-block, kernel-team; +Cc: Josef Bacik

From: Josef Bacik <jbacik@fb.com>

This is what the ioctl based nbd disconnect does as well.  Without this
the device will just sit there and wait for the connection to go away
(or IO to occur) before the device gets torn down.  Instead clear
everything up on our end so the configuration goes away as quickly as
possible.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 drivers/block/nbd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 7e83d6364b35..bc47bae9697a 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1765,6 +1765,7 @@ static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info)
 	}
 	mutex_lock(&nbd->config_lock);
 	nbd_disconnect(nbd);
+	nbd_clear_sock(nbd);
 	mutex_unlock(&nbd->config_lock);
 	if (test_and_clear_bit(NBD_HAS_CONFIG_REF,
 			       &nbd->config->runtime_flags))
-- 
2.14.3

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

* [PATCH 4/5] nbd: fix how we set bd_invalidated
  2018-05-16 18:36 [PATCH 1/5] block: fix MAINTAINERS email for nbd Josef Bacik
  2018-05-16 18:36 ` [PATCH 2/5] nbd: do queue cleanup after del_gendisk Josef Bacik
  2018-05-16 18:36 ` [PATCH 3/5] nbd: clear_sock on netlink disconnect Josef Bacik
@ 2018-05-16 18:36 ` Josef Bacik
  2018-05-16 18:36 ` [PATCH 5/5] nbd: call nbd_bdev_reset instead of bd_set_size on disconnect Josef Bacik
  2018-05-16 18:50 ` [PATCH 1/5] block: fix MAINTAINERS email for nbd Josef Bacik
  4 siblings, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2018-05-16 18:36 UTC (permalink / raw)
  To: axboe, nbd, linux-block, kernel-team; +Cc: Josef Bacik

From: Josef Bacik <jbacik@fb.com>

bd_invalidated is kind of a pain wrt partitions as it really only
triggers the partition rescan if it is set after bd_ops->open() runs, so
setting it when we reset the device isn't useful.  We also sporadically
would still have partitions left over in some disconnect cases, so fix
this by always setting bd_invalidated on open if there's no
configuration or if we've had a disconnect action happen, that way the
partition table gets invalidated and rescanned properly.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 drivers/block/nbd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index bc47bae9697a..24788bd10c8b 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -240,7 +240,10 @@ static void nbd_size_update(struct nbd_device *nbd)
 	blk_queue_physical_block_size(nbd->disk->queue, config->blksize);
 	set_capacity(nbd->disk, config->bytesize >> 9);
 	if (bdev) {
-		bd_set_size(bdev, config->bytesize);
+		if (bdev->bd_disk)
+			bd_set_size(bdev, config->bytesize);
+		else
+			bdev->bd_invalidated = 1;
 		bdput(bdev);
 	}
 	kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
@@ -961,10 +964,6 @@ static void nbd_bdev_reset(struct block_device *bdev)
 	if (bdev->bd_openers > 1)
 		return;
 	bd_set_size(bdev, 0);
-	if (max_part > 0) {
-		blkdev_reread_part(bdev);
-		bdev->bd_invalidated = 1;
-	}
 }
 
 static void nbd_parse_flags(struct nbd_device *nbd)
@@ -1279,6 +1278,9 @@ static int nbd_open(struct block_device *bdev, fmode_t mode)
 		refcount_set(&nbd->config_refs, 1);
 		refcount_inc(&nbd->refs);
 		mutex_unlock(&nbd->config_lock);
+		bdev->bd_invalidated = 1;
+	} else if (nbd_disconnected(nbd->config)) {
+		bdev->bd_invalidated = 1;
 	}
 out:
 	mutex_unlock(&nbd_index_mutex);
-- 
2.14.3

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

* [PATCH 5/5] nbd: call nbd_bdev_reset instead of bd_set_size on disconnect
  2018-05-16 18:36 [PATCH 1/5] block: fix MAINTAINERS email for nbd Josef Bacik
                   ` (2 preceding siblings ...)
  2018-05-16 18:36 ` [PATCH 4/5] nbd: fix how we set bd_invalidated Josef Bacik
@ 2018-05-16 18:36 ` Josef Bacik
  2018-05-16 18:50 ` [PATCH 1/5] block: fix MAINTAINERS email for nbd Josef Bacik
  4 siblings, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2018-05-16 18:36 UTC (permalink / raw)
  To: axboe, nbd, linux-block, kernel-team; +Cc: Josef Bacik

From: Josef Bacik <jbacik@fb.com>

We need to make sure we don't just set the size of the bdev to 0 while
it's being used by a file system.  We have the appropriate check in
nbd_bdev_reset, simply use that helper instead.

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 24788bd10c8b..abc0a815354f 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1127,7 +1127,7 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b
 	if (ret)
 		sock_shutdown(nbd);
 	mutex_lock(&nbd->config_lock);
-	bd_set_size(bdev, 0);
+	nbd_bdev_reset(bdev);
 	/* user requested, ignore socket errors */
 	if (test_bit(NBD_DISCONNECT_REQUESTED, &config->runtime_flags))
 		ret = 0;
-- 
2.14.3

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

* Re: [PATCH 1/5] block: fix MAINTAINERS email for nbd
  2018-05-16 18:36 [PATCH 1/5] block: fix MAINTAINERS email for nbd Josef Bacik
                   ` (3 preceding siblings ...)
  2018-05-16 18:36 ` [PATCH 5/5] nbd: call nbd_bdev_reset instead of bd_set_size on disconnect Josef Bacik
@ 2018-05-16 18:50 ` Josef Bacik
  4 siblings, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2018-05-16 18:50 UTC (permalink / raw)
  To: Josef Bacik; +Cc: axboe, nbd, linux-block, kernel-team, Josef Bacik

On Wed, May 16, 2018 at 02:36:01PM -0400, Josef Bacik wrote:
> From: Josef Bacik <jbacik@fb.com>
> 
> I've been missing stuff because it's been going into my work email which
> is a black hole.  Update to the email I actually use so I stop missing
> patches and bug reports.
> 

Ignore this series, I had assumed the previous patches I had sent were merged.
I've reworked everything and will send a new series.  Thanks,

Josef

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

end of thread, other threads:[~2018-05-16 18:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 18:36 [PATCH 1/5] block: fix MAINTAINERS email for nbd Josef Bacik
2018-05-16 18:36 ` [PATCH 2/5] nbd: do queue cleanup after del_gendisk Josef Bacik
2018-05-16 18:36 ` [PATCH 3/5] nbd: clear_sock on netlink disconnect Josef Bacik
2018-05-16 18:36 ` [PATCH 4/5] nbd: fix how we set bd_invalidated Josef Bacik
2018-05-16 18:36 ` [PATCH 5/5] nbd: call nbd_bdev_reset instead of bd_set_size on disconnect Josef Bacik
2018-05-16 18:50 ` [PATCH 1/5] block: fix MAINTAINERS email for nbd Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).