mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
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: bc804a8d7e ("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>
This commit is contained in:
parent
1f318b96cc
commit
eade540403
|
|
@ -25,10 +25,8 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)
|
|||
container_of(iocb, struct erofs_fileio_rq, iocb);
|
||||
struct folio_iter fi;
|
||||
|
||||
if (ret >= 0 && ret != rq->bio.bi_iter.bi_size) {
|
||||
bio_advance(&rq->bio, ret);
|
||||
zero_fill_bio(&rq->bio);
|
||||
}
|
||||
if (ret >= 0 && ret != rq->bio.bi_iter.bi_size)
|
||||
ret = -EIO;
|
||||
if (!rq->bio.bi_end_io) {
|
||||
bio_for_each_folio_all(fi, &rq->bio) {
|
||||
DBG_BUGON(folio_test_uptodate(fi.folio));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user