Commit 563f881c authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Long Li
Browse files

xfs: check return codes when flushing block devices

mainline inclusion
from mainline-v5.19-rc5
commit 7d839e32
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I76JSK
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7d839e325af221ff69d52e15c112cf09da91d149

--------------------------------

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: b5071ada ("xfs: remove xfs_blkdev_issue_flush")
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>

conflicts:
fs/xfs/xfs_file.c
fs/xfs/xfs_log.c

Signed-off-by: default avatarYe Bin <yebin@huaweicloud.com>
Signed-off-by: default avatarLong Li <leo.lilong@huawei.com>
parent ce2f113e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment