linux/fs/nilfs2
Ryusuke Konishi c1ea985c71 nilfs2: fix lock order reversal in chcp operation
Will fix the following lock order reversal lockdep detected:

=======================================================
[ INFO: possible circular locking dependency detected ]
2.6.32-rc6 #7
-------------------------------------------------------
chcp/30157 is trying to acquire lock:
 (&nilfs->ns_mount_mutex){+.+.+.}, at: [<fed7cfcc>] nilfs_cpfile_change_cpmode+0x46/0x752 [nilfs2]

but task is already holding lock:
 (&nilfs->ns_segctor_sem){++++.+}, at: [<fed7ca32>] nilfs_transaction_begin+0xba/0x110 [nilfs2]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #2 (&nilfs->ns_segctor_sem){++++.+}:
       [<c105799c>] __lock_acquire+0x109c/0x139d
       [<c1057d26>] lock_acquire+0x89/0xa0
       [<c14151e2>] down_read+0x31/0x45
       [<fed6d77b>] nilfs_attach_checkpoint+0x8f/0x16b [nilfs2]
       [<fed6e393>] nilfs_get_sb+0x3e7/0x653 [nilfs2]
       [<c10c0ccb>] vfs_kern_mount+0x8b/0x124
       [<c10c0db2>] do_kern_mount+0x37/0xc3
       [<c10d7517>] do_mount+0x64d/0x69d
       [<c10d75cd>] sys_mount+0x66/0x95
       [<c1002a14>] sysenter_do_call+0x12/0x32

-> #1 (&type->s_umount_key#31/1){+.+.+.}:
       [<c105799c>] __lock_acquire+0x109c/0x139d
       [<c1057d26>] lock_acquire+0x89/0xa0
       [<c104c0f3>] down_write_nested+0x34/0x52
       [<c10c08fe>] sget+0x22e/0x389
       [<fed6e133>] nilfs_get_sb+0x187/0x653 [nilfs2]
       [<c10c0ccb>] vfs_kern_mount+0x8b/0x124
       [<c10c0db2>] do_kern_mount+0x37/0xc3
       [<c10d7517>] do_mount+0x64d/0x69d
       [<c10d75cd>] sys_mount+0x66/0x95
       [<c1002a14>] sysenter_do_call+0x12/0x32

-> #0 (&nilfs->ns_mount_mutex){+.+.+.}:
       [<c1057727>] __lock_acquire+0xe27/0x139d
       [<c1057d26>] lock_acquire+0x89/0xa0
       [<c1414d63>] mutex_lock_nested+0x41/0x23e
       [<fed7cfcc>] nilfs_cpfile_change_cpmode+0x46/0x752 [nilfs2]
       [<fed801b2>] nilfs_ioctl+0x11a/0x7da [nilfs2]
       [<c10cca12>] vfs_ioctl+0x27/0x6e
       [<c10ccf93>] do_vfs_ioctl+0x491/0x4db
       [<c10cd022>] sys_ioctl+0x45/0x5f
       [<c1002a14>] sysenter_do_call+0x12/0x32

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2009-11-13 10:33:24 +09:00
..
alloc.c nilfs2: persistent object allocator 2009-04-07 08:31:13 -07:00
alloc.h nilfs2: persistent object allocator 2009-04-07 08:31:13 -07:00
bmap_union.h nilfs2: integrated block mapping 2009-04-07 08:31:13 -07:00
bmap.c nilfs2: convert nilfs_bmap_lookup to an inline function 2009-09-14 18:27:16 +09:00
bmap.h nilfs2: convert nilfs_bmap_lookup to an inline function 2009-09-14 18:27:16 +09:00
btnode.c nilfs2: add zero-fill for new btree node buffers 2009-11-03 12:32:03 +09:00
btnode.h nilfs2: use device's backing_dev_info for btree node caches 2009-06-10 23:41:12 +09:00
btree.c nilfs2: allow btree code to directly call dat operations 2009-09-14 18:27:16 +09:00
btree.h nilfs2: remove nilfs_btree_operations from btree mapping 2009-06-10 23:41:11 +09:00
cpfile.c nilfs2: fix lock order reversal in chcp operation 2009-11-13 10:33:24 +09:00
cpfile.h nilfs2: remove individual gfp constants for each metadata file 2009-09-14 18:27:15 +09:00
dat.c nilfs2: add update functions of virtual block address to dat 2009-09-14 18:27:15 +09:00
dat.h nilfs2: add update functions of virtual block address to dat 2009-09-14 18:27:15 +09:00
dir.c const: constify remaining file_operations 2009-10-01 16:11:11 -07:00
direct.c nilfs2: allow btree code to directly call dat operations 2009-09-14 18:27:16 +09:00
direct.h nilfs2: remove nilfs_direct_operations from direct mapping 2009-06-10 23:41:11 +09:00
file.c const: constify remaining file_operations 2009-10-01 16:11:11 -07:00
gcdat.c nilfs2: another dat for garbage collection 2009-04-07 08:31:16 -07:00
gcinode.c const: mark remaining address_space_operations const 2009-09-22 07:17:24 -07:00
ifile.c nilfs2: inode map file 2009-04-07 08:31:14 -07:00
ifile.h nilfs2: remove individual gfp constants for each metadata file 2009-09-14 18:27:15 +09:00
inode.c nilfs2: fix missing initialization of i_dir_start_lookup member 2009-09-29 20:32:13 +09:00
ioctl.c nilfs2: fix lock order reversal in chcp operation 2009-11-13 10:33:24 +09:00
Kconfig fs/Kconfig: move nilfs2 outside misc filesystems 2009-09-14 18:27:16 +09:00
Makefile nilfs2: update makefile and Kconfig 2009-04-07 08:31:16 -07:00
mdt.c const: constify remaining file_operations 2009-10-01 16:11:11 -07:00
mdt.h nilfs2: remove individual gfp constants for each metadata file 2009-09-14 18:27:15 +09:00
namei.c const: mark remaining inode_operations as const 2009-09-22 07:17:24 -07:00
nilfs.h const: constify remaining file_operations 2009-10-01 16:11:11 -07:00
page.c nilfs2: ensure to clear dirty state when deleting metadata file block 2009-05-10 17:04:42 +09:00
page.h nilfs2: buffer and page operations 2009-04-07 08:31:13 -07:00
recovery.c nilfs2: fix format string compile warning (ino_t) 2009-09-14 18:27:13 +09:00
sb.h nilfs2: simplify remaining sget() use 2009-06-11 21:36:18 -04:00
segbuf.c nilfs2: use GFP_NOIO for bio_alloc instead of GFP_NOWAIT 2009-09-14 18:27:14 +09:00
segbuf.h nilfs2: simplify handling of active state of segments 2009-04-07 08:31:20 -07:00
segment.c nilfs2: fix irregular checkpoint creation due to data flush 2009-11-03 12:32:03 +09:00
segment.h nilfs2: remove header file for segment list operations 2009-06-10 23:41:09 +09:00
sufile.c nilfs2: allow future expansion of metadata read out via get info ioctl 2009-06-10 23:41:11 +09:00
sufile.h nilfs2: remove individual gfp constants for each metadata file 2009-09-14 18:27:15 +09:00
super.c const: mark remaining export_operations const 2009-09-22 07:17:24 -07:00
the_nilfs.c fs: remove bdev->bd_inode_backing_dev_info 2009-09-16 15:16:18 +02:00
the_nilfs.h nilfs2: shorten freeze period due to GC in write operation v3 2009-09-14 18:27:15 +09:00