Skip to content

Commit b26816b

Browse files
hsiangkaobrauner
authored andcommitted
iomap: fix inline data on buffered read
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 d9dc477 ("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-and-tested-by: Bo Liu <[email protected]> Fixes: d9dc477 ("iomap: advance the iter directly on buffered read") Cc: Brian Foster <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: "Darrick J. Wong" <[email protected]> Cc: Christian Brauner <[email protected]> Signed-off-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Brian Foster <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent c7be0d7 commit b26816b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/iomap/buffered-io.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,14 @@ static int iomap_readpage_iter(struct iomap_iter *iter,
372372
struct iomap_folio_state *ifs;
373373
size_t poff, plen;
374374
sector_t sector;
375+
int ret;
375376

376-
if (iomap->type == IOMAP_INLINE)
377-
return iomap_read_inline_data(iter, folio);
377+
if (iomap->type == IOMAP_INLINE) {
378+
ret = iomap_read_inline_data(iter, folio);
379+
if (ret)
380+
return ret;
381+
return iomap_iter_advance(iter, &length);
382+
}
378383

379384
/* zero post-eof blocks as the page may be mapped */
380385
ifs = ifs_alloc(iter->inode, folio, iter->flags);

0 commit comments

Comments
 (0)