From: Brian Foster <bfoster@redhat.com>
To: kaixuxia <xiakaixu1987@gmail.com>
Cc: Dave Chinner <david@fromorbit.com>,
linux-xfs@vger.kernel.org,
"Darrick J. Wong" <darrick.wong@oracle.com>,
newtongao@tencent.com, jasperwang@tencent.com
Subject: Re: [PATCH V2] xfs: Fix agi&agf ABBA deadlock when performing rename with RENAME_WHITEOUT flag
Date: Tue, 20 Aug 2019 06:51:01 -0400 [thread overview]
Message-ID: <20190820105101.GA14307@bfoster> (raw)
In-Reply-To: <62649c5f-5390-8887-fe95-4f873af62804@gmail.com>
On Tue, Aug 20, 2019 at 04:53:22PM +0800, kaixuxia wrote:
>
>
> On 2019/8/20 16:07, Dave Chinner wrote:
> > On Tue, Aug 20, 2019 at 02:45:36PM +0800, kaixuxia wrote:
> > > On 2019/8/19 23:13, Brian Foster wrote:
> > > > /* error checks before we dirty the transaction */
> > > > if (!target_ip && !spaceres) {
> > > > error = xfs_dir_canenter();
> > > > ...
> > > > } else if (S_ISDIR() && !(empty || nlink > 2))
> > > > error = -EEXIST;
> > > > ...
> > > > }
> > > >
> > > > if (wip) {
> > > > ...
> > > > xfs_iunlink_remove();
> > > > }
> > > >
> > > > if (!target_ip) {
> > > > xfs_dir_create();
> > > > ...
> > > > } else {
> > > > xfs_dir_replace();
> > > > ...
> > > > }
> > > >
> > > > ... but that may not be any cleaner..? It could also be done as a
> > > > followup cleanup patch as well.
> > >
> > > Yep, it is cleaner that making the whole check before the transaction
> > > becomes dirty, just return the error code if check failed and
> > > the filesystem is clean.
> >
> > *nod*
> >
> > > Dave gave another solution in the other subthread that using
> > > XFS_DIR3_FT_WHT, it's a bit more work for this bug, include
> > > refactoring the xfs_rename() and xfs_lookup(), not sure whether
> > > it's worth the complex changes for this bug.
> >
Yeah, I wasn't aware of that option. What Dave describes wrt to
replacing the on-disk whiteout inode with a dirent + in-core variant
sounds like the clear best option to me over the ones previously
discussed.
> > It's not necessary to fix the bug, but it's somethign we should
> > be looking to do because it makes whiteout handling a lot more
> > efficient - it's just dirent modifications at that point, no inodes
> > are necessary.
> >
> > This is how I always intended to handle whiteouts - it's just
> > another thing on the "we need to fix" list....
>
> Right, it is more efficient because there is no need to store it on disk,
> and it will improve performance just like the async deferred operations.
> Maybe it is on the roadmap, so I'm not sure whether I should send the V3
> patch to address Brian's comments. Maybe we can choose the V3 patch first,
> and then the whiteout improvement could be done as the followup patch
> in future...
>
I agree. I think a two step process makes sense because we may want a
backportable fix around for the locking bug that doesn't depend on
replacing the implementation.
FWIW if we do take that approach, then IMO it's worth reconsidering the
1-2 liner I originally proposed to fix the locking. It's slightly hacky,
but really all three options are hacky in slightly different ways. The
flipside is it's trivial to implement, review and backport and now would
be removed shortly thereafter when we replace the on-disk whiteout with
the in-core fake whiteout thing. Just my .02 though..
Brian
> >
> > Cheers,
> >
> > Dave.
> >
>
> --
> kaixuxia
next prev parent reply other threads:[~2019-08-20 10:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-19 13:06 [PATCH V2] xfs: Fix agi&agf ABBA deadlock when performing rename with RENAME_WHITEOUT flag kaixuxia
2019-08-19 15:13 ` Brian Foster
2019-08-19 22:12 ` Dave Chinner
2019-08-20 6:45 ` kaixuxia
2019-08-20 8:07 ` Dave Chinner
2019-08-20 8:53 ` kaixuxia
2019-08-20 10:51 ` Brian Foster [this message]
2019-08-20 11:23 ` Dave Chinner
2019-08-20 12:23 ` Brian Foster
2019-08-20 22:13 ` Dave Chinner
2019-08-21 11:25 ` Brian Foster
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=20190820105101.GA14307@bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=jasperwang@tencent.com \
--cc=linux-xfs@vger.kernel.org \
--cc=newtongao@tencent.com \
--cc=xiakaixu1987@gmail.com \
/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