[LTP] [PATCH] lib: tst_device: Scale loop device detach timeout
Cyril Hrubis
chrubis@suse.cz
Thu Oct 22 15:07:46 CEST 2026
Hi!
> detach_loop_fd() retries LOOP_CLR_FD 40 times in 50ms steps, a fixed
> 2s timeout that ignores LTP_TIMEOUT_MUL. When another process still
> holds the loop device at cleanup for longer than that, e.g. on a
> loaded machine, the test ends with a spurious
> "ioctl(/dev/loopN, LOOP_CLR_FD, 0) no ENXIO for too long" TWARN.
>
> Scale the number of retries with tst_multiply_timeout(), which attach
> already uses since d90d20046 ("lib: Use backoff polling to wait for
> loop device nodes"). The default stays 2s, multiplied by 4 on kernels
> with slow kconfig options and by LTP_TIMEOUT_MUL. The 50ms polling
> step is kept, so the detach still finishes shortly after the device
> is released.
It would probably be better if we used the TST_RETRY_FN_EXP_BACKOFF() in
the detach loop instead so that the deatch is fast on fast device but we
do not poll unecessairly fast on slow devices.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list