[PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file

Jan Polensky <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
exfat, like XFS, requires actual data writes (not just fallocate) to
fully allocate swap files. Without this, swapon(2) fails with EINVAL
due to unallocated extents.

This matches the kernel's requirement that swap files must be fully
allocated before activation.

Signed-off-by: Jan Polensky <[email protected]>
---
 libs/swap/tse_swap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libs/swap/tse_swap.c b/libs/swap/tse_swap.c
index ae3c193132e6..e321cb1dfe63 100644
--- a/libs/swap/tse_swap.c
+++ b/libs/swap/tse_swap.c
@@ -177,8 +177,9 @@ int make_swapfile(const char *file, const int lineno,
 	if (prealloc_contiguous_file(swapfile, blk_size, blocks) != 0)
 		tst_brk_(file, lineno, TBROK, "Failed to create swapfile");
 
-	/* Fill the file if needed (specific to old xfs filesystems) */
-	if (tst_fs_type(swapfile) == TST_XFS_MAGIC) {
+	/* Fill the file if needed (specific to xfs and exfat filesystems) */
+	long fs_type = tst_fs_type(swapfile);
+	if (fs_type == TST_XFS_MAGIC || fs_type == TST_EXFAT_MAGIC) {
 		if (tst_fill_file(swapfile, 0, blk_size, blocks) != 0)
 			tst_brk_(file, lineno, TBROK, "Failed to fill swapfile");
 	}
-- 
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.