* Re: [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file [not found] ` <ao2TtyQpCGP5TLpx@yuki.lan> @ 2026-08-25 13:26 ` Petr Vorel 2026-08-25 13:46 ` Cyril Hrubis 0 siblings, 1 reply; 3+ messages in thread From: Petr Vorel @ 2026-08-25 13:26 UTC (permalink / raw) To: Cyril Hrubis Cc: Jan Polensky, ltp, Namjae Jeon, linux-kernel, regressions, Andrea Cervesato, Sungjong Seo, Yuezhang Mo, Christoph Hellwig, Darrick J . Wong Hi all, [ Cc kernel folks and LKML ] > Hi! > > Reviewed-by: Petr Vorel <pvorel@suse.cz> > > And yeah, we need it in kernel 7.2 on any distro :). ... and on any arch, e.g. x86_64 (not just s390x as Jan previously reported [1]) > > Should we somehow mention relevant kernel commit at least in the commit message? > > e.g.: Change needed since 03a43677ca91 ("exfat: add swap_activate support") from > > v7.2-rc1. > That does not make much sense, if swap_activate was added to kernel, > pre-filling the fallocated file shouldn't be needed anymore. Good catch, you're right. I'm also confused, before v7.2 swap worked on exfat, now even with 82a81a7352bc ("exfat: add iomap buffered I/O support") [2] and your fix 03a43677ca91 ("exfat: add swap_activate support") [3] is not working. Obviously the fix was not good enough. Kind regards, Petr [1] https://lore.kernel.org/ltp/akzN_iISxNTztbEw@li-276bd24c-2dcc-11b2-a85c-945b6f05615c.ibm.com/ [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=82a81a7352bcf5f2756ac33d47ee0582737e9a85 [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=03a43677ca91e3997355a13b1da6e47329b025e1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file 2026-08-25 13:26 ` [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file Petr Vorel @ 2026-08-25 13:46 ` Cyril Hrubis 2026-08-26 0:23 ` Namjae Jeon 0 siblings, 1 reply; 3+ messages in thread From: Cyril Hrubis @ 2026-08-25 13:46 UTC (permalink / raw) To: Petr Vorel Cc: Jan Polensky, ltp, Namjae Jeon, linux-kernel, regressions, Andrea Cervesato, Sungjong Seo, Yuezhang Mo, Christoph Hellwig, Darrick J . Wong Hi! > > That does not make much sense, if swap_activate was added to kernel, > > pre-filling the fallocated file shouldn't be needed anymore. > > Good catch, you're right. I'm also confused, before v7.2 swap worked on exfat, > now even with 82a81a7352bc ("exfat: add iomap buffered I/O support") [2] > and your fix 03a43677ca91 ("exfat: add swap_activate support") [3] is not > working. Obviously the fix was not good enough. There were two bugs I suppose, one is that fallocate() support for exfat broke the swapon on fallocated file. The second bug was introduced later when exfat was rewritten to use iomap. The iomap case was fixed in the patch above, however it looks like the original bug caused by fallocate() implementation for exfat is still there. -- Cyril Hrubis chrubis@suse.cz ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file 2026-08-25 13:46 ` Cyril Hrubis @ 2026-08-26 0:23 ` Namjae Jeon 0 siblings, 0 replies; 3+ messages in thread From: Namjae Jeon @ 2026-08-26 0:23 UTC (permalink / raw) To: Cyril Hrubis Cc: Petr Vorel, Jan Polensky, ltp, linux-kernel, regressions, Andrea Cervesato, Sungjong Seo, Yuezhang Mo, Christoph Hellwig, Darrick J . Wong [-- Attachment #1: Type: text/plain, Size: 960 bytes --] On Tue, Aug 25, 2026 at 10:46 PM Cyril Hrubis <chrubis@suse.cz> wrote: > > Hi! Hi Cyril, Petr, > > > That does not make much sense, if swap_activate was added to kernel, > > > pre-filling the fallocated file shouldn't be needed anymore. > > > > Good catch, you're right. I'm also confused, before v7.2 swap worked on exfat, > > now even with 82a81a7352bc ("exfat: add iomap buffered I/O support") [2] > > and your fix 03a43677ca91 ("exfat: add swap_activate support") [3] is not > > working. Obviously the fix was not good enough. > > There were two bugs I suppose, one is that fallocate() support for exfat broke > the swapon on fallocated file. The second bug was introduced later when > exfat was rewritten to use iomap. The iomap case was fixed in the patch > above, however it looks like the original bug caused by fallocate() > implementation for exfat is still there. Can you check if an attached patch improves this issue? Thanks. [-- Attachment #2: 0001-exfat-map-allocated-extents-for-swap-activation.patch --] [-- Type: text/x-patch, Size: 2120 bytes --] From 5679a624816454c8e7683842eb0ab3f1adf0dcca Mon Sep 17 00:00:00 2001 From: Namjae Jeon <linkinjeon@kernel.org> Date: Wed, 26 Aug 2026 09:14:14 +0900 Subject: [PATCH] exfat: map allocated extents for swap activation exFAT reports allocated ranges beyond valid_size as IOMAP_HOLE when IOMAP_REPORT is set. iomap_swapfile_activate() also uses IOMAP_REPORT while collecting physical extents for a swap file, so it treats the preallocated tail as unallocated and rejects the file with -EINVAL. Use swap-specific iomap operations that suppress IOMAP_REPORT before mapping the file. This reports physically allocated ranges as IOMAP_UNWRITTEN during swap activation without changing the byte-accurate SEEK_HOLE and SEEK_DATA behavior of the regular iomap operations. Fixes: 03a43677ca91 ("exfat: add swap_activate support") Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> --- fs/exfat/iomap.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/fs/exfat/iomap.c b/fs/exfat/iomap.c index 0c805bf6676a..bf8baf78a9b8 100644 --- a/fs/exfat/iomap.c +++ b/fs/exfat/iomap.c @@ -155,6 +155,22 @@ const struct iomap_ops exfat_iomap_ops = { .iomap_begin = exfat_iomap_begin, }; +static int exfat_swap_iomap_begin(struct inode *inode, loff_t offset, + loff_t length, unsigned int flags, struct iomap *iomap, + struct iomap *srcmap) +{ + /* + * Swap activation needs the physical mappings of preallocated + * ranges. Do not report the VDL tail as a hole. + */ + return __exfat_iomap_begin(inode, offset, length, + flags & ~IOMAP_REPORT, iomap, false); +} + +static const struct iomap_ops exfat_swap_iomap_ops = { + .iomap_begin = exfat_swap_iomap_begin, +}; + /* * exfat_write_iomap_end - Update the state after write * @@ -274,5 +290,6 @@ 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) { - return iomap_swapfile_activate(sis, file, span, &exfat_iomap_ops); + return iomap_swapfile_activate(sis, file, span, + &exfat_swap_iomap_ops); } -- 2.34.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-26 0:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <ajQFErzQW4qfU_Cp@li-276bd24c-2dcc-11b2-a85c-945b6f05615c.ibm.com>
[not found] ` <6a463902.41a38e5f.27f5bd.337a@mx.google.com>
[not found] ` <akzN_iISxNTztbEw@li-276bd24c-2dcc-11b2-a85c-945b6f05615c.ibm.com>
[not found] ` <20260825112755.GA62429@pevik>
[not found] ` <ao2TtyQpCGP5TLpx@yuki.lan>
2026-08-25 13:26 ` [LTP] [PATCH v1 1/1] swap: Add exfat to filesystems requiring tst_fill_file Petr Vorel
2026-08-25 13:46 ` Cyril Hrubis
2026-08-26 0:23 ` Namjae Jeon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox