xfs: ensure sync write errors are returned
commita363f0c2030cb9781e7e458f4a9e354b6c43d7ce
authorDave Chinner <dchinner@redhat.com>
Mon, 10 Jan 2011 23:13:53 +0000 (11 10:13 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 10 Jan 2011 23:13:53 +0000 (11 10:13 +1100)
tree7152662c40e6754194c6810c7331c87cdc338cb6
parentd0eb2f38b250b7d6c993adf81b0e4ded0565497e
xfs: ensure sync write errors are returned

xfs_file_aio_write() only returns the error from synchronous
flushing of the data and inode if error == 0. At the point where
error is being checked, it is guaranteed to be > 0. Therefore any
errors returned by the data or fsync flush will never be returned.
Fix the checks so we overwrite the current error once and only if an
error really occurred.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/linux-2.6/xfs_file.c