mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Polensky <japo@linux.ibm.com>
To: linkinjeon@kernel.org
Cc: djwong@kernel.org, hch@lst.de, japo@linux.ibm.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	regressions@lists.linux.dev, sj1557.seo@samsung.com,
	yuezhang.mo@sony.com
Subject: [PATCH] exfat: add swap_activate support
Date: Wed,  3 Jun 2026 15:19:50 +0200	[thread overview]
Message-ID: <20260603131950.321858-1-japo@linux.ibm.com> (raw)
In-Reply-To: <CAKYAXd80+UfzKaCR9YRK8dAQq9S+kEp_VVwr_p3dj1tEeyqUQA@mail.gmail.com>

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


  reply	other threads:[~2026-06-03 13:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Jan Polensky [this message]
2026-06-03 14:34     ` [PATCH] exfat: add swap_activate support Namjae Jeon
2026-06-08 15:32       ` Jan Polensky
2026-06-09  9:29         ` Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260603131950.321858-1-japo@linux.ibm.com \
    --to=japo@linux.ibm.com \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=regressions@lists.linux.dev \
    --cc=sj1557.seo@samsung.com \
    --cc=yuezhang.mo@sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®