On Mon, Mar 3, 2014 at 1:16 PM, Andreas Klauer <[email protected]> wrote: > On Mon, Mar 03, 2014 at 06:41:47PM +0100, Andreas Klauer wrote: >> Is there something I'm missing? > > Sorry, I see this has been discussed earlier on this list: > > http://sourceforge.net/p/nbd/mailman/message/31467855/ > > Another thing I found is a patch for qemu-nbd: > (the patch didn't seem to make it though) > > http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg02201.html > > That patch discussion also mentions a NBD_SET_LOCK but I could not > find any other reference to that... > > So the method seems to be: > > 1) check /proc/partitions > 2) check /sys/block/nbd*/pid > 3) lock your own program and hope no-one is racing you
Yes, that's basically it. And if any ioctl returns -EBUSY, then retry from the start. BTW, "losetup --find" just looks at /proc/partitions. ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk _______________________________________________ Nbd-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nbd-general
