From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs <linux-xfs@vger.kernel.org>,
Tomasz Torcz <tomek@pipebreaker.pl>
Subject: Re: [PATCH 2/2 V2] xfs_repair: continue after xfs_bunmapi deadlock avoidance
Date: Tue, 23 Oct 2018 08:30:40 -0700 [thread overview]
Message-ID: <20181023153040.GB28243@magnolia> (raw)
In-Reply-To: <7dbb215e-761d-8a9e-87e8-e285e551b64b@sandeen.net>
On Tue, Oct 23, 2018 at 08:57:03AM -0500, Eric Sandeen wrote:
> xfs_bunmapi can legitimately return before all work is done, to
> avoid deadlocks across AGs.
>
> Sadly nobody told xfs_repair, so it fires an assert if this happens:
>
> phase6.c:1410: longform_dir2_rebuild: Assertion `done' failed.
>
> Fix this by calling back in until all work is done, as we do
> in the kernel.
>
> Fixes: 5a8bcc ("xfs: fix multi-AG deadlock in xfs_bunmapi")
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1641116
> Reported-by: Tomasz Torcz <tomek@pipebreaker.pl>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> V2: libxfs-ify the code, remove now-pointless assert, thanks Darrick!
>
>
> diff --git a/repair/phase6.c b/repair/phase6.c
> index e017326..bdbbbaa 100644
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -1317,7 +1317,7 @@ longform_dir2_rebuild(
> xfs_fileoff_t lastblock;
> xfs_inode_t pip;
> dir_hash_ent_t *p;
> - int done;
> + int done = 0;
>
> /*
> * trash directory completely and rebuild from scratch using the
> @@ -1352,14 +1352,25 @@ longform_dir2_rebuild(
> error);
>
> /* free all data, leaf, node and freespace blocks */
> - error = -libxfs_bunmapi(tp, ip, 0, lastblock, XFS_BMAPI_METADATA, 0,
> - &done);
> - if (error) {
> - do_warn(_("xfs_bunmapi failed -- error - %d\n"), error);
> - goto out_bmap_cancel;
> - }
> -
> - ASSERT(done);
> + while (!done) {
> + error = -libxfs_bunmapi(tp, ip, 0, lastblock, XFS_BMAPI_METADATA,
> + 0, &done);
> + if (error) {
> + do_warn(_("xfs_bunmapi failed -- error - %d\n"), error);
> + goto out_bmap_cancel;
> + }
> + error = -libxfs_defer_finish(&tp);
> + if (error) {
> + do_warn(("defer_finish failed -- error - %d\n"), error);
> + goto out_bmap_cancel;
> + }
> + /*
> + * Close out trans and start the next one in the chain.
> + */
> + error = -libxfs_trans_roll_inode(&tp, ip);
> + if (error)
No do_warn() here? :)
With that,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> + goto out_bmap_cancel;
> + }
>
> error = -libxfs_dir_init(tp, ip, &pip);
> if (error) {
>
>
prev parent reply other threads:[~2018-10-23 23:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-23 4:03 [PATCH 0/2] xfs_repair: two fixes Eric Sandeen
2018-10-23 4:04 ` [PATCH 1/2] xfs_repair: initialize realloced bplist in longform_dir2_entry_check Eric Sandeen
2018-10-23 4:23 ` Darrick J. Wong
2018-10-23 4:08 ` [PATCH 2/2] xfs_repair: continue after xfs_bunmapi deadlock avoidance Eric Sandeen
2018-10-23 4:22 ` Darrick J. Wong
2018-10-23 13:57 ` [PATCH 2/2 V2] " Eric Sandeen
2018-10-23 15:30 ` 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=20181023153040.GB28243@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
--cc=tomek@pipebreaker.pl \
/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).