diff mbox series

[4/4] xfs: return errors in xfs_fs_sync_fs

Message ID 164316351155.2600168.3007243245021307622.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series vfs: actually return fs errors from ->sync_fs | expand

Commit Message

Darrick J. Wong Jan. 26, 2022, 2:18 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Now that the VFS will do something with the return values from
->sync_fs, make ours pass on error codes.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/xfs_super.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Jan Kara Jan. 26, 2022, 10:45 a.m. UTC | #1
On Tue 25-01-22 18:18:31, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Now that the VFS will do something with the return values from
> ->sync_fs, make ours pass on error codes.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/xfs_super.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Makes sence. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
> 
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index e8f37bdc8354..4c0dee78b2f8 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -735,6 +735,7 @@ xfs_fs_sync_fs(
>  	int			wait)
>  {
>  	struct xfs_mount	*mp = XFS_M(sb);
> +	int			error;
>  
>  	trace_xfs_fs_sync_fs(mp, __return_address);
>  
> @@ -744,7 +745,10 @@ xfs_fs_sync_fs(
>  	if (!wait)
>  		return 0;
>  
> -	xfs_log_force(mp, XFS_LOG_SYNC);
> +	error = xfs_log_force(mp, XFS_LOG_SYNC);
> +	if (error)
> +		return error;
> +
>  	if (laptop_mode) {
>  		/*
>  		 * The disk must be active because we're syncing.
>
Christoph Hellwig Jan. 26, 2022, 5:03 p.m. UTC | #2
On Tue, Jan 25, 2022 at 06:18:31PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Now that the VFS will do something with the return values from
> ->sync_fs, make ours pass on error codes.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index e8f37bdc8354..4c0dee78b2f8 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -735,6 +735,7 @@  xfs_fs_sync_fs(
 	int			wait)
 {
 	struct xfs_mount	*mp = XFS_M(sb);
+	int			error;
 
 	trace_xfs_fs_sync_fs(mp, __return_address);
 
@@ -744,7 +745,10 @@  xfs_fs_sync_fs(
 	if (!wait)
 		return 0;
 
-	xfs_log_force(mp, XFS_LOG_SYNC);
+	error = xfs_log_force(mp, XFS_LOG_SYNC);
+	if (error)
+		return error;
+
 	if (laptop_mode) {
 		/*
 		 * The disk must be active because we're syncing.