[LTP] [PATCH] tst_detach_device: Clear leftover partitions

Petr Vorel pvorel@suse.cz
Fri Dec 12 15:39:04 CET 2025


Hi Martin,

> Some kernels have a race condition during loop device release
> which results in partitions being left over on unattached device.
> The partitions then cause mkfs.vfat failures in later tests.

> Check for loop device partitions after detaching it and clear them
> if necessary.

Nice work, thanks!

Looping ioctl_loop01.c and ioctl_ficlone02.c I reproduce the problem after 171
iterations:

ioctl_loop01.c:75: TPASS: access /sys/block/loop0/loop0p1 succeeds
tst_device.c:321: TWARN: Detached device /dev/loop0 has leftover partitions

Kind regards,
Petr


More information about the ltp mailing list