[Toybox] [PATCH] losetup: fix the race.

Ryan Prichard rprichard at google.com
Thu Aug 8 13:45:38 PDT 2019


On Thu, Aug 8, 2019 at 5:51 AM Rob Landley <rob at landley.net> wrote:

> On 8/6/19 5:08 PM, Ryan Prichard wrote:
> > On Tue, Aug 6, 2019 at 1:56 PM Rob Landley <rob at landley.net
> > <mailto:rob at landley.net>> wrote:
> >
> >     On 8/5/19 7:40 PM, Ryan Prichard via Toybox wrote:
> >     > I think this patch fixes a race I noticed, but in practice I was
> hitting a
> >     > different race. After LOOP_CTL_GET_FREE had created a new loop
> device, losetup
> >     > tried to open /dev/block/loopXXX before the device file existed,
> >
> >     Why is the ioctl returning before the block device exists?
> >
> >
> > I think the /dev/block/loopXXX file is created by a userspace daemon
> (probably
> > ueventd in Android). The ioctl creates the kernel device, then sends an
> > asynchronous uevent message to ueventd about the new device. ueventd and
> losetup
> > then race each other to create the file and to open it.
>
> So wait, you're _not_ using devtmpfs?
>

The Android devices I've seen all use an ordinary tmpfs on /dev, not
devtmpfs.

(on a walleye device)
$ adb shell mount | grep ' /dev '
tmpfs on /dev type tmpfs
(rw,seclabel,nosuid,relatime,size=1853688k,nr_inodes=463422,mode=755)

-Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20190808/f677f6c1/attachment-0001.htm>


More information about the Toybox mailing list