From: Li Zefan <lizf@cn.fujitsu.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Paul Menage <menage@google.com>,
Arjan van de Ven <arjan@infradead.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [cgroup or VFS ?] INFO: possible recursive locking detected
Date: Tue, 10 Feb 2009 17:25:41 +0800 [thread overview]
Message-ID: <49914815.4020209@cn.fujitsu.com> (raw)
In-Reply-To: <20090210060737.GZ28946@ZenIV.linux.org.uk>
Al Viro wrote:
> On Tue, Feb 10, 2009 at 01:19:17PM +0800, Li Zefan wrote:
>>> You have no promise whatsoever that whoever's been trying to
>>> get the lock in question will even get out of the locking primitive
>>> before the memory that contains the lock gets freed. In case of superblocks
>>> in general, you don't free them until ->s_count hits zero. At that point
>>> anything as much as remembering the address of that superblock is already
>>> FUBAR.
>>>
>> This is not the general case. This sb won't be seen by anyone, and destroy_super()
>> is called on a sb with ->s_count == 1 and ->s_umount held.
>
> ... so in this case we have even a stronger warranty of everything being
> OK with freeing it while locked. "Nothing has ever seen its address"
> means that entire struct contents is fair game...
>
Yes, this won't cause bad things, but I think it's better to make lock/unlock
consistent, and we have to make lockdep happy.
> As for the other question, you are leaving a reference to root hanging from
> superblock still on the list (grab_super() will fail on it, but that's it)
> and you have code that might look into the damn thing (test callback you
> pass to sget()). Dereferencing pointers to freed objects is not nice, to
> put it mildly...
>
It's clear to me now, thanks for the explanation. Though I failed to trigger
this bug, I managed to trigger it if I set sb->s_fs_info to NULL just after
kfree(root).
> BTW, which dentries are going to stick around until that point?
>
Not sure if I got what you mean. cgroup_kill_sb() will be called only if there
are no sub-dirs.
next prev parent reply other threads:[~2009-02-10 9:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-05 3:23 [cgroup or VFS ?] INFO: possible recursive locking detected Li Zefan
2009-01-08 3:45 ` Li Zefan
2009-02-09 11:23 ` Al Viro
2009-02-09 11:38 ` Li Zefan
2009-02-09 11:48 ` Peter Zijlstra
2009-02-10 3:06 ` Li Zefan
2009-02-10 4:37 ` Al Viro
2009-02-10 5:19 ` Li Zefan
2009-02-10 6:07 ` Al Viro
2009-02-10 9:25 ` Li Zefan [this message]
2009-02-12 6:14 ` Li Zefan
2009-02-10 8:32 ` Peter Zijlstra
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=49914815.4020209@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=peterz@infradead.org \
--cc=viro@ZenIV.linux.org.uk \
/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