diff options
| author | Wenjie Qi <qiwenjie@xiaomi.com> | 2026-05-20 17:52:04 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-07-04 13:45:04 +0200 |
| commit | 48c92559e7b66fdc3cbc74f6e152e66ec0150a0a (patch) | |
| tree | fc23e90cb378aa9eb399457efbbf797d031648be | |
| parent | fe7f339f63c9dc4ca546ed7ac38ba4bb3a99dcfc (diff) | |
| download | linux-48c92559e7b66fdc3cbc74f6e152e66ec0150a0a.tar.gz linux-48c92559e7b66fdc3cbc74f6e152e66ec0150a0a.zip | |
f2fs: fix missing read bio submission on large folio error
commit 74c8d2ec95c59a5651ecd975c466998af1961fd4 upstream.
f2fs_read_data_large_folio() can keep a read bio across multiple
readahead folios. If a later folio hits an error before any of its
blocks are added to the bio, folio_in_bio is false and the current error
path returns immediately after ending that folio.
This can leave the bio accumulated for earlier folios unsubmitted. Those
folios then never receive read completion, and readers can wait
indefinitely on the locked folios.
Route errors through the common out path so any pending bio is submitted
before returning. Stop consuming more readahead folios once an error is
seen, and only wait on and clear the current folio when it was actually
added to the bio.
Cc: stable@kernel.org
Fixes: a5d8b9d94e18 ("f2fs: fix to unlock folio in f2fs_read_data_large_folio()")
Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | fs/f2fs/data.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 8d4f1e75dee3..836edb7899de 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2495,7 +2495,7 @@ static int f2fs_read_data_large_folio(struct inode *inode, unsigned nrpages; struct f2fs_folio_state *ffs; int ret = 0; - bool folio_in_bio; + bool folio_in_bio = false; if (!IS_IMMUTABLE(inode) || f2fs_compressed_file(inode)) { if (folio) @@ -2611,18 +2611,17 @@ submit_and_realloc: } trace_f2fs_read_folio(folio, DATA); err_out: - if (!folio_in_bio) { + if (!folio_in_bio) folio_end_read(folio, !ret); - if (ret) - return ret; - } + if (ret) + goto out; if (rac) { folio = readahead_folio(rac); goto next_folio; } out: f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA); - if (ret) { + if (ret && folio_in_bio) { /* Wait bios and clear uptodate. */ folio_lock(folio); folio_clear_uptodate(folio); |
