From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
Dave Chinner <david@fromorbit.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: dcache shrink list corruption?
Date: Wed, 30 Apr 2014 23:12:38 +0100 [thread overview]
Message-ID: <20140430221238.GV18016@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20140430211206.GU18016@ZenIV.linux.org.uk>
On Wed, Apr 30, 2014 at 10:12:06PM +0100, Al Viro wrote:
> On Wed, Apr 30, 2014 at 01:57:05PM -0700, Linus Torvalds wrote:
> > On Wed, Apr 30, 2014 at 1:38 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> > >
> > > We do not (and cannot) call dentry_kill() with rcu_read_lock held - it can
> > > trigger any amount of IO, for one thing. We can take it around the
> > > couple of places where do that spin_unlock(&dentry->d_lock) (along with
> > > setting DCACHE_RCUACCESS) - that's what I'd been refering to.
> >
> > Just the last spin_unlock() would be the case that matters, if the
> > spin_unlock() is done on something that could be freed immediately and
> > the lock protects and is inside the entity that gets freed.
>
> *nod*
>
> There are two such spin_unlock (handover from shrink_dentry_list() to
> dput() and the opposite one), but they are all that needs protection -
> ->d_flags update is outside the rcu-critical area. I really wonder
> if we *can* get there without DCACHE_RCUACCESS having been set, though;
> dentry would have to be
> * picked into shrink list (i.e. have had zero refcount at some point)
> * never had been through __d_rehash()
> shrink_dentry_list() definitely counts on that being impossible, and it
> probably is, but I'm feeling seriously paranoid about the whole area.
> I'll finish grepping through the tree and probably drop setting
> DCACHE_RCUACCESS from the patch - either that, or set it in d_shrink_add()
> it it turns out that it is possible and shrink_dentry_list() is fucked...
OK, it really can't happen. The proof is more convoluted than I'd like it,
but it's solid enough, so setting that flag in dentry_kill() handover cases
wasn't needed. I've just pushed the whole thing to vfs.git#for-linus;
review and testing would be very welcome. I can repost it one more time,
but the only difference compared to the last variant in this thread is not
bothering with DCACHE_RCUACCESS.
It has survived LTP tests, going through xfstests now...
next prev parent reply other threads:[~2014-04-30 22:12 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-29 16:01 dcache shrink list corruption? Miklos Szeredi
2014-04-29 17:43 ` Linus Torvalds
2014-04-29 18:03 ` Miklos Szeredi
2014-04-29 18:16 ` Al Viro
2014-04-29 19:10 ` Al Viro
2014-04-29 21:18 ` Dave Chinner
2014-04-29 21:48 ` Al Viro
2014-04-29 23:04 ` Linus Torvalds
2014-04-29 23:20 ` Al Viro
2014-04-30 2:31 ` Al Viro
2014-04-30 2:56 ` Linus Torvalds
2014-04-30 4:04 ` Al Viro
2014-04-30 15:49 ` Miklos Szeredi
2014-04-30 15:56 ` Miklos Szeredi
2014-04-30 16:03 ` Al Viro
2014-04-30 17:33 ` Miklos Szeredi
2014-04-30 18:36 ` Al Viro
2014-04-30 18:42 ` Miklos Szeredi
2014-04-30 19:02 ` Al Viro
2014-04-30 19:59 ` Al Viro
2014-04-30 20:23 ` Linus Torvalds
2014-04-30 20:38 ` Al Viro
2014-04-30 20:57 ` Linus Torvalds
2014-04-30 21:12 ` Al Viro
2014-04-30 22:12 ` Al Viro [this message]
2014-04-30 23:04 ` Linus Torvalds
2014-04-30 23:14 ` Linus Torvalds
2014-04-30 23:43 ` Al Viro
2014-05-01 0:18 ` Linus Torvalds
2014-05-01 2:51 ` Al Viro
2014-05-01 2:59 ` Linus Torvalds
2014-05-01 3:12 ` Al Viro
2014-05-01 9:42 ` Miklos Szeredi
2014-05-01 14:34 ` Al Viro
2014-05-01 21:02 ` Al Viro
2014-05-01 21:05 ` Al Viro
2014-05-01 22:52 ` Linus Torvalds
2014-05-02 8:43 ` Szeredi Miklos
2014-05-02 21:04 ` Linus Torvalds
2014-04-30 23:38 ` Al Viro
2014-04-30 9:15 ` Miklos Szeredi
2014-05-02 5:51 ` Al Viro
2014-05-02 9:00 ` Szeredi Miklos
2014-05-02 21:02 ` Miklos Szeredi
2014-05-02 21:08 ` Miklos Szeredi
2014-05-02 21:18 ` Linus Torvalds
2014-05-02 22:40 ` Al Viro
2014-05-02 23:06 ` Al Viro
2014-05-03 4:26 ` Al Viro
2014-05-03 18:07 ` Linus Torvalds
2014-05-03 18:25 ` Al Viro
2014-05-03 18:21 ` Al Viro
2014-05-04 6:29 ` Al Viro
2014-05-06 10:17 ` Miklos Szeredi
2014-05-06 14:53 ` Linus Torvalds
2014-05-06 16:52 ` Al Viro
2014-05-06 17:01 ` Linus Torvalds
2014-05-06 19:15 ` Al Viro
2014-05-02 22:32 ` Al Viro
2014-04-29 18:17 ` Linus Torvalds
2014-04-29 17:56 ` Al Viro
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=20140430221238.GV18016@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--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).