From: Joel Becker <Joel.Becker@oracle.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Re: [PATCH] configfs: Silence lockdep on mkdir(), rmdir() and configfs_depend_item()
Date: Thu, 18 Dec 2008 14:58:37 -0800 [thread overview]
Message-ID: <20081218225837.GB21870@mail.oracle.com> (raw)
In-Reply-To: <1229603308.9487.227.camel@twins>
On Thu, Dec 18, 2008 at 01:28:28PM +0100, Peter Zijlstra wrote:
> In fact, both (configfs) mkdir and rmdir seem to synchronize on
> su_mutex..
>
> mkdir B/C/bar
>
> C.i_mutex
> su_mutex
>
> vs
>
> rmdir foo
>
> parent(foo).i_mutex
> foo.i_mutex
> su_mutex
>
>
> once holding the rmdir su_mutex you can check foo's user-content, since
> any mkdir will be blocked. All you have to do is then re-validate in
> mkdir's su_mutex that !IS_DEADDIR(C).
We explicitly do not take any i_mutex locks after taking
su_mutex. That's an ABBA risk. su_mutex protects the hierarchy of
config_items. i_mutex protects the vfs view thereof.
If you look in mkdir, we take su_mutex, get a new item from the
client subsystem, then drop su_mutex. After that, we go about building
our filesystem structure, using i_mutex where appropriate. More
importantly is rmdir(2), where we use i_mutex in
configfs_detach_group(), but are not holding su_sem. Only when
configfs_detach_group() has successfully returned and we have torn down
the filesystem structure do we take su_mutex and tear down the
config_item structure.
In fact, we're part of the way there. Check out that
USET_DROPPING flag we set in detach_prep() while scanning for user
objects. That flags us racing mkdir(2). When we are done with
detach_prep(), we know that mkdir(2) calls racing behind us will do
nothing until we safely lock them out with the locking in
detach_group(). All mkdir(2) calls will have exited by the time we get
the mutex, and no new mkdir(2) call can start because we have the mutex.
Now look in detach_groups(). We drop the groups children before
marking them DEAD. Louis' plan, I think, is to perhaps mark a group
DEAD, disconnect it from the vfs, and then operate on its children. In
this fashion, perhaps we can unlock the trailing lock like a normal VFS
operation.
This will require some serious auditing, however, because now
vfs functions can get into the vfs objects behind us. And more vfs
changes affect us. Whereas the current locking relies on the vfs's
parent->child lock ordering only, something that isn't likely to be
changed.
Joel
--
"You cannot bring about prosperity by discouraging thrift. You cannot
strengthen the weak by weakening the strong. You cannot help the wage
earner by pulling down the wage payer. You cannot further the
brotherhood of man by encouraging class hatred. You cannot help the
poor by destroying the rich. You cannot build character and courage by
taking away a man's initiative and independence. You cannot help men
permanently by doing for them what they could and should do for
themselves."
- Abraham Lincoln
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
next prev parent reply other threads:[~2008-12-18 22:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20081212100615.GD19128@hawkmoon.kerlabs.com>
[not found] ` <1229095751-23984-1-git-send-email-louis.rilling@kerlabs.com>
2008-12-17 21:40 ` [Cluster-devel] Re: [PATCH] configfs: Silence lockdep on mkdir(), rmdir() and configfs_depend_item() Andrew Morton
2008-12-17 22:03 ` Joel Becker
2008-12-17 22:09 ` Andrew Morton
[not found] ` <1229585208.9487.112.camel@twins>
2008-12-18 9:27 ` Joel Becker
2008-12-18 11:26 ` Steven Whitehouse
[not found] ` <1229601399.9487.218.camel@twins>
[not found] ` <1229603308.9487.227.camel@twins>
2008-12-18 22:58 ` Joel Becker [this message]
[not found] ` <1232973009.4863.76.camel@laptop>
[not found] ` <20090126132453.GD7532@hawkmoon.kerlabs.com>
[not found] ` <1232977283.4863.79.camel@laptop>
[not found] ` <20090126140032.GE7532@hawkmoon.kerlabs.com>
[not found] ` <1232979562.4863.101.camel@laptop>
[not found] ` <20090126145536.GG7532@hawkmoon.kerlabs.com>
2009-01-28 3:05 ` Joel Becker
2009-01-28 3:41 ` Joel Becker
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=20081218225837.GB21870@mail.oracle.com \
--to=joel.becker@oracle.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;
as well as URLs for NNTP newsgroup(s).