All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v3 0/3] tst_device: add support for overlayfs
@ 2025-02-17 21:46 Jeff Moyer
  2025-02-17 21:46 ` [LTP] [PATCH v3 1/3] lib/tst_device.c: factor out btrfs-specific logic from tst_find_backing_dev Jeff Moyer
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Jeff Moyer @ 2025-02-17 21:46 UTC (permalink / raw)
  To: ltp

When running ltp-aiodio on an overlay file system, the following error
occurs:

tst_tmpdir.c:316: TINFO: Using /mnt/fstests/TEST_DIR/ovl-mnt/ltp-hSHEHy5M0s/LTP_aio4q4GMW as tmpdir (overlayfs filesystem)
tst_test.c:1888: TINFO: LTP version: 20220121-2271-g91a10df22
tst_test.c:1892: TINFO: Tested kernel: vendor kernel
tst_test.c:1723: TINFO: Timeout per run is 0h 40m 00s
aiocp.c:211: TINFO: Maximum AIO blocks: 65536
tst_device.c:551: TINFO: Use BTRFS specific strategy
tst_device.c:569: TBROK: BTRFS ioctl failed. Is . on a tmpfs?: ENOTTY (25)

The issue is that stat(2) on an overlayfs mount point will return a
major device number of 0.  The code assumes this is btrfs, and tries
to issue a btrfs-specific ioctl.  When that fails, the final message is
printed that suggests this might be tmpfs.

I modified the code to use statfs(2) to get the file system type, and
use that to determine which file system specific code to call.
Finally, I added code to parse out the upper directory from the
overlayfs mount options using a combination of /proc/self/mountinfo
and /proc/self/mounts, as explained in patch 3.  stat(2) is then
called on the upper directory to get to the underlying device node.

I tested this on xfs, btrfs, a btrfs subvolume and overlayfs.  Review
of the series is greatly appreciated.

Thanks in advance!
Jeff

[PATCH v3 1/3] lib/tst_device.c: factor out btrfs-specific logic from
[PATCH v3 2/3] lib/tst_device.c: check for BTRFS_SUPER_MAGIC instead
[PATCH v3 3/3] tst_find_backing_dev(): add support for overlayfs
---
Changes since v2:
- Address review comments from Petr:
  - Use test-defined magic numbers
  - #include statfs.h instead of vfs.h.
  - Don't split long strings across lines
- Add Reviewed-by tag for patch 1.

Changes since v1:
- Remove dependency on libmount in patch 3.  Patches 1 and 2 are
  unchanged.


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-03-04 21:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17 21:46 [LTP] [PATCH v3 0/3] tst_device: add support for overlayfs Jeff Moyer
2025-02-17 21:46 ` [LTP] [PATCH v3 1/3] lib/tst_device.c: factor out btrfs-specific logic from tst_find_backing_dev Jeff Moyer
2025-02-20 10:23   ` Cyril Hrubis
2025-02-17 21:46 ` [LTP] [PATCH v3 2/3] lib/tst_device.c: check for BTRFS_SUPER_MAGIC instead of device major of 0 Jeff Moyer
2025-02-18 12:50   ` Petr Vorel
2025-02-18 19:54     ` Jeff Moyer
2025-02-20 10:24   ` Cyril Hrubis
2025-02-20 11:53     ` Petr Vorel
2025-02-17 21:46 ` [LTP] [PATCH v3 3/3] tst_find_backing_dev(): add support for overlayfs Jeff Moyer
2025-02-18 12:57   ` Petr Vorel
2025-02-18 20:01     ` Jeff Moyer
2025-02-20  4:12       ` Petr Vorel
2025-02-20 11:15   ` Cyril Hrubis
2025-03-04 21:15     ` Jeff Moyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.