From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs: hold quota inode ILOCK_EXCL until the end of dqalloc
Date: Thu, 6 Jan 2022 12:40:04 +1100 [thread overview]
Message-ID: <20220106014004.GQ945095@dread.disaster.area> (raw)
In-Reply-To: <20220104234216.GI31583@magnolia>
On Tue, Jan 04, 2022 at 03:42:16PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Online fsck depends on callers holding ILOCK_EXCL from the time they
> decide to update a block mapping until after they've updated the reverse
> mapping records to guarantee the stability of both mapping records.
> Unfortunately, the quota code drops ILOCK_EXCL at the first transaction
> roll in the dquot allocation process, which breaks that assertion. This
> leads to sporadic failures in the online rmap repair code if the repair
> code grabs the AGF after bmapi_write maps a new block into the quota
> file's data fork but before it can finish the deferred rmap update.
>
> Fix this by rewriting the function to hold the ILOCK until after the
> transaction commit like all other bmap updates do, and get rid of the
> dqread wrapper that does nothing but complicate the codebase.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/xfs_dquot.c | 79 ++++++++++++++++++----------------------------------
> 1 file changed, 28 insertions(+), 51 deletions(-)
Yup, much nicer. I was just pondering if I should clean up the weird
transaction stuff when looking at the xfs_bmapi_write() call in this
function, but now I don't have to :)
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2022-01-06 1:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 23:42 [PATCH] xfs: hold quota inode ILOCK_EXCL until the end of dqalloc Darrick J. Wong
2022-01-06 1:40 ` Dave Chinner [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=20220106014004.GQ945095@dread.disaster.area \
--to=david@fromorbit.com \
--cc=djwong@kernel.org \
--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