Public bug reported:

== Summary ==
swapon01 in ubuntu_ltp_syscalls failed on stonking 7.3.0-11.12 generic arm64:
- swapon() on a swap file located on exfat fails with EINVAL (22).
- The same test passes on ext2, ext3, ext4, xfs, btrfs and vfat.
- Manually reproduced on a stonking 7.3.0-11-generic s390x VM (see Manual 
Reproduction below).

== Test Information ==
* SRU Cycle: sru-20261109
* Series: stonking
* Package: linux
* Kernel Version: 7.3.0-11.12
* Arch: arm64
* Cloud / Target: openstack
* Test Suite: ubuntu_ltp_syscalls
* Test Case: swapon01

== Failure Log ==
tst_test.c:1966: TINFO: === Testing on exfat ===
tst_test.c:1290: TINFO: Formatting /dev/loop0 with exfat opts='' extra opts=''
tst_test.c:1302: TINFO: Mounting /dev/loop0 to .../mntpoint fstyp=exfat flags=0
libswap.c:196: TINFO: create a swapfile size of 1 megabytes (MB)
tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
libswap.c:228: TFAIL: swapon() on exfat failed: EINVAL (22)
swapon01.c:39: TINFO: create a swapfile size of 128 megabytes (MB)
swapon01.c:25: TFAIL: tst_syscall(__NR_swapon, SWAP_FILE, 0) failed: EINVAL (22)
tst_test.c:1928: TINFO: If you are running on slow machine, try exporting 
LTP_TIMEOUT_MUL > 1
tst_test.c:1930: TBROK: Test killed! (timeout?)

Summary:
passed   6
failed   2
broken   1

== Manual Reproduction (stonking 7.3.0-11-generic, s390x VM) ==
exfat on a loop device, swap file preallocated with fallocate (as LTP does), 
then mkswap and swapon:

  fallocate -l 128M /mnt/exf/swapfile
  mkswap /mnt/exf/swapfile
  swapon /mnt/exf/swapfile
  -> swapon: ... swapon failed: Invalid argument
  dmesg: swapon: file /mnt/exf/swapfile has unallocated extents

Control: a file of the same size fully written with dd, then mkswap and swapon:
  -> succeeds ("Adding 131068k swap ... extents:1")

== Analysis ==
Verified by reading the Ubuntu-7.3.0-11.12 source:
* fs/exfat/inode.c:311 sets .swap_activate = exfat_iomap_swap_activate.
* fs/exfat/iomap.c:275-279 calls iomap_swapfile_activate() with the regular 
exfat_iomap_ops.
* fs/iomap/swapfile.c:149 makes iomap_swapfile_activate() walk the file with 
IOMAP_REPORT.
* fs/exfat/iomap.c:117-119: for offsets at or beyond valid_size, with 
IOMAP_REPORT set, exfat reports IOMAP_HOLE.
* fs/iomap/swapfile.c:97-107: IOMAP_HOLE is rejected as "has unallocated 
extents", which results in -EINVAL.
* A fallocate()d file keeps valid_size small, and mkswap only writes the 
header, so the rest of the file is reported as a hole.

The dmesg message in the manual reproduction matches this code path.

An upstream fix exists (not present in Ubuntu-7.3.0-11.12 fs/exfat/iomap.c):
* 4483ab85d1e0 ("exfat: map allocated extents for swap activation"), found in 
upstream v7.3-rc7..v7.4-rc3. It adds swap-specific iomap ops that clear 
IOMAP_REPORT, so preallocated ranges beyond valid_size are mapped instead of 
being reported as holes. SEEK_HOLE/SEEK_DATA behaviour is unchanged.
* I read the upstream commit message and the v7.4-rc3 fs/exfat/iomap.c; I did 
not test a kernel with this patch applied.

The LTP side was checked: exfat is in LTP's list of swap-capable
filesystems, so the test expectation is correct and the failure is not a
test issue.

== Hypothesis (not verified) ==
The final "TBROK: Test killed! (timeout?)" is most likely a consequence of the 
swapon failure: the test then puts itself in a cgroup with memory.max of 1 GB 
and allocates 1 GB of memory without any swap available. The whole case ran for 
about 5.7 seconds, far below its 90 second limit, so it is probably not a real 
timeout. I have no dmesg from the failing run to confirm an OOM kill.

== Suggested Next Steps ==
* Apply upstream commit 4483ab85d1e0 to the stonking 7.3 kernel and re-run 
swapon01.
* Other swap tests using exfat (e.g. swapon02/03, swapoff01/02) may show the 
same failure; not checked.

** Affects: ubuntu-kernel-tests
     Importance: Undecided
         Status: New

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: Invalid

** Affects: linux (Ubuntu Stonking)
     Importance: Undecided
         Status: New


** Tags: 7.3 amd64 arm64 generic openstack ppc64el s390x sru-20261109 stonking 
ubuntu-ltp-syscalls

** Summary changed:

- swapon01 in ubuntu_ltp_syscalls failed on stonking (7.3.0-11.12) generic 
arm64: swapon() on an exfat swap file fails with EINVAL
+ swapon* swapoff* in ubuntu_ltp_syscalls failed on stonking (swapon() on an 
exfat swap file fails with EINVAL)

** Tags added: amd64 ppc64el s390x

** Also affects: linux (Ubuntu Stonking)
   Importance: Undecided
       Status: New

** Changed in: linux (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2175013

Title:
  swapon* swapoff* in ubuntu_ltp_syscalls failed on stonking (swapon()
  on an exfat swap file fails with EINVAL)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2175013/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to