public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bcachefs: track writeback errors using the generic tracking infrastructure
@ 2024-05-31  2:31 Youling Tang
  0 siblings, 0 replies; only message in thread
From: Youling Tang @ 2024-05-31  2:31 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: Brian Foster, linux-bcachefs, linux-kernel, Youling Tang

From: Youling Tang <tangyouling@kylinos.cn>

We already using mapping_set_error() in bch2_writepage_io_done(), so all
we need to do is to use file_check_and_advance_wb_err() when handling
fsync() requests in bch2_fsync().

Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
---
 fs/bcachefs/fs-io.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index ef20b64033e0..f5b266e51261 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -192,7 +192,7 @@ int bch2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
 	struct bch_inode_info *inode = file_bch_inode(file);
 	struct bch_fs *c = inode->v.i_sb->s_fs_info;
-	int ret;
+	int ret, err;
 
 	ret = file_write_and_wait_range(file, start, end);
 	if (ret)
@@ -205,6 +205,11 @@ int bch2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 	ret = bch2_err_class(ret);
 	if (ret == -EROFS)
 		ret = -EIO;
+
+	err = file_check_and_advance_wb_err(file);
+	if (!ret)
+		ret = err;
+
 	return ret;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-31  2:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31  2:31 [PATCH] bcachefs: track writeback errors using the generic tracking infrastructure Youling Tang

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