remarkable-linux/fs/ocfs2
Tao Ma 5e64b0d9e8 ocfs2/lockdep: Move ip_xattr_sem out of ocfs2_xattr_get_nolock.
As the name shows, we shouldn't have any lock in
ocfs2_xattr_get_nolock. so lift ip_xattr_sem to the caller.
This should be safe for us since the only 2 callers are:
1. ocfs2_xattr_get which will lock the resources.
2. ocfs2_mknod which don't need this locking.

And this also resolves the following lockdep warning.

=======================================================
[ INFO: possible circular locking dependency detected ]
2.6.35+ #5
-------------------------------------------------------
reflink/30027 is trying to acquire lock:
 (&oi->ip_alloc_sem){+.+.+.}, at: [<ffffffffa0673b67>] ocfs2_reflink_ioctl+0x69a/0x1226 [ocfs2]

but task is already holding lock:
 (&oi->ip_xattr_sem){++++..}, at: [<ffffffffa0673b58>] ocfs2_reflink_ioctl+0x68b/0x1226 [ocfs2]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #3 (&oi->ip_xattr_sem){++++..}:
       [<ffffffff82064d6d>] __lock_acquire+0x79a/0x7f1
       [<ffffffff82065a81>] lock_acquire+0xc6/0xed
       [<ffffffff82339650>] down_read+0x34/0x47
       [<ffffffffa0691cb8>] ocfs2_xattr_get_nolock+0xa0/0x4e6 [ocfs2]
       [<ffffffffa069d64f>] ocfs2_get_acl_nolock+0x5c/0x132 [ocfs2]
       [<ffffffffa069d9c7>] ocfs2_init_acl+0x60/0x243 [ocfs2]
       [<ffffffffa066499d>] ocfs2_mknod+0xae8/0xfea [ocfs2]
       [<ffffffffa0665041>] ocfs2_create+0x9d/0x105 [ocfs2]
       [<ffffffff820e1c83>] vfs_create+0x9b/0xf4
       [<ffffffff820e20bb>] do_last+0x2fd/0x5be
       [<ffffffff820e31c0>] do_filp_open+0x1fb/0x572
       [<ffffffff820d6cf6>] do_sys_open+0x5a/0xe7
       [<ffffffff820d6dac>] sys_open+0x1b/0x1d
       [<ffffffff8200296b>] system_call_fastpath+0x16/0x1b

-> #2 (jbd2_handle){+.+...}:
       [<ffffffff82064d6d>] __lock_acquire+0x79a/0x7f1
       [<ffffffff82065a81>] lock_acquire+0xc6/0xed
       [<ffffffffa0604ff8>] start_this_handle+0x4a3/0x4bc [jbd2]
       [<ffffffffa06051d6>] jbd2__journal_start+0xba/0xee [jbd2]
       [<ffffffffa0605218>] jbd2_journal_start+0xe/0x10 [jbd2]
       [<ffffffffa065ca34>] ocfs2_start_trans+0xb7/0x19b [ocfs2]
       [<ffffffffa06645f3>] ocfs2_mknod+0x73e/0xfea [ocfs2]
       [<ffffffffa0665041>] ocfs2_create+0x9d/0x105 [ocfs2]
       [<ffffffff820e1c83>] vfs_create+0x9b/0xf4
       [<ffffffff820e20bb>] do_last+0x2fd/0x5be
       [<ffffffff820e31c0>] do_filp_open+0x1fb/0x572
       [<ffffffff820d6cf6>] do_sys_open+0x5a/0xe7
       [<ffffffff820d6dac>] sys_open+0x1b/0x1d
       [<ffffffff8200296b>] system_call_fastpath+0x16/0x1b

-> #1 (&journal->j_trans_barrier){.+.+..}:
       [<ffffffff82064d6d>] __lock_acquire+0x79a/0x7f1
       [<ffffffff82064fa9>] lock_release_non_nested+0x1e5/0x24b
       [<ffffffff82065999>] lock_release+0x158/0x17a
       [<ffffffff823389f6>] __mutex_unlock_slowpath+0xbf/0x11b
       [<ffffffff82338a5b>] mutex_unlock+0x9/0xb
       [<ffffffffa0679673>] ocfs2_free_ac_resource+0x31/0x67 [ocfs2]
       [<ffffffffa067c6bc>] ocfs2_free_alloc_context+0x11/0x1d [ocfs2]
       [<ffffffffa0633de0>] ocfs2_write_begin_nolock+0x141e/0x159b [ocfs2]
       [<ffffffffa0635523>] ocfs2_write_begin+0x11e/0x1e7 [ocfs2]
       [<ffffffff820a1297>] generic_file_buffered_write+0x10c/0x210
       [<ffffffffa0653624>] ocfs2_file_aio_write+0x4cc/0x6d3 [ocfs2]
       [<ffffffff820d822d>] do_sync_write+0xc2/0x106
       [<ffffffff820d897b>] vfs_write+0xae/0x131
       [<ffffffff820d8e55>] sys_write+0x47/0x6f
       [<ffffffff8200296b>] system_call_fastpath+0x16/0x1b

