]> git.ipfire.org Git - thirdparty/util-linux.git/commit
losetup: avoid infinite busy loop
authorKarel Zak <kzak@redhat.com>
Tue, 13 Oct 2020 08:31:42 +0000 (10:31 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 13 Oct 2020 08:58:04 +0000 (10:58 +0200)
commit3ff6fb802de1efafbd90af228f91461691ac190c
tree28b26165313f2c75a9390eaa35b5aace3b271477
parenta83bea2d3d8ca53a078ab23049b00ec93f6887bc
losetup: avoid infinite busy loop

issue report:
 if i run the heavy duty test from #16859 a couple of times I can get
 the loopback layer in the kernel into a state where there's a loopback
 block device allocated, that you can open, but where both LOOP_CLR_FD
 and _SET_FD fail with EBUSY. and /dev/loop-control still returns it as
 the next free one...  weird state util-linux losetup when called to
 allocate a new device then freezes

This commit:
* restrict number of attempts to 16
* use 200000ms sleep between attempts
* add note about non-atomic loop device setup to the man page

Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/losetup.8
sys-utils/losetup.c