public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Brian Foster <bfoster@redhat.com>,
	kaixuxia <xiakaixu1987@gmail.com>,
	linux-xfs@vger.kernel.org, newtongao@tencent.com,
	jasperwang@tencent.com
Subject: Re: [PATCH v2] xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename()
Date: Thu, 7 Nov 2019 14:46:21 +1100	[thread overview]
Message-ID: <20191107034621.GG4614@dread.disaster.area> (raw)
In-Reply-To: <20191106154612.GH4153244@magnolia>

On Wed, Nov 06, 2019 at 07:46:12AM -0800, Darrick J. Wong wrote:
> On Wed, Nov 06, 2019 at 07:49:32AM -0500, Brian Foster wrote:
> > > >  /*
> > > > + * Check whether the replace operation need more blocks.
> > > > + */
> > > > +bool
> > > > +xfs_dir2_sf_replace_needblock(
> > > 
> > > Urgggh.  This is a predicate that we only ever call from xfs_rename(),
> > > right?  And it addresses a particular quirk of the locking when the
> > > caller wants us to rename on top of an existing entry and drop the link
> > > count of the old inode, right?  So why can't this just be a predicate in
> > > xfs_inode.c ?  Nobody else needs to know this particular piece of
> > > information, AFAICT.
> > > 
> > > (Apologies, for Brian and I clearly aren't on the same page about
> > > that...)
> > > 
> > 
> > Hmm.. the crux of my feedback on the previous version was simply that if
> > we wanted to take this approach of pulling up lower level dir logic into
> > the higher level rename code, to simply factor out the existing checks
> > down in the dir replace code that currently trigger a format conversion,
> > and use that new helper in both places. That doesn't appear to be what
> > this patch does, and I'm not sure why there are now two new helpers that
> > each only have one caller instead of one new helper with two callers...
> 
> Aha, got it.  I'd wondered if that had been your intent. :)

So as a structural question: should this be folded into
xfs_dir_canenter(), which is the function used to check if the
directory modification can go ahead without allocating blocks....

This seems very much like it is a "do we need to allocate blocks
during the directory modification?" sort of question being asked
here...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2019-11-07  3:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  9:52 [PATCH v2] xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename() kaixuxia
2019-11-06  4:56 ` Darrick J. Wong
2019-11-06 12:49   ` Brian Foster
2019-11-06 15:46     ` Darrick J. Wong
2019-11-07  3:46       ` Dave Chinner [this message]
2019-11-08 11:48         ` Brian Foster
2019-11-07  5:15   ` kaixuxia

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=20191107034621.GG4614@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.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