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

From: Paul Clements
Date: Mon Jan 12 2009 - 09:01:22 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/