<div dir="ltr"><div dir="ltr">On Thu, Aug 8, 2019 at 5:51 AM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 8/6/19 5:08 PM, Ryan Prichard wrote:<br>
> On Tue, Aug 6, 2019 at 1:56 PM Rob Landley <<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a><br>
> <mailto:<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>>> wrote:<br>
> <br>
> On 8/5/19 7:40 PM, Ryan Prichard via Toybox wrote:<br>
> > I think this patch fixes a race I noticed, but in practice I was hitting a<br>
> > different race. After LOOP_CTL_GET_FREE had created a new loop device, losetup<br>
> > tried to open /dev/block/loopXXX before the device file existed,<br>
> <br>
> Why is the ioctl returning before the block device exists?<br>
> <br>
> <br>
> I think the /dev/block/loopXXX file is created by a userspace daemon (probably<br>
> ueventd in Android). The ioctl creates the kernel device, then sends an<br>
> asynchronous uevent message to ueventd about the new device. ueventd and losetup<br>
> then race each other to create the file and to open it.<br>
<br>
So wait, you're _not_ using devtmpfs?<br></blockquote><div><br></div><div>The Android devices I've seen all use an ordinary tmpfs on /dev, not devtmpfs.</div><div><br></div><div>(on a walleye device)</div><div>$ adb shell mount | grep ' /dev '<br>tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,size=1853688k,nr_inodes=463422,mode=755)<br></div><div><br></div><div>-Ryan</div><div><br></div></div></div>