]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: check return codes when flushing block devices
authorDarrick J. Wong <djwong@kernel.org>
Thu, 28 Jul 2022 20:35:31 +0000 (13:35 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Sat, 6 Aug 2022 00:00:36 +0000 (17:00 -0700)
commite11849470f68aa4d65b5e04b7ce599ce8d238626
tree15a198d1639904db7e683edf22d8fa2a4f53ded5
parent68166a0d968d50c749c7d317986f41f32f1fcfd6
xfs: check return codes when flushing block devices

If a blkdev_issue_flush fails, fsync needs to report that to upper
levels.  Modify xfs_file_fsync to capture the errors, while trying to
flush as much data and log updates to disk as possible.

If log writes cannot flush the data device, we need to shut down the log
immediately because we've violated a log invariant.  Modify this code to
check the return value of blkdev_issue_flush as well.

This behavior seems to go back to about 2.6.15 or so, which makes this
fixes tag a bit misleading.

Link: https://elixir.bootlin.com/linux/v2.6.15/source/fs/xfs/xfs_vnodeops.c#L1187
Fixes: 321fb2c47bad ("xfs: remove xfs_blkdev_issue_flush")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_file.c
fs/xfs/xfs_log.c