https://github.com/torvalds/linux
Revision 3f14fea6bbd3444dd46a2af3a2e219e792616645 authored by Frederic Weisbecker on 30 December 2009, 06:03:53 UTC, committed by Frederic Weisbecker on 02 January 2010, 00:57:01 UTC
We call xattr_lookup() from reiserfs_xattr_get(). We then hold the reiserfs lock when we grab the i_mutex. But later, we may relax the reiserfs lock, creating dependency inversion between both locks. The lookups and creation jobs ar already protected by the inode mutex, so we can safely relax the reiserfs lock, dropping the unwanted reiserfs lock -> i_mutex dependency, as shown in the following lockdep report: ======================================================= [ INFO: possible circular locking dependency detected ] 2.6.32-atom #173 ------------------------------------------------------- cp/3204 is trying to acquire lock: (&REISERFS_SB(s)->lock){+.+.+.}, at: [<c11432b9>] reiserfs_write_lock_once+0x29/0x50 but task is already holding lock: (&sb->s_type->i_mutex_key#4/3){+.+.+.}, at: [<c1141e18>] open_xa_dir+0xd8/0x1b0 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&sb->s_type->i_mutex_key#4/3){+.+.+.}: [<c105ea7f>] __lock_acquire+0x11ff/0x19e0 [<c105f2c8>] lock_acquire+0x68/0x90 [<c1401a2b>] mutex_lock_nested+0x5b/0x340 [<c1141d83>] open_xa_dir+0x43/0x1b0 [<c1142722>] reiserfs_for_each_xattr+0x62/0x260 [<c114299a>] reiserfs_delete_xattrs+0x1a/0x60 [<c111ea1f>] reiserfs_delete_inode+0x9f/0x150 [<c10c9c32>] generic_delete_inode+0xa2/0x170 [<c10c9d4f>] generic_drop_inode+0x4f/0x70 [<c10c8b07>] iput+0x47/0x50 [<c10c0965>] do_unlinkat+0xd5/0x160 [<c10c0a00>] sys_unlink+0x10/0x20 [<c1002ec4>] sysenter_do_call+0x12/0x32 -> #0 (&REISERFS_SB(s)->lock){+.+.+.}: [<c105f176>] __lock_acquire+0x18f6/0x19e0 [<c105f2c8>] lock_acquire+0x68/0x90 [<c1401a2b>] mutex_lock_nested+0x5b/0x340 [<c11432b9>] reiserfs_write_lock_once+0x29/0x50 [<c1117012>] reiserfs_lookup+0x62/0x140 [<c10bd85f>] __lookup_hash+0xef/0x110 [<c10bf21d>] lookup_one_len+0x8d/0xc0 [<c1141e2a>] open_xa_dir+0xea/0x1b0 [<c1141fe5>] xattr_lookup+0x15/0x160 [<c1142476>] reiserfs_xattr_get+0x56/0x2a0 [<c1144042>] reiserfs_get_acl+0xa2/0x360 [<c114461a>] reiserfs_cache_default_acl+0x3a/0x160 [<c111789c>] reiserfs_mkdir+0x6c/0x2c0 [<c10bea96>] vfs_mkdir+0xd6/0x180 [<c10c0c10>] sys_mkdirat+0xc0/0xd0 [<c10c0c40>] sys_mkdir+0x20/0x30 [<c1002ec4>] sysenter_do_call+0x12/0x32 other info that might help us debug this: 2 locks held by cp/3204: #0: (&sb->s_type->i_mutex_key#4/1){+.+.+.}, at: [<c10bd8d6>] lookup_create+0x26/0xa0 #1: (&sb->s_type->i_mutex_key#4/3){+.+.+.}, at: [<c1141e18>] open_xa_dir+0xd8/0x1b0 stack backtrace: Pid: 3204, comm: cp Not tainted 2.6.32-atom #173 Call Trace: [<c13ff993>] ? printk+0x18/0x1a [<c105d33a>] print_circular_bug+0xca/0xd0 [<c105f176>] __lock_acquire+0x18f6/0x19e0 [<c105d3aa>] ? check_usage+0x6a/0x460 [<c105f2c8>] lock_acquire+0x68/0x90 [<c11432b9>] ? reiserfs_write_lock_once+0x29/0x50 [<c11432b9>] ? reiserfs_write_lock_once+0x29/0x50 [<c1401a2b>] mutex_lock_nested+0x5b/0x340 [<c11432b9>] ? reiserfs_write_lock_once+0x29/0x50 [<c11432b9>] reiserfs_write_lock_once+0x29/0x50 [<c1117012>] reiserfs_lookup+0x62/0x140 [<c105ccca>] ? debug_check_no_locks_freed+0x8a/0x140 [<c105cbe4>] ? trace_hardirqs_on_caller+0x124/0x170 [<c10bd85f>] __lookup_hash+0xef/0x110 [<c10bf21d>] lookup_one_len+0x8d/0xc0 [<c1141e2a>] open_xa_dir+0xea/0x1b0 [<c1141fe5>] xattr_lookup+0x15/0x160 [<c1142476>] reiserfs_xattr_get+0x56/0x2a0 [<c1144042>] reiserfs_get_acl+0xa2/0x360 [<c10ca2e7>] ? new_inode+0x27/0xa0 [<c114461a>] reiserfs_cache_default_acl+0x3a/0x160 [<c1402eb7>] ? _spin_unlock+0x27/0x40 [<c111789c>] reiserfs_mkdir+0x6c/0x2c0 [<c10c7cb8>] ? __d_lookup+0x108/0x190 [<c105c932>] ? mark_held_locks+0x62/0x80 [<c1401c8d>] ? mutex_lock_nested+0x2bd/0x340 [<c10bd17a>] ? generic_permission+0x1a/0xa0 [<c11788fe>] ? security_inode_permission+0x1e/0x20 [<c10bea96>] vfs_mkdir+0xd6/0x180 [<c10c0c10>] sys_mkdirat+0xc0/0xd0 [<c10505c6>] ? up_read+0x16/0x30 [<c1002fd8>] ? restore_all_notrace+0x0/0x18 [<c10c0c40>] sys_mkdir+0x20/0x30 [<c1002ec4>] sysenter_do_call+0x12/0x32 Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Tested-by: Christian Kujau <lists@nerdbynature.de> Cc: Alexander Beregalov <a.beregalov@gmail.com> Cc: Chris Mason <chris.mason@oracle.com> Cc: Ingo Molnar <mingo@elte.hu>
1 parent 0523676
Tip revision: 3f14fea6bbd3444dd46a2af3a2e219e792616645 authored by Frederic Weisbecker on 30 December 2009, 06:03:53 UTC
reiserfs: Relax lock before open xattr dir in reiserfs_xattr_set_handle()
reiserfs: Relax lock before open xattr dir in reiserfs_xattr_set_handle()
Tip revision: 3f14fea
File | Mode | Size |
---|---|---|
basic | ||
dtc | ||
genksyms | ||
kconfig | ||
ksymoops | ||
mod | ||
package | ||
rt-tester | ||
selinux | ||
tracing | ||
.gitignore | -rw-r--r-- | 85 bytes |
Kbuild.include | -rw-r--r-- | 9.3 KB |
Lindent | -rwxr-xr-x | 460 bytes |
Makefile | -rw-r--r-- | 934 bytes |
Makefile.build | -rw-r--r-- | 11.9 KB |
Makefile.clean | -rw-r--r-- | 3.2 KB |
Makefile.fwinst | -rw-r--r-- | 2.0 KB |
Makefile.headersinst | -rw-r--r-- | 3.3 KB |
Makefile.host | -rw-r--r-- | 6.5 KB |
Makefile.lib | -rw-r--r-- | 8.7 KB |
Makefile.modinst | -rw-r--r-- | 1.0 KB |
Makefile.modpost | -rw-r--r-- | 5.0 KB |
bin2c.c | -rw-r--r-- | 702 bytes |
binoffset.c | -rw-r--r-- | 3.9 KB |
bloat-o-meter | -rwxr-xr-x | 1.7 KB |
bootgraph.pl | -rw-r--r-- | 5.6 KB |
checkincludes.pl | -rwxr-xr-x | 1.7 KB |
checkkconfigsymbols.sh | -rwxr-xr-x | 1.8 KB |
checkpatch.pl | -rwxr-xr-x | 72.0 KB |
checkstack.pl | -rwxr-xr-x | 5.2 KB |
checksyscalls.sh | -rwxr-xr-x | 5.5 KB |
checkversion.pl | -rwxr-xr-x | 1.8 KB |
cleanfile | -rwxr-xr-x | 3.4 KB |
cleanpatch | -rwxr-xr-x | 5.0 KB |
config | -rwxr-xr-x | 2.6 KB |
conmakehash.c | -rw-r--r-- | 6.0 KB |
decodecode | -rwxr-xr-x | 1.7 KB |
diffconfig | -rwxr-xr-x | 3.6 KB |
export_report.pl | -rw-r--r-- | 4.2 KB |
extract-ikconfig | -rwxr-xr-x | 1.9 KB |
gcc-version.sh | -rw-r--r-- | 819 bytes |
gcc-x86_32-has-stack-protector.sh | -rw-r--r-- | 183 bytes |
gcc-x86_64-has-stack-protector.sh | -rw-r--r-- | 199 bytes |
gen_initramfs_list.sh | -rw-r--r-- | 7.0 KB |
get_maintainer.pl | -rwxr-xr-x | 22.5 KB |
gfp-translate | -rw-r--r-- | 1.5 KB |
headerdep.pl | -rwxr-xr-x | 3.5 KB |
headers.sh | -rwxr-xr-x | 608 bytes |
headers_check.pl | -rw-r--r-- | 2.7 KB |
headers_install.pl | -rw-r--r-- | 1.5 KB |
kallsyms.c | -rw-r--r-- | 15.1 KB |
kernel-doc | -rwxr-xr-x | 60.8 KB |
makelst | -rwxr-xr-x | 773 bytes |
markup_oops.pl | -rw-r--r-- | 7.5 KB |
mkcompile_h | -rwxr-xr-x | 2.6 KB |
mkmakefile | -rw-r--r-- | 1.1 KB |
mksysmap | -rw-r--r-- | 1.3 KB |
mkuboot.sh | -rwxr-xr-x | 379 bytes |
mkversion | -rw-r--r-- | 74 bytes |
module-common.lds | -rw-r--r-- | 210 bytes |
namespace.pl | -rwxr-xr-x | 13.1 KB |
patch-kernel | -rwxr-xr-x | 9.8 KB |
pnmtologo.c | -rw-r--r-- | 11.7 KB |
profile2linkerlist.pl | -rw-r--r-- | 378 bytes |
recordmcount.pl | -rwxr-xr-x | 14.1 KB |
setlocalversion | -rwxr-xr-x | 2.0 KB |
show_delta | -rwxr-xr-x | 3.0 KB |
tags.sh | -rwxr-xr-x | 4.1 KB |
unifdef.c | -rw-r--r-- | 29.5 KB |
ver_linux | -rwxr-xr-x | 3.1 KB |
Computing file changes ...