public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] iomap: fix inline data on buffered read
@ 2025-03-19  2:59 Gao Xiang
  2025-03-19  8:17 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Gao Xiang @ 2025-03-19  2:59 UTC (permalink / raw)
  To: linux-fsdevel, Christian Brauner, Brian Foster
  Cc: linux-erofs, linux-xfs, Gao Xiang, Bo Liu, Christoph Hellwig,
	Darrick J. Wong

Previously, iomap_readpage_iter() returning 0 would break out of the
loops of iomap_readahead_iter(), which is what iomap_read_inline_data()
relies on.

However, commit d9dc477ff6a2 ("iomap: advance the iter directly on
buffered read") changes this behavior without calling
iomap_iter_advance(), which causes EROFS to get stuck in
iomap_readpage_iter().

It seems iomap_iter_advance() cannot be called in
iomap_read_inline_data() because of the iomap_write_begin() path, so
handle this in iomap_readpage_iter() instead.

Reported-by: Bo Liu <liubo03@inspur.com>
Fixes: d9dc477ff6a2 ("iomap: advance the iter directly on buffered read")
Cc: Brian Foster <bfoster@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/iomap/buffered-io.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index d52cfdc299c4..2d6e1e3be747 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -372,9 +372,15 @@ static int iomap_readpage_iter(struct iomap_iter *iter,
 	struct iomap_folio_state *ifs;
 	size_t poff, plen;
 	sector_t sector;
+	int ret;
 
-	if (iomap->type == IOMAP_INLINE)
-		return iomap_read_inline_data(iter, folio);
+	if (iomap->type == IOMAP_INLINE) {
+		ret = iomap_read_inline_data(iter, folio);
+		if (ret)
+			return ret;
+		plen = length;
+		goto done;
+	}
 
 	/* zero post-eof blocks as the page may be mapped */
 	ifs = ifs_alloc(iter->inode, folio, iter->flags);
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [PATCH -next] iomap: fix inline data on buffered read
@ 2025-03-19  6:40 Bo Liu (刘波)-浪潮信息
  0 siblings, 0 replies; 5+ messages in thread
From: Bo Liu (刘波)-浪潮信息 @ 2025-03-19  6:40 UTC (permalink / raw)
  To: hsiangkao@linux.alibaba.com, linux-fsdevel@vger.kernel.org,
	brauner@kernel.org, bfoster@redhat.com
  Cc: linux-erofs@lists.ozlabs.org, linux-xfs@vger.kernel.org,
	hch@lst.de, djwong@kernel.org

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

>Previously, iomap_readpage_iter() returning 0 would break out of the loops
of
>iomap_readahead_iter(), which is what iomap_read_inline_data() relies on.
>
>However, commit d9dc477ff6a2 ("iomap: advance the iter directly on buffered
>read") changes this behavior without calling iomap_iter_advance(), which
>causes EROFS to get stuck in iomap_readpage_iter().
>
>It seems iomap_iter_advance() cannot be called in
>iomap_read_inline_data() because of the iomap_write_begin() path, so handle
>this in iomap_readpage_iter() instead.
>
>Reported-by: Bo Liu <liubo03@inspur.com>
>Fixes: d9dc477ff6a2 ("iomap: advance the iter directly on buffered read")
>Cc: Brian Foster <bfoster@redhat.com>
>Cc: Christoph Hellwig <hch@lst.de>
>Cc: "Darrick J. Wong" <djwong@kernel.org>
>Cc: Christian Brauner <brauner@kernel.org>
>Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Tested-by: Bo Liu <liubo03@inspur.com>

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3777 bytes --]

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

end of thread, other threads:[~2025-03-19  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-19  2:59 [PATCH -next] iomap: fix inline data on buffered read Gao Xiang
2025-03-19  8:17 ` Christoph Hellwig
2025-03-19  8:23   ` Christoph Hellwig
2025-03-19  8:34     ` Gao Xiang
  -- strict thread matches above, loose matches on Subject: below --
2025-03-19  6:40 Bo Liu (刘波)-浪潮信息

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox