* [PATCH RESEND] iomap: remove over-strict inline data boundary check
@ 2026-05-11 14:11 Namjae Jeon
2026-05-11 14:57 ` Christian Brauner
0 siblings, 1 reply; 5+ messages in thread
From: Namjae Jeon @ 2026-05-11 14:11 UTC (permalink / raw)
To: brauner, djwong; +Cc: willy, xiang, hch, linux-fsdevel, Namjae Jeon, Gao Xiang
The current iomap_inline_data_valid() check ensures that inline data
does not cross a PAGE_SIZE boundary. However, this is an unnecessarily
strict constraint. If a filesystem provides a valid iomap::inline_data
pointer and iomap::length, we should trust that the caller has mapped
sufficient memory for the range, even if it spans across page boundaries.
Removing this check allows filesystems to point directly to their
internal data structures without forced page-alignment or additional
redundant allocations. This remove iomap_inline_data_valid() and
its callers in buffered and direct I/O paths.
Suggested-by: Matthew Wilcox <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
fs/iomap/buffered-io.c | 1 -
fs/iomap/direct-io.c | 3 ---
include/linux/iomap.h | 10 ----------
3 files changed, 14 deletions(-)
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index d7b648421a70..c4c5bddcbe3a 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -1058,7 +1058,6 @@ static bool iomap_write_end_inline(const struct iomap_iter *iter,
void *addr;
WARN_ON_ONCE(!folio_test_uptodate(folio));
- BUG_ON(!iomap_inline_data_valid(iomap));
if (WARN_ON_ONCE(!iomap->inline_data))
return false;
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index b0a6549b3848..a4459c5abb07 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -603,9 +603,6 @@ static int iomap_dio_inline_iter(struct iomap_iter *iomi, struct iomap_dio *dio)
if (WARN_ON_ONCE(!inline_data))
return -EIO;
- if (WARN_ON_ONCE(!iomap_inline_data_valid(iomap)))
- return -EIO;
-
if (dio->flags & IOMAP_DIO_WRITE) {
loff_t size = iomi->inode->i_size;
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 531f9ebdeeae..c758a8e865ed 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -142,16 +142,6 @@ static inline void *iomap_inline_data(const struct iomap *iomap, loff_t pos)
return iomap->inline_data + pos - iomap->offset;
}
-/*
- * Check if the mapping's length is within the valid range for inline data.
- * This is used to guard against accessing data beyond the page inline_data
- * points at.
- */
-static inline bool iomap_inline_data_valid(const struct iomap *iomap)
-{
- return iomap->length <= PAGE_SIZE - offset_in_page(iomap->inline_data);
-}
-
/*
* When get_folio succeeds, put_folio will always be called to do any
* cleanup work necessary. put_folio is responsible for unlocking and putting
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH RESEND] iomap: remove over-strict inline data boundary check
2026-05-11 14:11 [PATCH RESEND] iomap: remove over-strict inline data boundary check Namjae Jeon
@ 2026-05-11 14:57 ` Christian Brauner
2026-05-12 6:07 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Christian Brauner @ 2026-05-11 14:57 UTC (permalink / raw)
To: djwong, Namjae Jeon; +Cc: Christian Brauner, willy, xiang, hch, linux-fsdevel
On Mon, 11 May 2026 23:11:51 +0900, Namjae Jeon wrote:
> The current iomap_inline_data_valid() check ensures that inline data
> does not cross a PAGE_SIZE boundary. However, this is an unnecessarily
> strict constraint. If a filesystem provides a valid iomap::inline_data
> pointer and iomap::length, we should trust that the caller has mapped
> sufficient memory for the range, even if it spans across page boundaries.
> Removing this check allows filesystems to point directly to their
> internal data structures without forced page-alignment or additional
> redundant allocations. This remove iomap_inline_data_valid() and
> its callers in buffered and direct I/O paths.
>
> [...]
Applied to the vfs-7.2.iomap branch of the vfs/vfs.git tree.
Patches in the vfs-7.2.iomap branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.2.iomap
[1/1] iomap: remove over-strict inline data boundary check
https://git.kernel.org/vfs/vfs/c/5a78a15537d4
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH RESEND] iomap: remove over-strict inline data boundary check
2026-05-11 14:57 ` Christian Brauner
@ 2026-05-12 6:07 ` Christoph Hellwig
2026-05-12 6:33 ` Namjae Jeon
2026-05-12 12:12 ` Christian Brauner
0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2026-05-12 6:07 UTC (permalink / raw)
To: Christian Brauner; +Cc: djwong, Namjae Jeon, willy, xiang, hch, linux-fsdevel
On Mon, May 11, 2026 at 04:57:26PM +0200, Christian Brauner wrote:
> Applied to the vfs-7.2.iomap branch of the vfs/vfs.git tree.
> Patches in the vfs-7.2.iomap branch should appear in linux-next soon.
Shouldn't this go into 7.1 as it fixes a user triggered BUG_ON with
ntfs?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] iomap: remove over-strict inline data boundary check
2026-05-12 6:07 ` Christoph Hellwig
@ 2026-05-12 6:33 ` Namjae Jeon
2026-05-12 12:12 ` Christian Brauner
1 sibling, 0 replies; 5+ messages in thread
From: Namjae Jeon @ 2026-05-12 6:33 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Christian Brauner, djwong, willy, xiang, linux-fsdevel
On Tue, May 12, 2026 at 3:07 PM Christoph Hellwig <hch@lst.de> wrote:
>
> On Mon, May 11, 2026 at 04:57:26PM +0200, Christian Brauner wrote:
> > Applied to the vfs-7.2.iomap branch of the vfs/vfs.git tree.
> > Patches in the vfs-7.2.iomap branch should appear in linux-next soon.
>
> Shouldn't this go into 7.1 as it fixes a user triggered BUG_ON with
> ntfs?
Since I wasn't sure when this patch would land, I applied the patch
"ntfs: use page allocation for resident attribute inline data" into
7.1. so this iomap patch is no longer urgent for ntfs in 7.1.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] iomap: remove over-strict inline data boundary check
2026-05-12 6:07 ` Christoph Hellwig
2026-05-12 6:33 ` Namjae Jeon
@ 2026-05-12 12:12 ` Christian Brauner
1 sibling, 0 replies; 5+ messages in thread
From: Christian Brauner @ 2026-05-12 12:12 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: djwong, Namjae Jeon, willy, xiang, linux-fsdevel
On Tue, May 12, 2026 at 08:07:36AM +0200, Christoph Hellwig wrote:
> On Mon, May 11, 2026 at 04:57:26PM +0200, Christian Brauner wrote:
> > Applied to the vfs-7.2.iomap branch of the vfs/vfs.git tree.
> > Patches in the vfs-7.2.iomap branch should appear in linux-next soon.
>
> Shouldn't this go into 7.1 as it fixes a user triggered BUG_ON with
> ntfs?
I was on the fence but there's no Fixes: tag. I usually mark patches at
least with: Cc: stable@kernel.org # mainline only or something.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-12 12:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 14:11 [PATCH RESEND] iomap: remove over-strict inline data boundary check Namjae Jeon
2026-05-11 14:57 ` Christian Brauner
2026-05-12 6:07 ` Christoph Hellwig
2026-05-12 6:33 ` Namjae Jeon
2026-05-12 12:12 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox