Skip to content

Commit eade540

Browse files
Sheng Yonghsiangkao
authored andcommitted
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: bc804a8 ("erofs: handle end of filesystem properly for file-backed mounts") Reported-by: chenguanyou <[email protected]> Signed-off-by: Yunlei He <[email protected]> Signed-off-by: Sheng Yong <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Gao Xiang <[email protected]>
1 parent 1f318b9 commit eade540

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

fs/erofs/fileio.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)
2525
container_of(iocb, struct erofs_fileio_rq, iocb);
2626
struct folio_iter fi;
2727

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;
3230
if (!rq->bio.bi_end_io) {
3331
bio_for_each_folio_all(fi, &rq->bio) {
3432
DBG_BUGON(folio_test_uptodate(fi.folio));

0 commit comments

Comments
 (0)