From: "Tobin C. Harding" <me@tobin.cc>
To: linux-fsdevel@vger.kernel.org
Subject: Re: dcache locking question
Date: Fri, 15 Mar 2019 10:19:39 +1100 [thread overview]
Message-ID: <20190314231939.GA17269@eros.localdomain> (raw)
In-Reply-To: <20190314225632.GB15813@eros.localdomain>
On Fri, Mar 15, 2019 at 09:56:32AM +1100, Tobin C. Harding wrote:
> Hi,
>
> I'm not able to understand the locking order in dcache. dcache has been
> around for a while so clearly its right and I'm wrong.
>
> Could someone please explain to me how the locking order commented at
> the top of the file is not violated in the following:
>
> From top of fs/dcache.c
>
> * If there is an ancestor relationship:
> * dentry->d_parent->...->d_parent->d_lock
> * ...
> * dentry->d_parent->d_lock
> * dentry->d_lock
>
This is a more simple example
static struct dentry *dentry_kill(struct dentry *dentry)
__releases(dentry->d_lock)
{
...
slow_positive:
spin_unlock(&dentry->d_lock);
spin_lock(&inode->i_lock);
spin_lock(&dentry->d_lock);
parent = lock_parent(dentry);
...
thanks,
Tobin.
next prev parent reply other threads:[~2019-03-14 23:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-14 22:56 dcache locking question Tobin C. Harding
2019-03-14 23:09 ` Matthew Wilcox
2019-03-15 1:38 ` Tobin C. Harding
2019-03-14 23:19 ` Tobin C. Harding [this message]
2019-03-15 1:50 ` Al Viro
2019-03-15 17:38 ` Eric Biggers
2019-03-15 18:54 ` Al Viro
2019-03-16 22:31 ` Paul E. McKenney
2019-03-17 0:18 ` Al Viro
2019-03-17 0:50 ` Paul E. McKenney
2019-03-17 2:20 ` James Bottomley
2019-03-17 3:06 ` Al Viro
2019-03-17 4:23 ` James Bottomley
2019-03-18 0:35 ` Paul E. McKenney
2019-03-18 16:26 ` James Bottomley
2019-03-18 17:11 ` Paul E. McKenney
2019-03-19 15:45 ` Paul E. McKenney
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=20190314231939.GA17269@eros.localdomain \
--to=me@tobin.cc \
--cc=linux-fsdevel@vger.kernel.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).