mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
xfs: don't continue on error in xfs_fsync
As soon as we get an error from cache flushing or log forcing, there is no point in continuing as the data integrity is already impacted. Return the error instead of continuing to do more work. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
ad0033e2db
commit
c84455c683
|
|
@ -130,8 +130,8 @@ xfs_file_fsync(
|
|||
{
|
||||
struct xfs_inode *ip = XFS_I(file->f_mapping->host);
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
int error, err2;
|
||||
int log_flushed = 0;
|
||||
int error;
|
||||
|
||||
trace_xfs_file_fsync(ip);
|
||||
|
||||
|
|
@ -154,15 +154,17 @@ xfs_file_fsync(
|
|||
error = blkdev_issue_flush(mp->m_rtdev_targp->bt_bdev);
|
||||
else if (mp->m_logdev_targp != mp->m_ddev_targp)
|
||||
error = blkdev_issue_flush(mp->m_ddev_targp->bt_bdev);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/*
|
||||
* If the inode has a inode log item attached, it may need the journal
|
||||
* flushed to persist any changes the log item might be tracking.
|
||||
*/
|
||||
if (ip->i_itemp) {
|
||||
err2 = xfs_fsync_flush_log(ip, datasync, &log_flushed);
|
||||
if (err2 && !error)
|
||||
error = err2;
|
||||
error = xfs_fsync_flush_log(ip, datasync, &log_flushed);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -178,14 +180,11 @@ xfs_file_fsync(
|
|||
if (!log_flushed) {
|
||||
struct xfs_buftarg *file_targp = xfs_inode_buftarg(ip);
|
||||
|
||||
if (mp->m_logdev_targp == file_targp) {
|
||||
err2 = blkdev_issue_flush(file_targp->bt_bdev);
|
||||
if (err2 && !error)
|
||||
error = err2;
|
||||
}
|
||||
if (mp->m_logdev_targp == file_targp)
|
||||
return blkdev_issue_flush(file_targp->bt_bdev);
|
||||
}
|
||||
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user