Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

erofs: set fileio bio failed in short read case

For file-backed mount, IO requests are handled by vfs_iocb_iter_read().
However, it can be interrupted by SIGKILL, returning the number of
bytes actually copied. Unused folios in bio are unexpectedly marked
as uptodate.

vfs_read
filemap_read
filemap_get_pages
filemap_readahead
erofs_fileio_readahead
erofs_fileio_rq_submit
vfs_iocb_iter_read
filemap_read
filemap_get_pages <= detect signal
erofs_fileio_ki_complete <= set all folios uptodate

This patch addresses this by setting short read bio with an error
directly.

Fixes: bc804a8d7e86 ("erofs: handle end of filesystem properly for file-backed mounts")
Reported-by: chenguanyou <chenguanyou@xiaomi.com>
Signed-off-by: Yunlei He <heyunlei@xiaomi.com>
Signed-off-by: Sheng Yong <shengyong1@xiaomi.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

authored by

Sheng Yong and committed by
Gao Xiang
eade5404 1f318b96

+2 -4
+2 -4
fs/erofs/fileio.c
··· 25 25 container_of(iocb, struct erofs_fileio_rq, iocb); 26 26 struct folio_iter fi; 27 27 28 - if (ret >= 0 && ret != rq->bio.bi_iter.bi_size) { 29 - bio_advance(&rq->bio, ret); 30 - zero_fill_bio(&rq->bio); 31 - } 28 + if (ret >= 0 && ret != rq->bio.bi_iter.bi_size) 29 + ret = -EIO; 32 30 if (!rq->bio.bi_end_io) { 33 31 bio_for_each_folio_all(fi, &rq->bio) { 34 32 DBG_BUGON(folio_test_uptodate(fi.folio));