linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	viro@ZenIV.linux.org.uk, willy@infradead.org, andres@anarazel.de
Subject: Re: [RFC PATCH 08/11] xfs: have sync_fs op report writeback errors when passed a since pointer
Date: Tue, 22 May 2018 09:01:44 +1000	[thread overview]
Message-ID: <20180521230144.GQ10363@dastard> (raw)
In-Reply-To: <20180518123415.28181-9-jlayton@kernel.org>

On Fri, May 18, 2018 at 08:34:12AM -0400, Jeff Layton wrote:
> From: Jeff Layton <jlayton@redhat.com>
> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/xfs/xfs_super.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 9255de2767b4..7dc847f48f9f 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1092,6 +1092,7 @@ xfs_fs_sync_fs(
>  	int			wait,
>  	errseq_t		*since)
>  {
> +	int			ret;
>  	struct xfs_mount	*mp = XFS_M(sb);
>  
>  	/*
> @@ -1110,7 +1111,13 @@ xfs_fs_sync_fs(
>  		flush_delayed_work(&mp->m_log->l_work);
>  	}
>  out:
> -	return __sync_blockdev(sb->s_bdev, wait);

Where did this come from? XFS doesn't use the underlying blockdev
address space, so this does nothing at all and should not be here.

> +	ret = __sync_blockdev(sb->s_bdev, wait);
> +	if (since) {
> +		int ret2 = errseq_check_and_advance(&sb->s_wb_err, since);
> +		if (ret == 0)
> +			ret = ret2;
> +	}
> +	return ret;
>  }

So to return errors correctly, xfs_fs_sync_fs() needs to capture
errors from the log force (i.e. metadata errors such as filesystem
shutdowns, journal IO errors, etc), then check for pending data IO
errors. i.e:


 STATIC int
 xfs_fs_sync_fs(
 	struct super_block      *sb,
 	int                     wait)
 {
 	struct xfs_mount        *mp = XFS_M(sb);
+	int			err;
 
 	/*
 	 * Doing anything during the async pass would be counterproductive.
 	 */
 	if (!wait)
 		return 0;
 
-	xfs_log_force(mp, XFS_LOG_SYNC);
+	err = xfs_log_force(mp, XFS_LOG_SYNC);
+	if (err)
+		return err;
+
 	if (laptop_mode) {
 		/*
 		 * The disk must be active because we're syncing.
 		 * We schedule log work now (now that the disk is
 		 * active) instead of later (when it might not be).
 		 */
 		flush_delayed_work(&mp->m_log->l_work);
 	}
 
-	return 0
+	return errseq_check_and_advance(&sb->s_wb_err, since);
 }

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2018-05-21 23:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 12:34 [RFC PATCH 00/11] vfs: have syncfs return an error when inode writeback fails Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 01/11] vfs: push __sync_blockdev calls down into sync_fs routines Jeff Layton
2018-05-18 15:56   ` Christoph Hellwig
2018-05-18 17:56     ` Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 02/11] vfs: add a new errseq_t pointer to sync_fs prototype Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 03/11] vfs: add an errseq_t pointer to sync_filesystem Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 04/11] vfs: add errseq_t pointer to __sync_filesystem Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 05/11] fs: track per-sb writeback errors and report them to syncfs Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 06/11] buffer: record blockdev write errors in super_block that backs them Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 07/11] ext4: have sync_fs op report writeback errors when passed a since pointer Jeff Layton
2018-05-18 15:22   ` Matthew Wilcox
2018-05-18 16:50     ` Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 08/11] xfs: " Jeff Layton
2018-05-21 23:01   ` Dave Chinner [this message]
2018-05-21 23:23     ` Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 09/11] btrfs: " Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 10/11] ext2: " Jeff Layton
2018-05-18 12:34 ` [RFC PATCH 11/11] vfs: have call_sync_fs " Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180521230144.GQ10363@dastard \
    --to=david@fromorbit.com \
    --cc=andres@anarazel.de \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).