From: Bill O'Donnell <billodo@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/3] xfs: remove more ondisk directory corruption asserts
Date: Thu, 8 Aug 2019 11:05:55 -0500 [thread overview]
Message-ID: <20190808160555.GA19733@redhat.com> (raw)
In-Reply-To: <156527562244.1960675.10725983010213633067.stgit@magnolia>
On Thu, Aug 08, 2019 at 07:47:02AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Continue our game of replacing ASSERTs for corrupt ondisk metadata with
> EFSCORRUPTED returns.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Looks good to me.
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
> ---
> fs/xfs/libxfs/xfs_da_btree.c | 19 ++++++++++++-------
> fs/xfs/libxfs/xfs_dir2_node.c | 3 ++-
> 2 files changed, 14 insertions(+), 8 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
> index d1c77fd0815d..0bf56e94bfe9 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.c
> +++ b/fs/xfs/libxfs/xfs_da_btree.c
> @@ -487,10 +487,8 @@ xfs_da3_split(
> ASSERT(state->path.active == 0);
> oldblk = &state->path.blk[0];
> error = xfs_da3_root_split(state, oldblk, addblk);
> - if (error) {
> - addblk->bp = NULL;
> - return error; /* GROT: dir is inconsistent */
> - }
> + if (error)
> + goto out;
>
> /*
> * Update pointers to the node which used to be block 0 and just got
> @@ -505,7 +503,10 @@ xfs_da3_split(
> */
> node = oldblk->bp->b_addr;
> if (node->hdr.info.forw) {
> - ASSERT(be32_to_cpu(node->hdr.info.forw) == addblk->blkno);
> + if (be32_to_cpu(node->hdr.info.forw) != addblk->blkno) {
> + error = -EFSCORRUPTED;
> + goto out;
> + }
> node = addblk->bp->b_addr;
> node->hdr.info.back = cpu_to_be32(oldblk->blkno);
> xfs_trans_log_buf(state->args->trans, addblk->bp,
> @@ -514,15 +515,19 @@ xfs_da3_split(
> }
> node = oldblk->bp->b_addr;
> if (node->hdr.info.back) {
> - ASSERT(be32_to_cpu(node->hdr.info.back) == addblk->blkno);
> + if (be32_to_cpu(node->hdr.info.back) != addblk->blkno) {
> + error = -EFSCORRUPTED;
> + goto out;
> + }
> node = addblk->bp->b_addr;
> node->hdr.info.forw = cpu_to_be32(oldblk->blkno);
> xfs_trans_log_buf(state->args->trans, addblk->bp,
> XFS_DA_LOGRANGE(node, &node->hdr.info,
> sizeof(node->hdr.info)));
> }
> +out:
> addblk->bp = NULL;
> - return 0;
> + return error;
> }
>
> /*
> diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
> index afcc6642690a..1fc44efc344d 100644
> --- a/fs/xfs/libxfs/xfs_dir2_node.c
> +++ b/fs/xfs/libxfs/xfs_dir2_node.c
> @@ -741,7 +741,8 @@ xfs_dir2_leafn_lookup_for_entry(
> ents = dp->d_ops->leaf_ents_p(leaf);
>
> xfs_dir3_leaf_check(dp, bp);
> - ASSERT(leafhdr.count > 0);
> + if (leafhdr.count <= 0)
> + return -EFSCORRUPTED;
>
> /*
> * Look up the hash value in the leaf entries.
>
next prev parent reply other threads:[~2019-08-08 16:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 14:46 [PATCH 0/3] xfs: various fixes for 5.3 Darrick J. Wong
2019-08-08 14:46 ` [PATCH 1/3] vfs: fix page locking deadlocks when deduping files Darrick J. Wong
2019-08-09 12:35 ` Bill O'Donnell
2019-08-11 23:09 ` Dave Chinner
2019-08-08 14:47 ` [PATCH 2/3] xfs: remove more ondisk directory corruption asserts Darrick J. Wong
2019-08-08 16:05 ` Bill O'Donnell [this message]
2019-08-08 14:47 ` [PATCH 3/3] xfs: don't crash on null attr fork xfs_bmapi_read Darrick J. Wong
2019-08-08 14:51 ` Bill O'Donnell
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=20190808160555.GA19733@redhat.com \
--to=billodo@redhat.com \
--cc=darrick.wong@oracle.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 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).