[dm-devel] [PATCH] improve atomicity of device creation

Kay Sievers kay.sievers at vrfy.org
Tue Dec 11 17:51:31 UTC 2007


On Dec 11, 2007 6:18 PM, Scott James Remnant <scott at ubuntu.com> wrote:
> On Tue, 2007-12-11 at 17:03 +0000, Alasdair G Kergon wrote:
>
> > On Tue, Dec 11, 2007 at 04:42:13PM +0000, Scott James Remnant wrote:
> > > What is that agreed design?
> >
> > In simple terms:
> >
> > - udev takes over full responsibility for creating nodes
> > [this will probably be a ./configure option]
> >
> Excellent, this is what we've wanted for a while.

Sounds fine.

> > - udev provides interface we use to wait until it has finished
> > processing all the outstanding requests we sent it.
> >
> What's this interface?
>
> I had a proposed patch that made udev write its sequence number to the
> kernel, and thus allowed any kobject add event to have a "bottom half"
> that could happen when udev had finished.  The idea was that the
> existing ioctls could then just block.

You want to block processes (doing ioctl) until udev has finished? Like a
kernel userspace transaction? Where could you see which requests you
will need to fulfill to continue the hanging processes?

It could work, but if something goes wrong, it seems pretty hard to recover
from such a failure. Just remember how firmware loading works. :)

> The other patch we tried a couple of releases ago was have devmapper
> spin until udev had caught up.

The currently running udev events are in: /dev/.udev/queue/<seqnum>. The last
seqnum that arrived in the udev daemon is: /dev/.udev/uevent_seqnum. So udev's
state is exported.

We can make the kernel's kobject_uevent() return the generated seqnum to
the caller. A devmapper ioctl, an existing one to extend, or a new one like
"create node" can return the seqnum to libdevmapper. Libdevmapper then
checks and spins until  /dev/.udev/uevent_seqnum has seen the seqnum,
and /dev/.udev/queue/<seqnum> does not exist.

Kay




More information about the dm-devel mailing list