@@ -622,11 +622,13 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
{
struct inode *bd_inode = bdev_file_inode(filp);
struct block_device *bdev = I_BDEV(bd_inode);
- int error;
+ int error, wberr;
+ errseq_t since = READ_ONCE(filp->f_wb_err);
- error = filemap_write_and_wait_range(filp->f_mapping, start, end);
+ error = filemap_write_and_wait_range_since(filp->f_mapping, start,
+ end, since);
if (error)
- return error;
+ goto out;
/*
* There is no need to serialise calls to blkdev_issue_flush with
@@ -637,6 +639,10 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
if (error == -EOPNOTSUPP)
error = 0;
+out:
+ wberr = filemap_report_wb_err(filp);
+ if (!error)
+ error = wberr;
return error;
}
EXPORT_SYMBOL(blkdev_fsync);
@@ -801,6 +807,7 @@ static struct file_system_type bd_type = {
.name = "bdev",
.mount = bd_mount,
.kill_sb = kill_anon_super,
+ .fs_flags = FS_WB_ERRSEQ,
};
struct super_block *blockdev_superblock __read_mostly;
Fairly straightforward conversion. In fsync, just use the file->f_wb_err value as a "since" value. At the end, call filemap_report_wb_err to advance the cursor in it. Signed-off-by: Jeff Layton <jlayton@redhat.com> --- fs/block_dev.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)