]> 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>
Fri, 13 Nov 2020 11:19:55 +0000 (12:19 +0100)
commitb3e985bd569922348f2c5679a43dc90a3d2b1427
tree1688b9082c29ceb72a4dd50b108142df207515f9
parente5e89655d353ba1612edb19f75e36065336aa9c4
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