All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file
@ 2026-06-08 15:52 Jan Polensky
  2026-06-08 16:29 ` [LTP] " linuxtestproject.agent
  2026-06-09  9:19 ` [LTP] [PATCH v1 1/1] " Cyril Hrubis
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Polensky @ 2026-06-08 15:52 UTC (permalink / raw)
  To: ltp

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 <japo@linux.ibm.com>
---
 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

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

* Re: [LTP] swap: Add exfat to filesystems requiring tst_fill_file
  2026-06-08 15:52 [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file Jan Polensky
@ 2026-06-08 16:29 ` linuxtestproject.agent
  2026-06-09  9:19 ` [LTP] [PATCH v1 1/1] " Cyril Hrubis
  1 sibling, 0 replies; 4+ messages in thread
From: linuxtestproject.agent @ 2026-06-08 16:29 UTC (permalink / raw)
  To: Jan Polensky; +Cc: ltp

Hi Jan,

On 08 Jun 2026, Jan Polensky wrote:
> swap: Add exfat to filesystems requiring tst_fill_file

Verdict: Reviewed

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

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

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

* Re: [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file
  2026-06-08 15:52 [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file Jan Polensky
  2026-06-08 16:29 ` [LTP] " linuxtestproject.agent
@ 2026-06-09  9:19 ` Cyril Hrubis
  2026-06-09 14:17   ` Jan Polensky
  1 sibling, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2026-06-09  9:19 UTC (permalink / raw)
  To: Jan Polensky; +Cc: ltp

Hi!
> 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 <japo@linux.ibm.com>
> ---
>  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");
>  	}

The swapon01 works for me for exfat without this change. Where does this
fail (arch, kernel, OS, is exfat in kernel or FUSE, etc.)?

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file
  2026-06-09  9:19 ` [LTP] [PATCH v1 1/1] " Cyril Hrubis
@ 2026-06-09 14:17   ` Jan Polensky
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Polensky @ 2026-06-09 14:17 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

On Tue, Jun 09, 2026 at 11:19:19AM +0200, Cyril Hrubis wrote:
> Hi!
> > 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 <japo@linux.ibm.com>
> > ---
> >  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");
> >  	}
>
Hi Cyril,
> The swapon01 works for me for exfat without this change. Where does this
> fail (arch, kernel, OS, is exfat in kernel or FUSE, etc.)?

The failure occurred on:
 - Architecture: s390x
 - Kernel: 7.1.0-20260608.rc7.git374.a87737435cfa.300.fc44.s390x+next
   (linux-next and since ~ 17 days)
 - OS: Fedora Linux 44
 - exfat: Kernel module (not FUSE)

The issue manifests when swapon(2) is called on an exfat swap file that was
created using only fallocate() without actual data writes. The kernel rejects
the swap file with EINVAL because it detects unallocated extents.

This is similar to the existing XFS behavior where tst_fill_file() is already
required. Both filesystems need actual data writes (not just metadata
allocation via fallocate) to ensure swap files are fully allocated before
swapon(2) can activate them.

The patch ensures consistent behavior across filesystems that have this
requirement.

Best regards,
Jan
>
> --
> Cyril Hrubis
> chrubis@suse.cz

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

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

end of thread, other threads:[~2026-06-09 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08 15:52 [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file Jan Polensky
2026-06-08 16:29 ` [LTP] " linuxtestproject.agent
2026-06-09  9:19 ` [LTP] [PATCH v1 1/1] " Cyril Hrubis
2026-06-09 14:17   ` Jan Polensky

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.