Skip to contentSkip to conversation

nbd: set the default nbds_max to 0

RFC PATCH In review [email protected] 2 participants 3 messages May 29, 2019 – May 30, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 nbd: set the default nbds_max to 0

From: Xiubo Li <[email protected]>

There is one problem that when trying to check the nbd device NBD_CMD_STATUS and at the same time insert the nbd.ko module, we can randomly get some of the 16 /dev/nbd{0~15} are connected, but they are not. This is because that the udev service in user space will try to open /dev/nbd{0~15} devices to do some sanity check when they are added in "__init nbd_init()" and then close it asynchronousely.

---

Not sure whether this patch make sense here, coz this issue can be avoided by setting the "nbds_max=0" when inserting the nbd.ko modules.

 drivers/block/nbd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/nbd.c +2 -2
index 4c1de1c..98be6ca 100644
@@ -137,7 +137,7 @@ struct nbd_cmd {
 
 #define NBD_DEF_BLKSIZE 1024
 
-static unsigned int nbds_max = 16;
+static unsigned int nbds_max;
 static int max_part = 16;
 static struct workqueue_struct *recv_workqueue;
 static int part_shift;
@@ -2310,6 +2310,6 @@ static void __exit nbd_cleanup(void)
 MODULE_LICENSE("GPL");
 
 module_param(nbds_max, int, 0444);
-MODULE_PARM_DESC(nbds_max, "number of network block devices to initialize (default: 16)");
+MODULE_PARM_DESC(nbds_max, "number of network block devices to initialize (default: 0)");
 module_param(max_part, int, 0444);
 MODULE_PARM_DESC(max_part, "number of partitions per device (default: 16)");
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 10 lines · On Wed, May 29, 2019 at 04:08:36PM +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

There is one problem that when trying to check the nbd device NBD_CMD_STATUS and at the same time insert the nbd.ko module, we can randomly get some of the 16 /dev/nbd{0~15} are connected, but they are not. This is because that the udev service in user space will try to open /dev/nbd{0~15} devices to do some sanity check when they are added in "__init nbd_init()" and then close it asynchronousely.

Quoted 6 lines

---

Not sure whether this patch make sense here, coz this issue can be avoided by setting the "nbds_max=0" when inserting the nbd.ko modules.

Yeah I'd rather not make this the default, as of right now most people still probably use the old method of configuration and it may surprise them to suddenly have to do nbds_max=16 to make their stuff work. Thanks,

Josef

author
#2 lore raw
Quoted 14 lines · Josef Bacik
Quoted 13 lines · On Wed, May 29, 2019 at 04:08:36PM +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

There is one problem that when trying to check the nbd device NBD_CMD_STATUS and at the same time insert the nbd.ko module, we can randomly get some of the 16 /dev/nbd{0~15} are connected, but they are not. This is because that the udev service in user space will try to open /dev/nbd{0~15} devices to do some sanity check when they are added in "__init nbd_init()" and then close it asynchronousely.

---

Quoted 6 lines
Quoted 3 lines

Not sure whether this patch make sense here, coz this issue can be avoided by setting the "nbds_max=0" when inserting the nbd.ko modules.

Yeah I'd rather not make this the default, as of right now most people still probably use the old method of configuration and it may surprise them to suddenly have to do nbds_max=16 to make their stuff work. Thanks,

Sure, make sense to me :-)

So this patch here in the mail list will as one note and reminder to other who may hit the same issue in future.

Thanks.
BRs
Xiubo

Quoted 2 lines

Josef