public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/2] erofs: set error to bio if file-backed IO fails
@ 2025-04-08 12:23 Sheng Yong
  2025-04-08 12:23 ` [PATCH v4 2/2] erofs: add 'fsoffset' mount option for file-backed & bdev-based mounts Sheng Yong
  2025-04-08 12:32 ` [PATCH v4 1/2] erofs: set error to bio if file-backed IO fails Gao Xiang
  0 siblings, 2 replies; 5+ messages in thread
From: Sheng Yong @ 2025-04-08 12:23 UTC (permalink / raw)
  To: xiang, hsiangkao, chao, zbestahu, jefflexu, dhavale, kzak
  Cc: linux-erofs, linux-kernel, wangshuai12, Sheng Yong

From: Sheng Yong <shengyong1@xiaomi.com>

If a file-backed IO fails before submitting the bio to the lower
filesystem, an error is returned, but the bio->bi_status is not
marked as an error. However, the error information should be passed
to the end_io handler. Otherwise, the IO request will be treated as
successful.

Signed-off-by: Sheng Yong <shengyong1@xiaomi.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/fileio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/erofs/fileio.c b/fs/erofs/fileio.c
index bec4b56b3826..4fa0a0121288 100644
--- a/fs/erofs/fileio.c
+++ b/fs/erofs/fileio.c
@@ -32,6 +32,8 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)
 		ret = 0;
 	}
 	if (rq->bio.bi_end_io) {
+		if (ret < 0 && !rq->bio.bi_status)
+			rq->bio.bi_status = errno_to_blk_status(ret);
 		rq->bio.bi_end_io(&rq->bio);
 	} else {
 		bio_for_each_folio_all(fi, &rq->bio) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-08 12:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 12:23 [PATCH v4 1/2] erofs: set error to bio if file-backed IO fails Sheng Yong
2025-04-08 12:23 ` [PATCH v4 2/2] erofs: add 'fsoffset' mount option for file-backed & bdev-based mounts Sheng Yong
2025-05-08  4:09   ` Gao Xiang
2025-05-08 12:53     ` Sheng Yong
2025-04-08 12:32 ` [PATCH v4 1/2] erofs: set error to bio if file-backed IO fails Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox