[LTP] [PATCH] syscalls: Check for leftover partition info in loopdev ioctl tests

Martin Doucha mdoucha@suse.cz
Tue Apr 26 18:14:08 CEST 2022


On 25. 04. 22 17:21, Cyril Hrubis wrote:
> Hi!
>> Due to a kernel bug, successful ioctl09 and ioctl_loop01 test runs
>> sometimes leave behind stale partition info on the loop device they used,
>> which then causes mkfs.vfat to fail in later tests. Check that partition
>> info was properly removed in cleanup.
>>
>> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
>> ---
>>
>> This does not fix the mkfs.vfat failures but it makes the true cause visible.
>> We could add a workaround for the mkfs.vfat failures by simply initializing
>> the loop device with the LO_FLAGS_PARTSCAN flag by default, or at least when
>> stale partition info is found by tst_find_free_loopdev().
> 
> I guess that it would be cleaner to put the stale partition info
> detection into the loop library. We can print a warning there and then
> do the workaround.

The workaround needs to be added into tst_attach_device(). It doesn't
make sense to add it to test cleanup, in part because
tst_detach_device() can and occasionally does fail on timeout.

On the other hand, we need a cleanup check in ioctl tests which create
partitions on loop devices, otherwise they'll leave garbage behind silently.

> Also do we want to add a regression test for the stale partition info?
> Should be easy enough. Or at least add the hash of the kernel commit
> that fixed it to the ioctl tests?

I haven't investigated deep enough to find out how to reliably trigger
the bug or which patch fixed it (if any). Regression test would be nice
but it's not a trivial task at the moment.

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


More information about the ltp mailing list