From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, npiggin@kernel.dk
Subject: Re: ->d_lock FUBAR (was Re: Linux 3.0-rc6)
Date: Wed, 13 Jul 2011 03:59:18 +0100 [thread overview]
Message-ID: <20110713025918.GM11013@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CA+55aFzz3b_FiVXKqq0RfUudyt_T2VWFPBLoKPhMa3fDprmn1w@mail.gmail.com>
On Tue, Jul 12, 2011 at 07:40:01PM -0700, Linus Torvalds wrote:
> It's dentry_lock_for_move() that makes me really nervous. Not only
> does it lock up to four dentries, but it mixes the whole parenthood vs
> pointer ordering. Or course, it does have those BUG_ON() checks, so
> it should never cause any circular dependencies, but still..
Me too, obviously.
> The actual main protection to get lookups correct in the presence of
> concurrent moves largely depends on the sequence numbers (ie
> d_lookup() retrying if it hits a rename), which is why I also find it
> unlikely that we really should need to hold all those d_lock cases all
> at the same time.
>
> So does d_move() really need to get all the locks at the same time and
> then do all the operations inside that "super-locked" region? Or could
> we get the locks in sequence and do individual parts of the rename
> operations under individual locks?
>
> Are there any other d_lock cases that depend on the pointer ordering?
> Most everything else seems to be about direct parenthood, no?
It's not that easy. We want ->d_lock on parents - not only because
there's code iterating through the list of children, but because
ordering on direct parenthood bloody depends on children not moving
out while we hold ->d_lock on their parent. Otherwise we are looking
for nightmares in shrink_dcache_parent() et.al.
I'm not sure how much do we care about stability of x->d_parent when
x->d_lock is held. ->d_compare() is the most obvious potential area
of trouble in that respect, but there might be more.
I'm still not finished reviewing ->d_lock uses; about a couple of hundreds
is left to wade through. I would really, *REALLY* appreciate explicitly
defined locking rules from Nick (it's his changes, mostly). As in "this,
this and that field is protected by ->d_lock on..."
Note that ->d_parent is stable when i_mutex is held on parent, which
makes most of the users of ->d_parent safe and fine (->lookup(), etc.
are all called with directory locked). I've not finished reviewing
->d_parent users either, but IMO ->d_lock review is more important, so
it got bumped in front of queue...
Back to GrepTFS and stripping the paint off the walls...
next prev parent reply other threads:[~2011-07-13 2:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CA+55aFxQw4T07hxz8JSm12x3FOH_Dcf=G5mvLrxiTuLxjbw+Mg@mail.gmail.com>
2011-07-11 6:03 ` Linux 3.0-rc6 Al Viro
2011-07-12 23:48 ` ->d_lock FUBAR (was Re: Linux 3.0-rc6) Al Viro
2011-07-13 0:04 ` Linus Torvalds
2011-07-13 0:56 ` Al Viro
2011-07-13 1:39 ` Al Viro
2011-07-13 2:40 ` Linus Torvalds
2011-07-13 2:59 ` Al Viro [this message]
2011-07-13 3:22 ` Al Viro
2011-07-13 3:56 ` Linus Torvalds
2011-07-14 7:21 ` Al Viro
2011-07-15 4:58 ` Al Viro
2011-07-13 1:48 ` Linus Torvalds
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=20110713025918.GM11013@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=npiggin@kernel.dk \
--cc=torvalds@linux-foundation.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).