From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>, wen.xu@gatech.edu
Subject: Re: [PATCH] xfs: set format back to extents if xfs_bmap_extents_to_btree fails
Date: Mon, 16 Apr 2018 23:03:32 -0700 [thread overview]
Message-ID: <20180417060332.GF5203@magnolia> (raw)
In-Reply-To: <0add6e45-4382-c16b-3bb1-1d4eaee1adc3@redhat.com>
On Mon, Apr 16, 2018 at 11:26:12PM -0500, Eric Sandeen wrote:
> If xfs_bmap_extents_to_btree fails in a mode where we call
> xfs_iroot_realloc(-1) to de-allocate the root, set the
> format back to extents.
>
> Otherwise we can assume we can dereference ifp->if_broot
> based on the XFS_DINODE_FMT_BTREE format, and crash.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199423
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Looks ok, will test...
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
>
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 6a7c2f0..040eeda 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -725,12 +725,16 @@ static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
> *logflagsp = 0;
> if ((error = xfs_alloc_vextent(&args))) {
> xfs_iroot_realloc(ip, -1, whichfork);
> + ASSERT(ifp->if_broot == NULL);
> + XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
> xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
> return error;
> }
>
> if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) {
> xfs_iroot_realloc(ip, -1, whichfork);
> + ASSERT(ifp->if_broot == NULL);
> + XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
> xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
> return -ENOSPC;
> }
>
> --
> 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
next prev parent reply other threads:[~2018-04-17 6:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 4:26 [PATCH] xfs: set format back to extents if xfs_bmap_extents_to_btree fails Eric Sandeen
2018-04-17 6:03 ` Darrick J. Wong [this message]
2018-04-17 7:10 ` Christoph Hellwig
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=20180417060332.GF5203@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=wen.xu@gatech.edu \
/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).