[Toybox] [PATCH] losetup: fix the race.
enh
enh at google.com
Thu Aug 8 14:07:03 PDT 2019
On Thu, Aug 8, 2019 at 1:45 PM Ryan Prichard <rprichard at google.com> wrote:
>
> 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)
i think Rob thought that it would cure your race, but as he seems to
have discovered later (and i remember Tom explaining to me when i
asked him the same question months ago), it just moves the problem
around rather than actually fixing it.
> -Ryan
>
More information about the Toybox
mailing list