Skip to contentSkip to conversation

block: fix MAINTAINERS email for nbd

PATCH In review Josef Bacik 1 participant 6 messages May 16, 2018

Subsystems (2)
lore
Share & tools
lore

Josef Bacik

author maintainer
#0 lore raw

PATCH 1/5 block: fix MAINTAINERS email for nbd

From: Josef Bacik <[email protected]>

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.

---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
index df6e9bb2559a..10eca48b11b4 100644
@@ -9700,7 +9700,7 @@ S:	Maintained
 F:	drivers/net/ethernet/netronome/
 
 NETWORK BLOCK DEVICE (NBD)
-M:	Josef Bacik <[email protected]>
+M:	Josef Bacik <[email protected]>
 S:	Maintained
 L:	[email protected]
 L:	[email protected]
Signature · 1 line
2.14.3
author maintainer
#1 lore raw

PATCH 2/5 nbd: do queue cleanup after del_gendisk

From: Josef Bacik <[email protected]>

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

---
 drivers/block/nbd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/block/nbd.c +4 -1
index 7b7b6143a126..7e83d6364b35 100644
@@ -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);
Signature · 1 line
2.14.3
author maintainer
#2 lore raw

PATCH 3/5 nbd: clear_sock on netlink disconnect

In reply to Josef Bacik

From: Josef Bacik <[email protected]>

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.

---
 drivers/block/nbd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/block/nbd.c +1 -0
index 7e83d6364b35..bc47bae9697a 100644
@@ -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))
Signature · 1 line
2.14.3
author maintainer
#3 lore raw

PATCH 4/5 nbd: fix how we set bd_invalidated

In reply to Josef Bacik

From: Josef Bacik <[email protected]>

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.

---
 drivers/block/nbd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/nbd.c +7 -5
index bc47bae9697a..24788bd10c8b 100644
@@ -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);
Signature · 1 line
2.14.3
author maintainer
#4 lore raw

PATCH 5/5 nbd: call nbd_bdev_reset instead of bd_set_size on disconnect

In reply to Josef Bacik

From: Josef Bacik <[email protected]>

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.

---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nbd.c +1 -1
index 24788bd10c8b..abc0a815354f 100644
@@ -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;
Signature · 1 line
2.14.3
author maintainer
#5 lore raw
In reply to Josef Bacik
Quoted 6 lines · Josef Bacik

From: Josef Bacik <[email protected]>

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