All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: fix error handling in xfs_refcount_insert()
Date: Thu, 31 May 2018 16:48:43 -0700	[thread overview]
Message-ID: <20180531234843.GF7825@magnolia> (raw)
In-Reply-To: <20180531234625.31925-1-david@fromorbit.com>

On Fri, Jun 01, 2018 at 09:46:25AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> generic/475 fired an assert failure just after the filesystem was
> shut down:
> 
> XFS: Assertion failed: fs_is_ok, file: fs/xfs/libxfs/xfs_refcount.c, line: 182
> .....
> Call Trace:
>  xfs_refcount_insert+0x151/0x190
>  xfs_refcount_adjust_extents.constprop.11+0x9c/0x470
>  xfs_refcount_adjust.constprop.10+0xb0/0x270
>  xfs_refcount_finish_one+0x25a/0x420
>  xfs_trans_log_finish_refcount_update+0x2a/0x40
>  xfs_refcount_update_finish_item+0x35/0xa0
>  xfs_defer_finish+0x15e/0x4d0
>  xfs_reflink_remap_extent+0x1bc/0x610
>  xfs_reflink_remap_blocks+0x6e/0x280
>  xfs_reflink_remap_range+0x311/0x530
>  vfs_clone_file_range+0x119/0x200
>  ....
> 
> If xfs_btree_insert() returns an error, the corruption check fires
> instead of passing the error back the caller. The corruption check
> should be after we've checked for an error, not before, thereby
> avoiding assert failures if the filesystem shuts down during a
> refcount btree record insert.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

HAAA I ARE DUMMM

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/libxfs/xfs_refcount.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c
> index ae07a85d9bd5..235a9cf7265f 100644
> --- a/fs/xfs/libxfs/xfs_refcount.c
> +++ b/fs/xfs/libxfs/xfs_refcount.c
> @@ -165,7 +165,10 @@ xfs_refcount_insert(
>  	cur->bc_rec.rc.rc_blockcount = irec->rc_blockcount;
>  	cur->bc_rec.rc.rc_refcount = irec->rc_refcount;
>  	error = xfs_btree_insert(cur, i);
> +	if (error)
> +		goto out_error;
>  	XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, *i == 1, out_error);
> +
>  out_error:
>  	if (error)
>  		trace_xfs_refcount_insert_error(cur->bc_mp,
> -- 
> 2.17.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2018-05-31 23:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 23:46 [PATCH] xfs: fix error handling in xfs_refcount_insert() Dave Chinner
2018-05-31 23:48 ` Darrick J. Wong [this message]

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=20180531234843.GF7825@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.