All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch for 2.6.29? 3/3] vfs: add missing unlock in sget()
@ 2009-03-04 20:12 akpm
  2009-03-05  1:58 ` Li Zefan
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2009-03-04 20:12 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, akpm, lizf, a.p.zijlstra, menage, viro

From: Li Zefan <lizf@cn.fujitsu.com>

In sget(), destroy_super(s) is called with s->s_umount held, which makes
lockdep unhappy.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/super.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff -puN fs/super.c~vfs-add-missing-unlock-in-sget fs/super.c
--- a/fs/super.c~vfs-add-missing-unlock-in-sget
+++ a/fs/super.c
@@ -357,8 +357,10 @@ retry:
 				continue;
 			if (!grab_super(old))
 				goto retry;
-			if (s)
+			if (s) {
+				up_write(&s->s_umount);
 				destroy_super(s);
+			}
 			return old;
 		}
 	}
@@ -373,6 +375,7 @@ retry:
 	err = set(s, data);
 	if (err) {
 		spin_unlock(&sb_lock);
+		up_write(&s->s_umount);
 		destroy_super(s);
 		return ERR_PTR(err);
 	}
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch for 2.6.29? 3/3] vfs: add missing unlock in sget()
  2009-03-04 20:12 [patch for 2.6.29? 3/3] vfs: add missing unlock in sget() akpm
@ 2009-03-05  1:58 ` Li Zefan
  0 siblings, 0 replies; 2+ messages in thread
From: Li Zefan @ 2009-03-05  1:58 UTC (permalink / raw)
  To: akpm; +Cc: viro, linux-fsdevel, a.p.zijlstra, menage

akpm@linux-foundation.org wrote:
> From: Li Zefan <lizf@cn.fujitsu.com>
> 
> In sget(), destroy_super(s) is called with s->s_umount held, which makes
> lockdep unhappy.
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> Cc: Al Viro <viro@ZenIV.linux.org.uk>
> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Paul Menage <menage@google.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---

I think it's for 2.6.29, otherwise I can hit a warning with mainline
kernel using the test program which is designed to test cgroups:

=========================
[ BUG: held lock freed! ]
-------------------------
mount/13413 is freeing memory e767a800-e767abff, with a lock still held there!
 (&type->s_umount_key#29/1){--..}, at: [<c04a4104>] sget+0x1ea/0x324
2 locks held by mount/13413:
 #0:  (&type->s_umount_key#29/1){--..}, at: [<c04a4104>] sget+0x1ea/0x324
 #1:  (&type->s_umount_key#30){--..}, at: [<c04a3f72>] sget+0x58/0x324

stack backtrace:
Pid: 13413, comm: mount Not tainted 2.6.29-rc4 #548
Call Trace:
 [<c044d865>] debug_check_no_locks_freed+0xc9/0x105
 [<c049c86d>] kfree+0x82/0xd1
 [<c04a41e0>] ? sget+0x2c6/0x324
 [<c04a41e0>] sget+0x2c6/0x324
 [<c045dda9>] ? cgroup_set_super+0x0/0x3e
 [<c045cf6f>] ? cgroup_test_super+0x0/0x2f
 [<c045f840>] cgroup_get_sb+0x8d/0x284
 [<c0489216>] ? kstrdup+0x31/0x53
 [<c04a46aa>] vfs_kern_mount+0x40/0x7b
 [<c04a4733>] do_kern_mount+0x37/0xbf
 [<c04b5dc6>] do_mount+0x5c4/0x61b
 [<c04b477a>] ? copy_mount_options+0x2c/0x111
 [<c04b5e86>] sys_mount+0x69/0xa0
 [<c0403351>] sysenter_do_call+0x12/0x31



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-05  1:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-04 20:12 [patch for 2.6.29? 3/3] vfs: add missing unlock in sget() akpm
2009-03-05  1:58 ` Li Zefan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.