From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>, linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] xfs: handle bad flags in xfs_recover_inode_owner_change
Date: Tue, 18 Dec 2018 11:15:16 -0800 [thread overview]
Message-ID: <20181218191516.GF27208@magnolia> (raw)
In-Reply-To: <3898cc3a-be06-a29e-07f6-9daf52cb7545@sandeen.net>
On Tue, Dec 18, 2018 at 01:02:56PM -0600, Eric Sandeen wrote:
> Today, xfs_recover_inode_owner_change() indicates that if XFS_ILOG_DOWNER
> is set, XFS_ILOG_DBROOT must be as well, via an assert. However, this
> could fail to be true due to fuzzing or corruption, so we really
> should handle it gracefully rather than calling ASSERT() and crashing,
> or blowing past it on a non-debug build and BUGging later.
>
> Return -EFSCORRUPTED and fail the log replay if we find this
> inconsistent state.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 1fc9e9042e0e..56148a3083b8 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -2964,7 +2964,10 @@ xfs_recover_inode_owner_change(
> }
>
> if (in_f->ilf_fields & XFS_ILOG_DOWNER) {
> - ASSERT(in_f->ilf_fields & XFS_ILOG_DBROOT);
> + if (!(in_f->ilf_fields & XFS_ILOG_DBROOT)) {
> + error = -EFSCORRUPTED;
> + goto out_free_ip;
> + }
> error = xfs_bmbt_change_owner(NULL, ip, XFS_DATA_FORK,
> ip->i_ino, buffer_list);
> if (error)
> @@ -2972,7 +2975,10 @@ xfs_recover_inode_owner_change(
> }
>
> if (in_f->ilf_fields & XFS_ILOG_AOWNER) {
> - ASSERT(in_f->ilf_fields & XFS_ILOG_ABROOT);
> + if (!(in_f->ilf_fields & XFS_ILOG_ABROOT)) {
> + error = -EFSCORRUPTED;
> + goto out_free_ip;
Are there any downsides to changing the data fork owner and bailing out
afterwards if we encounter the combination of (DOWNER | DBROOT | AOWNER)?
Thinking this through, the log won't continue recovering, so you have to
run xfs_repair -L which zaps the log and checks everything. We already
finished the data fork bmbt update so (barring other problems) it should
be fine. The attr fork won't have been updated, but its log entries
were unrecoverable, so at worst we lose the attr fork, right?
And we don't want the ABROOT check any earlier, because we don't want to
forego a data fork owner update that might have succeeded anyway and
we'll definitely lose it if we don't update it and xfs_repair encounters
it. Right?
If so, then,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> + }
> error = xfs_bmbt_change_owner(NULL, ip, XFS_ATTR_FORK,
> ip->i_ino, buffer_list);
> if (error)
>
next prev parent reply other threads:[~2018-12-18 19:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-18 18:59 [PATCH 0/2] xfs: swapext replay fixes Eric Sandeen
2018-12-18 19:02 ` [PATCH 1/2] xfs: handle bad flags in xfs_recover_inode_owner_change Eric Sandeen
2018-12-18 19:15 ` Darrick J. Wong [this message]
2018-12-18 19:23 ` Eric Sandeen
2018-12-18 19:30 ` Darrick J. Wong
2018-12-18 19:09 ` [PATCH 2/2] xfs: clear XFS_ILOG_[AD]OWNER for non-btree formats Eric Sandeen
2018-12-18 19:28 ` Darrick J. Wong
2018-12-18 19:42 ` Eric Sandeen
2018-12-18 19:31 ` [PATCH 0/2] xfs: swapext replay fixes Darrick J. Wong
2018-12-18 19:43 ` Eric Sandeen
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=20181218191516.GF27208@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=sandeen@sandeen.net \
/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