Commit 8b088250 authored by Youling Tang's avatar Youling Tang Committed by Kent Overstreet

bcachefs: track writeback errors using the generic tracking infrastructure

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: default avatarYouling Tang <tangyouling@kylinos.cn>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent f8b01473
...@@ -192,7 +192,7 @@ int bch2_fsync(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -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_inode_info *inode = file_bch_inode(file);
struct bch_fs *c = inode->v.i_sb->s_fs_info; 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); ret = file_write_and_wait_range(file, start, end);
if (ret) if (ret)
...@@ -205,6 +205,11 @@ int bch2_fsync(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -205,6 +205,11 @@ int bch2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
ret = bch2_err_class(ret); ret = bch2_err_class(ret);
if (ret == -EROFS) if (ret == -EROFS)
ret = -EIO; ret = -EIO;
err = file_check_and_advance_wb_err(file);
if (!ret)
ret = err;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment