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

Rob Landley rob at landley.net
Tue Aug 6 13:58:44 PDT 2019


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?

If the ioctl returns success but the loop device doesn't exist... that really
sounds like a kernel bug. Can open() return when the file doesn't exist in the
filesystem yet?

> Maybe losetup can (busy) loop when open fails on ENOENT?

I can add a workaround for the obvious kernel bug, yes. Or the kernel could get
fixed.

Rob



More information about the Toybox mailing list