[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFyP9JtyzUzA_S2sdKCK+8CZtNoA3UkXg5X4J0Hf2_ekjg@mail.gmail.com>
Date: Fri, 23 Feb 2018 13:35:52 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Christoph Hellwig <hch@....de>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
John Ogness <john.ogness@...utronix.de>
Subject: Re: [BUG] lock_parent() breakage when used from shrink_dentry_list()
(was Re: [PATCH v2 6/6] fs/dcache: Avoid remaining try_lock loop in shrink_dentry_list())
On Fri, Feb 23, 2018 at 12:13 PM, Al Viro <viro@...iv.linux.org.uk> wrote:
> Look:
> dentry placed on a shrink list
> we pick the fucker from the list and lock it.
> we call lock_parent() on it.
> dentry is not a root and it's not deleted, so we proceed.
> trylock fails.
> we grab rcu_read_lock()
> we drop dentry->d_lock
[ deleted the bad things ]
Should we just instead get the ref to the dentry before dropping the
lock, so that nobody else can get to dentry_kill?
This is too subtle, and your fix to check d_lockref.count < 0 sounds
wrong to me. If it's really gone, maybe it has been reused and the
refcount is positive again, but it's something else than a dentry
entirely?
Hmm.
No, you extended the rcu read section, so I guess your patch is fine.
And lock_parent already has that pattern, soiit's not new.
Ok, I agree, looks like lock_parent should just re-check that thing
that it already checked earler, but that now might be true again
because of we dropped d_lock.
Linus
Powered by blists - more mailing lists