xfs: simplify inode flush error handling
authorBrian Foster <bfoster@redhat.com>
Wed, 6 May 2020 20:25:20 +0000 (13:25 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 7 May 2020 15:27:45 +0000 (08:27 -0700)
commitf20192991d791293ccb7f6a073bb28de572f799a
tree275386d2e7e2cd224dcea500307608eebcd1942d
parent54b3b1f619efbc838870735db2ddde9450f93a8f
xfs: simplify inode flush error handling

The inode flush code has several layers of error handling between
the inode and cluster flushing code. If the inode flush fails before
acquiring the backing buffer, the inode flush is aborted. If the
cluster flush fails, the current inode flush is aborted and the
cluster buffer is failed to handle the initial inode and any others
that might have been attached before the error.

Since xfs_iflush() is the only caller of xfs_iflush_cluster(), the
error handling between the two can be condensed in the top-level
function. If we update xfs_iflush_int() to always fall through to
the log item update and attach the item completion handler to the
buffer, any errors that occur after the first call to
xfs_iflush_int() can be handled with a buffer I/O failure.

Lift the error handling from xfs_iflush_cluster() into xfs_iflush()
and consolidate with the existing error handling. This also replaces
the need to release the buffer because failing the buffer with
XBF_ASYNC drops the current reference.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_inode.c