[PATCH] losetup: Create loop device if it does not exist

Jan Klötzke jan at kloetzke.net
Mon Oct 28 10:38:37 UTC 2019


On Mon, Oct 28, 2019 at 07:26:10AM +0100, Joerg Vehlow wrote:
> 
> 
> Am 23.10.2019 um 20:39 schrieb Stefan Seyfried:
> > Am 22.10.19 um 10:49 schrieb Joerg Vehlow:
> > > No interest in util-linux compatibility?
> > Is util-linux really creating the device node?
> > 
> > I thought it would use the current /dev/loop-control API and request a
> > new device from the kernel, which then is created via udev.
> > 
> You are right. I didn't think about udev, just saw different behavior.
> But in the end I think it doesn't really matter if udev or losetup creates
> the device. Losetup expects the device to be created somwhere in
> /.../loop#### anyway (with the path given by the caller). If the path was
> wrong,
> but still ended in /loop####, the device is created using the loop-control
> and
> not used afterwards. I am not sure what the upside of using udev is here.

Udev (or mdev for the matter) typically implements custom device node
policies like permissions, symlinks etc. They are also responsible to
create the device node if /dev is not mounted as devtmpfs. If losetup
creates the device node then it will probably race with
udev/mdev/devtmpfs.

/Jan

> But as far as compatibility is concerned, it would probably be better, if
> busybox uses loop-control with LOOP_CTL_ADD as well.
> 
> Jörg
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list