Re: do not allow two nbd-clients at same time

Paul Clements
2009-01-12T14:01:20Z

Pavel Machek wrote:
> Two nbd-clients at same time are bad idea, and cause WARN_ON from nbd
> in 2.6.28-rc7 from sysfs_add_one. This simply prevents that from
> happening.

Thanks for this. But I think we also need the following:

--- drivers/block/nbd.c 2008-12-24 18:26:37.000000000 -0500
+++ drivers/block/nbd.c 2009-01-12 08:50:17.000000000 -0500
@@ -406,6 +406,7 @@ static int nbd_do_it(struct nbd_device *
ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj,
&pid_attr.attr);
if (ret) {
printk(KERN_ERR "nbd: sysfs_create_file failed!");
+ lo->pid = 0;
return ret;
}

To zero out pid in the error case. Otherwise, it looks good.

Thanks,
Paul