* [REGRESSION] exfat: swapon(2) fails with EINVAL after iomap conversion
@ 2026-06-03 11:02 Jan Polensky
2026-06-03 11:10 ` Namjae Jeon
0 siblings, 1 reply; 6+ messages in thread
From: Jan Polensky @ 2026-06-03 11:02 UTC (permalink / raw)
To: Namjae Jeon, linux-fsdevel
Cc: Sungjong Seo, Yuezhang Mo, Christoph Hellwig, Darrick J . Wong,
linux-kernel, regressions, Jan Polensky
Hi,
we are seeing a regression on linux-next after commit
614f71ca1bdfaa2f25a6f147fe22f3ad031f8e2b
("exfat: add iomap buffered I/O support")
With this change, swapon(2) on an exfat swapfile fails with EINVAL.
Observed fallout in LTP:
swapoff01
swapoff02
swapon01
swapon02
swapon03
Example failure:
tst_test.c:1980: TINFO: === Testing on exfat ===
tst_test.c:1291: TINFO: Formatting /dev/loop0 with exfat opts='' extra opts=''
tst_test.c:1303: TINFO: Mounting /dev/loop0 to /tmp/LTP_swaKmkGVo/mntpoint fstyp=exfat flags=0
tse_swap.c:196: TINFO: create a swapfile size of 1 megabytes (MB)
tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
tse_swap.c:228: TFAIL: swapon() on exfat failed: EINVAL (22)
and from swapon02:
swapon02.c:56: TWARN: swapon(alreadyused) failed: EINVAL (22)
swapon02.c:73: TFAIL: swapon(2) fail with File already used expected EBUSY: EINVAL (22)
The iomap conversion changes exfat_aops to iomap based callbacks, but does not add a
.swap_activate handler. The VFS documentation says that ->swap_activate() should call
add_swap_extent(), or the helper iomap_swapfile_activate().
So this looks like an exfat swap activation regression triggered by the iomap buffered I/O conversion.
#regzbot introduced: 614f71ca1bdfaa2f25a6f147fe22f3ad031f8e2b
#regzbot monitor: https://lore.kernel.org/all/PUZPR04MB63168E8C2FB92B80F9F6476581002@PUZPR04MB6316.apcprd04.prod.outlook.com/
Thanks
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [REGRESSION] exfat: swapon(2) fails with EINVAL after iomap conversion
2026-06-03 11:02 [REGRESSION] exfat: swapon(2) fails with EINVAL after iomap conversion Jan Polensky
@ 2026-06-03 11:10 ` Namjae Jeon
2026-06-03 13:19 ` [PATCH] exfat: add swap_activate support Jan Polensky
0 siblings, 1 reply; 6+ messages in thread
From: Namjae Jeon @ 2026-06-03 11:10 UTC (permalink / raw)
To: Jan Polensky
Cc: linux-fsdevel, Sungjong Seo, Yuezhang Mo, Christoph Hellwig,
Darrick J . Wong, linux-kernel, regressions
On Wed, Jun 3, 2026 at 8:02 PM Jan Polensky <japo@linux.ibm.com> wrote:
>
> Hi,
>
> we are seeing a regression on linux-next after commit
>
> 614f71ca1bdfaa2f25a6f147fe22f3ad031f8e2b
> ("exfat: add iomap buffered I/O support")
>
> With this change, swapon(2) on an exfat swapfile fails with EINVAL.
>
> Observed fallout in LTP:
> swapoff01
> swapoff02
> swapon01
> swapon02
> swapon03
>
> Example failure:
>
> tst_test.c:1980: TINFO: === Testing on exfat ===
> tst_test.c:1291: TINFO: Formatting /dev/loop0 with exfat opts='' extra opts=''
> tst_test.c:1303: TINFO: Mounting /dev/loop0 to /tmp/LTP_swaKmkGVo/mntpoint fstyp=exfat flags=0
> tse_swap.c:196: TINFO: create a swapfile size of 1 megabytes (MB)
> tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
> tse_swap.c:228: TFAIL: swapon() on exfat failed: EINVAL (22)
>
> and from swapon02:
>
> swapon02.c:56: TWARN: swapon(alreadyused) failed: EINVAL (22)
> swapon02.c:73: TFAIL: swapon(2) fail with File already used expected EBUSY: EINVAL (22)
>
> The iomap conversion changes exfat_aops to iomap based callbacks, but does not add a
> .swap_activate handler. The VFS documentation says that ->swap_activate() should call
> add_swap_extent(), or the helper iomap_swapfile_activate().
>
> So this looks like an exfat swap activation regression triggered by the iomap buffered I/O conversion.
You have already suggested a solution. Could you please provide a
patch for this ?
Thanks for the report.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] exfat: add swap_activate support
2026-06-03 11:10 ` Namjae Jeon
@ 2026-06-03 13:19 ` Jan Polensky
2026-06-03 14:34 ` Namjae Jeon
0 siblings, 1 reply; 6+ messages in thread
From: Jan Polensky @ 2026-06-03 13:19 UTC (permalink / raw)
To: linkinjeon
Cc: djwong, hch, japo, linux-fsdevel, linux-kernel, regressions,
sj1557.seo, yuezhang.mo
Commit 614f71ca1bdf ("exfat: add iomap buffered I/O support")
converted exfat buffered I/O to iomap, but did not add a
.swap_activate handler to the address_space_operations.
swapon(2) on an exfat swapfile then fails with EINVAL, which causes
LTP swap tests to fail.
Add exfat_iomap_swap_activate() and hook it into exfat_aops so exfat
uses iomap_swapfile_activate() for swapfile activation.
Fixes: 614f71ca1bdf ("exfat: add iomap buffered I/O support")
Closes: https://lore.kernel.org/all/20260603110212.3020276-1-japo@linux.ibm.com/
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
fs/exfat/inode.c | 1 +
fs/exfat/iomap.c | 6 ++++++
fs/exfat/iomap.h | 3 +++
3 files changed, 10 insertions(+)
diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index 96ea243c67db..3b3ac722cf07 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -496,6 +496,7 @@ static const struct address_space_operations exfat_aops = {
.release_folio = iomap_release_folio,
.invalidate_folio = iomap_invalidate_folio,
.direct_IO = exfat_direct_IO,
+ .swap_activate = exfat_iomap_swap_activate,
};
static inline unsigned long exfat_hash(loff_t i_pos)
diff --git a/fs/exfat/iomap.c b/fs/exfat/iomap.c
index 188df8cfac9a..54c724cea1d0 100644
--- a/fs/exfat/iomap.c
+++ b/fs/exfat/iomap.c
@@ -213,3 +213,9 @@ const struct iomap_read_ops exfat_iomap_bio_read_ops = {
.read_folio_range = iomap_bio_read_folio_range,
.submit_read = exfat_iomap_bio_submit_read,
};
+
+int exfat_iomap_swap_activate(struct swap_info_struct *sis,
+ struct file *file, sector_t *span)
+{
+ return iomap_swapfile_activate(sis, file, span, &exfat_iomap_ops);
+}
diff --git a/fs/exfat/iomap.h b/fs/exfat/iomap.h
index 7f8dcbe20a17..295e36312baf 100644
--- a/fs/exfat/iomap.h
+++ b/fs/exfat/iomap.h
@@ -11,4 +11,7 @@ extern const struct iomap_ops exfat_write_iomap_ops;
extern const struct iomap_writeback_ops exfat_writeback_ops;
extern const struct iomap_read_ops exfat_iomap_bio_read_ops;
+int exfat_iomap_swap_activate(struct swap_info_struct *sis,
+ struct file *file, sector_t *span);
+
#endif /* _LINUX_EXFAT_IOMAP_H */
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] exfat: add swap_activate support
2026-06-03 13:19 ` [PATCH] exfat: add swap_activate support Jan Polensky
@ 2026-06-03 14:34 ` Namjae Jeon
2026-06-08 15:32 ` Jan Polensky
0 siblings, 1 reply; 6+ messages in thread
From: Namjae Jeon @ 2026-06-03 14:34 UTC (permalink / raw)
To: Jan Polensky
Cc: djwong, hch, linux-fsdevel, linux-kernel, regressions,
sj1557.seo, yuezhang.mo
On Wed, Jun 3, 2026 at 10:20 PM Jan Polensky <japo@linux.ibm.com> wrote:
>
> Commit 614f71ca1bdf ("exfat: add iomap buffered I/O support")
> converted exfat buffered I/O to iomap, but did not add a
> .swap_activate handler to the address_space_operations.
>
> swapon(2) on an exfat swapfile then fails with EINVAL, which causes
> LTP swap tests to fail.
>
> Add exfat_iomap_swap_activate() and hook it into exfat_aops so exfat
> uses iomap_swapfile_activate() for swapfile activation.
>
> Fixes: 614f71ca1bdf ("exfat: add iomap buffered I/O support")
> Closes: https://lore.kernel.org/all/20260603110212.3020276-1-japo@linux.ibm.com/
> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
Applied it to #dev.
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] exfat: add swap_activate support
2026-06-03 14:34 ` Namjae Jeon
@ 2026-06-08 15:32 ` Jan Polensky
2026-06-09 9:29 ` Namjae Jeon
0 siblings, 1 reply; 6+ messages in thread
From: Jan Polensky @ 2026-06-08 15:32 UTC (permalink / raw)
To: Namjae Jeon
Cc: djwong, hch, linux-fsdevel, linux-kernel, regressions,
sj1557.seo, yuezhang.mo
On Wed, Jun 03, 2026 at 11:34:55PM +0900, Namjae Jeon wrote:
> On Wed, Jun 3, 2026 at 10:20 PM Jan Polensky <japo@linux.ibm.com> wrote:
> >
> > Commit 614f71ca1bdf ("exfat: add iomap buffered I/O support")
> > converted exfat buffered I/O to iomap, but did not add a
> > .swap_activate handler to the address_space_operations.
> >
> > swapon(2) on an exfat swapfile then fails with EINVAL, which causes
> > LTP swap tests to fail.
> >
> > Add exfat_iomap_swap_activate() and hook it into exfat_aops so exfat
> > uses iomap_swapfile_activate() for swapfile activation.
> >
> > Fixes: 614f71ca1bdf ("exfat: add iomap buffered I/O support")
> > Closes: https://lore.kernel.org/all/20260603110212.3020276-1-japo@linux.ibm.com/
> > Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> Applied it to #dev.
> Thanks!
Hi Namjae,
I think one line might have been missed when applying my patch:
.swap_activate = exfat_iomap_swap_activate,
I checked linux-next (master and next-20260604 / next-20260605),
and the issue is still present there.
Link:
https://lore.kernel.org/all/20260603131950.321858-1-japo@linux.ibm.com/
Could you please take a look?
Thanks,
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] exfat: add swap_activate support
2026-06-08 15:32 ` Jan Polensky
@ 2026-06-09 9:29 ` Namjae Jeon
0 siblings, 0 replies; 6+ messages in thread
From: Namjae Jeon @ 2026-06-09 9:29 UTC (permalink / raw)
To: Jan Polensky
Cc: djwong, hch, linux-fsdevel, linux-kernel, regressions,
sj1557.seo, yuezhang.mo
On Tue, Jun 9, 2026 at 12:32 AM Jan Polensky <japo@linux.ibm.com> wrote:
>
> On Wed, Jun 03, 2026 at 11:34:55PM +0900, Namjae Jeon wrote:
> > On Wed, Jun 3, 2026 at 10:20 PM Jan Polensky <japo@linux.ibm.com> wrote:
> > >
> > > Commit 614f71ca1bdf ("exfat: add iomap buffered I/O support")
> > > converted exfat buffered I/O to iomap, but did not add a
> > > .swap_activate handler to the address_space_operations.
> > >
> > > swapon(2) on an exfat swapfile then fails with EINVAL, which causes
> > > LTP swap tests to fail.
> > >
> > > Add exfat_iomap_swap_activate() and hook it into exfat_aops so exfat
> > > uses iomap_swapfile_activate() for swapfile activation.
> > >
> > > Fixes: 614f71ca1bdf ("exfat: add iomap buffered I/O support")
> > > Closes: https://lore.kernel.org/all/20260603110212.3020276-1-japo@linux.ibm.com/
> > > Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> > Applied it to #dev.
> > Thanks!
>
> Hi Namjae,
>
> I think one line might have been missed when applying my patch:
>
> .swap_activate = exfat_iomap_swap_activate,
>
> I checked linux-next (master and next-20260604 / next-20260605),
> and the issue is still present there.
>
> Link:
> https://lore.kernel.org/all/20260603131950.321858-1-japo@linux.ibm.com/
>
> Could you please take a look?
Sorry about that, my bad. Your patch wasn't being applied properly, so
I tried to update it manually and made a mistake. Anyway, I have just
fixed it. Thank you very much for pointing it out!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-09 9:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03 11:02 [REGRESSION] exfat: swapon(2) fails with EINVAL after iomap conversion Jan Polensky
2026-06-03 11:10 ` Namjae Jeon
2026-06-03 13:19 ` [PATCH] exfat: add swap_activate support Jan Polensky
2026-06-03 14:34 ` Namjae Jeon
2026-06-08 15:32 ` Jan Polensky
2026-06-09 9:29 ` Namjae Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®