[LTP] [PATCH 2/3] swapon04: Add test for discard flags

Andrea Cervesato andrea.cervesato@suse.com
Fri Aug 28 11:02:02 CEST 2026


> > this is interesting. Also I notice how it's hard to read the logs, so
> > I need a TINFO before the checks. But technically, this could be a kernel
> > bug: can you please add a sync() before stat() while we are getting the
> > blocks_after? We might need to flush the cache before reading the blocks.
> > 
> > 	fd = SAFE_OPEN(BACKING_FILE, O_RDONLY);
> > 	SAFE_FSYNC(fd);
> > 	SAFE_CLOSE(fd);
> > 
> 
> It doesn't work — even with the fsync() added above, the problem is
> still reproducible. I agree it's likely a kernel bug, because I tried
> on c10s (6.12) and c9s (5.14) and couldn't reproduce the issue there.
> 
> Only on kernel-v6.6-* fail:
> 
> # LTP_SINGLE_FS_TYPE=xfs ./swapon04 -i 100
> 
> swapon04.c:174: TPASS: blocks_after == blocks_before (32768)
> swapon04.c:172: TPASS: blocks_after <= max_header_blocks (8 <= 16)
> swapon04.c:174: TPASS: blocks_after == blocks_before (32768)
> swapon04.c:174: TPASS: blocks_after == blocks_before (32768)
> swapon04.c:174: TFAIL: blocks_after (32768) != blocks_before (65408)
> swapon04.c:172: TFAIL: blocks_after (32648) > max_header_blocks (16)

did you move fsync() after filling the file and it's still failing?
then most likely it's a kernel bug.

I will send a new version with the fsync() as well, and a TINFO
message to show what test case we are running in.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list