-> #0 (&oi->ip_alloc_sem){+.+.+.}:
       [<ffffffff82063f92>] validate_chain+0x727/0xd68
       [<ffffffff82064d6d>] __lock_acquire+0x79a/0x7f1
       [<ffffffff82065a81>] lock_acquire+0xc6/0xed
       [<ffffffff82339694>] down_write+0x31/0x52
       [<ffffffffa0673b67>] ocfs2_reflink_ioctl+0x69a/0x1226 [ocfs2]
       [<ffffffffa06599f6>] ocfs2_ioctl+0x61a/0x656 [ocfs2]
       [<ffffffff820e53ac>] vfs_ioctl+0x2a/0x9d
       [<ffffffff820e5903>] do_vfs_ioctl+0x45d/0x4ae
       [<ffffffff820e59ab>] sys_ioctl+0x57/0x7a
       [<ffffffff8200296b>] system_call_fastpath+0x16/0x1b

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
2010-09-10 09:19:05 -07:00
..
cluster O2net: Disallow o2net accept connection request from itself. 2010-08-07 10:50:33 -07:00
dlm Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2 2010-08-13 10:43:50 -07:00
dlmfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-08-10 11:26:52 -07:00
acl.c Fix the nested PR lock calling issue in ACL 2010-08-07 10:46:46 -07:00
acl.h ocfs2: Always include ACL support 2009-10-28 23:05:57 -07:00
alloc.c ocfs2: Fix deadlock when allocating page 2010-09-08 14:25:57 +08:00
alloc.h Merge branch 'discontig-bg' of git://oss.oracle.com/git/tma/linux-2.6 into ocfs2-merge-window 2010-05-18 16:40:42 -07:00
aops.c sort out blockdev_direct_IO variants 2010-08-09 16:47:29 -04:00
aops.h ocfs2: Add CoW support. 2009-09-22 20:09:36 -07:00
blockcheck.c ocfs2: Fix metaecc error messages 2010-09-08 14:25:53 +08:00
blockcheck.h ocfs2: Add statistics for the checksum and ecc operations. 2009-06-03 19:15:36 -07:00
buffer_head_io.c Merge branch 'skip_delete_inode' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2-mark into ocfs2-fixes 2010-04-30 13:37:29 -07:00
buffer_head_io.h ocfs2: Take the inode out of the metadata read/write paths. 2009-09-04 16:07:48 -07:00
dcache.c ocfs2: invalidate dentry if its dentry_lock isn't initialized. 2009-08-27 18:10:54 -07:00
dcache.h ocfs2: Fix deadlock on umount 2009-07-21 15:47:55 -07:00
dir.c Merge branch 'discontig-bg' of git://oss.oracle.com/git/tma/linux-2.6 into ocfs2-merge-window 2010-05-18 16:40:42 -07:00
dir.h
dlmglue.c fs/ocfs2: Remove unnecessary casts of private_data 2010-07-20 17:20:08 +02:00
dlmglue.h ocfs2: Add new refcount tree lock resource in dlmglue. 2009-09-22 20:09:28 -07:00
export.c ocfs2/trivial: Remove trailing whitespaces 2010-01-25 19:20:51 -08:00
export.h
extent_map.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
extent_map.h ocfs2: Return extent flags for xattr value tree. 2009-09-22 20:09:39 -07:00
file.c Ocfs2: Fix a regression bug from mainline commit(6b933c8e6f). 2010-09-08 14:25:57 +08:00
file.h ocfs2: Zero the tail cluster when extending past i_size. 2010-07-08 13:25:35 -07:00
heartbeat.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
heartbeat.h
inode.c ocfs2: Fix incorrect checksum validation error 2010-09-08 14:25:54 +08:00
inode.h Make ->drop_inode() just return whether inode needs to be dropped 2010-08-09 16:48:35 -04:00
ioctl.c ocfs2: Use compat_ptr in reflink_arguments. 2010-02-02 18:56:37 -08:00
ioctl.h Ocfs2: Move ocfs2 ioctl definitions from ocfs2_fs.h to newly added ocfs2_ioctl.h 2010-03-02 14:10:20 -08:00
journal.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 2010-08-07 13:03:53 -07:00
journal.h ocfs2: Make ocfs2_journal_dirty() void. 2010-05-05 18:17:29 -07:00
Kconfig ocfs2: Always include ACL support 2009-10-28 23:05:57 -07:00
localalloc.c ocfs2: Limit default local alloc size within bitmap range. 2010-06-15 16:50:43 -07:00
localalloc.h ocfs2: increase the default size of local alloc windows 2010-05-05 18:18:07 -07:00
locks.c [PATCH] Skip check for mandatory locks when unlocking 2010-03-17 12:07:16 -07:00
locks.h
Makefile ocfs2: allocation reservations 2010-05-05 18:17:30 -07:00
mmap.c ocfs2: make __ocfs2_page_mkwrite handle file end properly. 2010-09-08 14:25:55 +08:00
mmap.h
namei.c ocfs2: Fix orphan add in ocfs2_create_inode_in_orphan 2010-09-08 14:26:00 +08:00
namei.h ocfs2: Create reflinked file in orphan dir. 2009-09-22 20:09:48 -07:00
ocfs1_fs_compat.h
ocfs2.h ocfs2: Add dir_resv_level mount option 2010-05-05 18:18:07 -07:00
ocfs2_fs.h ocfs2: increase the default size of local alloc windows 2010-05-05 18:18:07 -07:00
ocfs2_ioctl.h Ocfs2: Move ocfs2 ioctl definitions from ocfs2_fs.h to newly added ocfs2_ioctl.h 2010-03-02 14:10:20 -08:00
ocfs2_lockid.h ocfs2: Add new refcount tree lock resource in dlmglue. 2009-09-22 20:09:28 -07:00
ocfs2_lockingver.h ocfs2_dlmfs: Enable the use of user cluster stacks. 2010-02-26 15:41:18 -08:00
quota.h ocfs2: Fix NULL pointer deref when writing local dquot 2010-05-21 19:30:48 +02:00
quota_global.c ocfs2: Zero the tail cluster when extending past i_size. 2010-07-08 13:25:35 -07:00
quota_local.c ocfs2: Zero the tail cluster when extending past i_size. 2010-07-08 13:25:35 -07:00
refcounttree.c ocfs2: Fix deadlock when allocating page 2010-09-08 14:25:57 +08:00
refcounttree.h Ocfs2: Optimize ocfs2 truncate to use ocfs2_remove_btree_range() instead. 2010-05-18 12:25:10 -07:00
reservations.c ocfs2: update gfp/slab.h includes 2010-06-28 10:19:19 +10:00
reservations.h ocfs2: make ocfs2_adjust_resv_from_alloc simple. 2010-05-05 18:18:09 -07:00
resize.c ocfs2: Make ocfs2_journal_dirty() void. 2010-05-05 18:17:29 -07:00
resize.h
slot_map.c ocfs2: Take the inode out of the metadata read/write paths. 2009-09-04 16:07:48 -07:00
slot_map.h
stack_o2cb.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
stack_user.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
stackglue.c ocfs2_dlmfs: Enable the use of user cluster stacks. 2010-02-26 15:41:18 -08:00
stackglue.h ocfs2_dlmfs: Enable the use of user cluster stacks. 2010-02-26 15:41:18 -08:00
suballoc.c ocfs2: allow return of new inode block location before allocation of the inode 2010-09-08 14:25:59 +08:00
suballoc.h ocfs2: allow return of new inode block location before allocation of the inode 2010-09-08 14:25:59 +08:00
super.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-08-10 11:26:52 -07:00
super.h ocfs2: Wrap signal blocking in void functions. 2010-05-10 11:50:10 -07:00
symlink.c ocfs2: Fix refcnt leak on ocfs2_fast_follow_link() error path 2010-01-11 15:38:50 -08:00
symlink.h
sysfile.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sysfile.h
uptodate.c ocfs2/trivial: Remove trailing whitespaces 2010-01-25 19:20:51 -08:00
uptodate.h ocfs2: Pass struct ocfs2_caching_info to the journal functions. 2009-09-04 16:07:50 -07:00
ver.c
ver.h
xattr.c ocfs2/lockdep: Move ip_xattr_sem out of ocfs2_xattr_get_nolock. 2010-09-10 09:19:05 -07:00
xattr.h ocfs: constify xattr_handler 2010-05-21 18:31:20 -04:00