]> git.ipfire.org Git - thirdparty/systemd.git/commit
loop-util: LOOP_CLR_FD is async, don't retry to reuse a device right after issuing it
authorLennart Poettering <lennart@poettering.net>
Fri, 25 Sep 2020 13:22:48 +0000 (15:22 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 22 Oct 2020 12:58:27 +0000 (14:58 +0200)
commit95c5009248086f8a6fd86808654072adb1395afa
tree6fdbaf0e9d526d5baa71cf4c3722ece80d4505ad
parent738f29cb53b457ca0c17885f119de5bc1f10dead
loop-util: LOOP_CLR_FD is async, don't retry to reuse a device right after issuing it

When we fall back to classic LOOP_SET_FD logic in case LOOP_CONFIGURE
didn't work we issue LOOP_CLR_FD first. But that call turns out to be
potentially async in the kernel: if something else (let's say
udev/blkid) is accessing the device the ioctl just sets the autoclear
flag and exits. Hence quite often the LOOP_SET_FD will subsequently
fail. Let's avoid the trouble, and immediately exit with EBUSY if
LOOP_CONFIGURE fails, and but remember that LOOP_CONFIGURE is not
available so that on the next iteration we go directly for LOOP_SET_FD
instead.
src/shared/loop-util.c