linux-stable/fs/btrfs
Sage Weil ac14aed665 Btrfs: do not take cleanup_work_sem in btrfs_run_delayed_iputs()
Josef has suggested that this is not necessary.  Removing it also avoids
this lockdep splat (after the new sb_internal locking stuff was added):

[  604.090449] ======================================================
[  604.114819] [ INFO: possible circular locking dependency detected ]
[  604.139262] 3.6.0-rc2-ceph-00144-g463b030 #1 Not tainted
[  604.162193] -------------------------------------------------------
[  604.186139] btrfs-cleaner/6669 is trying to acquire lock:
[  604.209555]  (sb_internal#2){.+.+..}, at: [<ffffffffa0042b84>] start_transaction+0x124/0x430 [btrfs]
[  604.257100]
[  604.257100] but task is already holding lock:
[  604.300366]  (&fs_info->cleanup_work_sem){.+.+..}, at: [<ffffffffa0048002>] btrfs_run_delayed_iputs+0x72/0x130 [btrfs]
[  604.352989]
[  604.352989] which lock already depends on the new lock.
[  604.352989]
[  604.427104]
[  604.427104] the existing dependency chain (in reverse order) is:
[  604.478493]
[  604.478493] -> #1 (&fs_info->cleanup_work_sem){.+.+..}:
[  604.529313]        [<ffffffff810b2c82>] lock_acquire+0xa2/0x140
[  604.559621]        [<ffffffff81632b69>] down_read+0x39/0x4e
[  604.589382]        [<ffffffffa004db98>] btrfs_lookup_dentry+0x218/0x550 [btrfs]
[  604.596161] btrfs: unlinked 1 orphans
[  604.675002]        [<ffffffffa006aadd>] create_subvol+0x62d/0x690 [btrfs]
[  604.708859]        [<ffffffffa006d666>] btrfs_mksubvol.isra.52+0x346/0x3a0 [btrfs]
[  604.772466]        [<ffffffffa006d7f2>] btrfs_ioctl_snap_create_transid+0x132/0x190 [btrfs]
[  604.842245]        [<ffffffffa006d8ae>] btrfs_ioctl_snap_create+0x5e/0x80 [btrfs]
[  604.912852]        [<ffffffffa00708ae>] btrfs_ioctl+0x138e/0x1990 [btrfs]
[  604.951888]        [<ffffffff8118e9b8>] do_vfs_ioctl+0x98/0x560
[  604.989961]        [<ffffffff8118ef11>] sys_ioctl+0x91/0xa0
[  605.026628]        [<ffffffff8163d569>] system_call_fastpath+0x16/0x1b
[  605.064404]
[  605.064404] -> #0 (sb_internal#2){.+.+..}:
[  605.126832]        [<ffffffff810b25e8>] __lock_acquire+0x1ac8/0x1b90
[  605.163671]        [<ffffffff810b2c82>] lock_acquire+0xa2/0x140
[  605.200228]        [<ffffffff8117dac6>] __sb_start_write+0xc6/0x1b0
[  605.236818]        [<ffffffffa0042b84>] start_transaction+0x124/0x430 [btrfs]
[  605.274029]        [<ffffffffa00431a3>] btrfs_start_transaction+0x13/0x20 [btrfs]
[  605.340520]        [<ffffffffa004ccfa>] btrfs_evict_inode+0x19a/0x330 [btrfs]
[  605.378720]        [<ffffffff811972c8>] evict+0xb8/0x1c0
[  605.416057]        [<ffffffff811974d5>] iput+0x105/0x210
[  605.452373]        [<ffffffffa0048082>] btrfs_run_delayed_iputs+0xf2/0x130 [btrfs]
[  605.521627]        [<ffffffffa003b5e1>] cleaner_kthread+0xa1/0x120 [btrfs]
[  605.560520]        [<ffffffff810791ee>] kthread+0xae/0xc0
[  605.598094]        [<ffffffff8163e744>] kernel_thread_helper+0x4/0x10
[  605.636499]
[  605.636499] other info that might help us debug this:
[  605.636499]
[  605.736504]  Possible unsafe locking scenario:
[  605.736504]
[  605.801931]        CPU0                    CPU1
[  605.835126]        ----                    ----
[  605.867093]   lock(&fs_info->cleanup_work_sem);
[  605.898594]                                lock(sb_internal#2);
[  605.931954]                                lock(&fs_info->cleanup_work_sem);
[  605.965359]   lock(sb_internal#2);
[  605.994758]
[  605.994758]  *** DEADLOCK ***
[  605.994758]
[  606.075281] 2 locks held by btrfs-cleaner/6669:
[  606.104528]  #0:  (&fs_info->cleaner_mutex){+.+...}, at: [<ffffffffa003b5d5>] cleaner_kthread+0x95/0x120 [btrfs]
[  606.165626]  #1:  (&fs_info->cleanup_work_sem){.+.+..}, at: [<ffffffffa0048002>] btrfs_run_delayed_iputs+0x72/0x130 [btrfs]
[  606.231297]
[  606.231297] stack backtrace:
[  606.287723] Pid: 6669, comm: btrfs-cleaner Not tainted 3.6.0-rc2-ceph-00144-g463b030 #1
[  606.347823] Call Trace:
[  606.376184]  [<ffffffff8162a77c>] print_circular_bug+0x1fb/0x20c
[  606.409243]  [<ffffffff810b25e8>] __lock_acquire+0x1ac8/0x1b90
[  606.441343]  [<ffffffffa0042b84>] ? start_transaction+0x124/0x430 [btrfs]
[  606.474583]  [<ffffffff810b2c82>] lock_acquire+0xa2/0x140
[  606.505934]  [<ffffffffa0042b84>] ? start_transaction+0x124/0x430 [btrfs]
[  606.539429]  [<ffffffff8132babd>] ? do_raw_spin_unlock+0x5d/0xb0
[  606.571719]  [<ffffffff8117dac6>] __sb_start_write+0xc6/0x1b0
[  606.603498]  [<ffffffffa0042b84>] ? start_transaction+0x124/0x430 [btrfs]
[  606.637405]  [<ffffffffa0042b84>] ? start_transaction+0x124/0x430 [btrfs]
[  606.670165]  [<ffffffff81172e75>] ? kmem_cache_alloc+0xb5/0x160
[  606.702144]  [<ffffffffa0042b84>] start_transaction+0x124/0x430 [btrfs]
[  606.735562]  [<ffffffffa00256a6>] ? block_rsv_add_bytes+0x56/0x80 [btrfs]
[  606.769861]  [<ffffffffa00431a3>] btrfs_start_transaction+0x13/0x20 [btrfs]
[  606.804575]  [<ffffffffa004ccfa>] btrfs_evict_inode+0x19a/0x330 [btrfs]
[  606.838756]  [<ffffffff81634c6b>] ? _raw_spin_unlock+0x2b/0x40
[  606.872010]  [<ffffffff811972c8>] evict+0xb8/0x1c0
[  606.903800]  [<ffffffff811974d5>] iput+0x105/0x210
[  606.935416]  [<ffffffffa0048082>] btrfs_run_delayed_iputs+0xf2/0x130 [btrfs]
[  606.970510]  [<ffffffffa003b5d5>] ? cleaner_kthread+0x95/0x120 [btrfs]
[  607.005648]  [<ffffffffa003b5e1>] cleaner_kthread+0xa1/0x120 [btrfs]
[  607.040724]  [<ffffffffa003b540>] ? btrfs_destroy_delayed_refs.isra.102+0x220/0x220 [btrfs]
[  607.104740]  [<ffffffff810791ee>] kthread+0xae/0xc0
[  607.137119]  [<ffffffff810b379d>] ? trace_hardirqs_on+0xd/0x10
[  607.169797]  [<ffffffff8163e744>] kernel_thread_helper+0x4/0x10
[  607.202472]  [<ffffffff81635430>] ? retint_restore_args+0x13/0x13
[  607.235884]  [<ffffffff81079140>] ? flush_kthread_work+0x1a0/0x1a0
[  607.268731]  [<ffffffff8163e740>] ? gs_change+0x13/0x13

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-01 15:19:08 -04:00
..
acl.c Btrfs: cache no acl on new inodes 2012-05-30 10:23:27 -04:00
async-thread.c Btrfs: call the ordered free operation without any locks held 2012-07-25 16:15:07 -04:00
async-thread.h btrfs: return void in functions without error conditions 2012-03-22 01:45:34 +01:00
backref.c Btrfs: fix gcc warnings for 32bit compiles 2012-10-01 15:19:01 -04:00
backref.h Merge branch 'send-v2' of git://github.com/ablock84/linux-btrfs into for-linus 2012-07-25 19:19:10 -04:00
btrfs_inode.h Btrfs: fix a bug in checking whether a inode is already in log 2012-10-01 15:19:06 -04:00
check-integrity.c Btrfs: introduce subvol uuids and times 2012-07-25 23:28:38 +02:00
check-integrity.h Btrfs: add optional integrity check code 2011-12-21 19:14:09 +01:00
compat.h
compression.c Btrfs: barrier before waitqueue_active 2012-08-28 16:53:33 -04:00
compression.h btrfs: return void in functions without error conditions 2012-03-22 01:45:34 +01:00
ctree.c Btrfs: fix btrfs send for inline items and compression 2012-10-01 15:19:00 -04:00
ctree.h Btrfs: add hole punching 2012-10-01 15:19:07 -04:00
delayed-inode.c Btrfs: barrier before waitqueue_active 2012-08-28 16:53:33 -04:00
delayed-inode.h Btrfs: flush delayed inodes if we're short on space 2012-07-23 15:41:40 -04:00
delayed-ref.c Btrfs: allow delayed refs to be merged 2012-08-28 16:53:38 -04:00
delayed-ref.h Btrfs: allow delayed refs to be merged 2012-08-28 16:53:38 -04:00
dir-item.c btrfs: replace many BUG_ONs with proper error handling 2012-03-22 11:52:54 +01:00
disk-io.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2012-08-29 11:36:22 -07:00
disk-io.h Btrfs: remove superblock writing after fatal error 2012-08-28 16:53:38 -04:00
export.c ->encode_fh() API change 2012-05-29 23:28:33 -04:00
export.h
extent-tree.c Btrfs: add hole punching 2012-10-01 15:19:07 -04:00
extent_io.c Btrfs: fix btrfs send for inline items and compression 2012-10-01 15:19:00 -04:00
extent_io.h Merge branch 'for-chris' of git://git.jan-o-sch.net/btrfs-unstable into for-linus 2012-05-31 16:49:53 -04:00
extent_map.c Btrfs: improve fsync by filtering extents that we want 2012-10-01 15:19:05 -04:00
extent_map.h Btrfs: improve fsync by filtering extents that we want 2012-10-01 15:19:05 -04:00
file-item.c Btrfs: fix gcc warnings for 32bit compiles 2012-10-01 15:19:01 -04:00
file.c Btrfs: add hole punching 2012-10-01 15:19:07 -04:00
free-space-cache.c Btrfs: do not count in readonly bytes 2012-07-23 16:28:03 -04:00
free-space-cache.h btrfs: remove all unused functions 2011-05-06 12:34:03 +02:00
hash.h
inode-item.c Merge branch 'error-handling' into for-linus 2012-03-28 20:31:37 -04:00
inode-map.c Btrfs: show useful info in space reservation tracepoint 2012-03-29 09:57:44 -04:00
inode-map.h Btrfs: Support reading/writing on disk free ino cache 2011-04-25 16:46:11 +08:00
inode.c Btrfs: do not take cleanup_work_sem in btrfs_run_delayed_iputs() 2012-10-01 15:19:08 -04:00
ioctl.c Btrfs: remove unused hint byte argument for btrfs_drop_extents 2012-10-01 15:19:06 -04:00
ioctl.h Merge branch 'send-v2' of git://github.com/ablock84/linux-btrfs into for-linus 2012-07-25 19:19:10 -04:00
Kconfig Btrfs: add config option to enable btrfs integrity check 2011-12-21 19:14:16 +01:00
locking.c Btrfs: fix a misplaced address operator in a condition 2012-08-28 16:53:23 -04:00
locking.h btrfs: return void in functions without error conditions 2012-03-22 01:45:34 +01:00
lzo.c btrfs: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:21 +08:00
Makefile Merge branch 'send-v2' of git://github.com/ablock84/linux-btrfs into for-linus 2012-07-25 19:19:10 -04:00
ordered-data.c btrfs: nuke pdflush from comments 2012-08-04 12:15:35 +04:00
ordered-data.h Btrfs: finish ordered extents in their own thread 2012-05-30 10:23:33 -04:00
orphan.c btrfs: replace many BUG_ONs with proper error handling 2012-03-22 11:52:54 +01:00
print-tree.c Btrfs: read device stats on mount, write modified ones during commit 2012-05-30 10:23:41 -04:00
print-tree.h
qgroup.c Btrfs: fix gcc warnings for 32bit compiles 2012-10-01 15:19:01 -04:00
rcu-string.h Btrfs: use rcu to protect device->name 2012-06-14 21:29:16 -04:00
reada.c Btrfs: set ioprio of scrub readahead to idle 2012-05-30 10:23:43 -04:00
relocation.c btrfs: use printk_get_level and printk_skip_level, add __printf, fix fallout 2012-07-30 17:25:14 -07:00
root-tree.c Btrfs: fix some endian bugs handling the root times 2012-08-28 16:53:26 -04:00
scrub.c Btrfs: use rcu to protect device->name 2012-06-14 21:29:16 -04:00
send.c Btrfs: fix gcc warnings for 32bit compiles 2012-10-01 15:19:01 -04:00
send.h Btrfs: introduce BTRFS_IOC_SEND for btrfs send/receive 2012-07-25 23:30:19 +02:00
struct-funcs.c Btrfs: rewrite BTRFS_SETGET_FUNCS 2012-07-23 16:28:06 -04:00
super.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2012-08-29 11:36:22 -07:00
sysfs.c btrfs: Remove unused sysfs code 2011-06-17 14:54:18 -04:00
transaction.c Btrfs: set journal_info in async trans commit worker 2012-10-01 15:19:08 -04:00
transaction.h Btrfs: fix a bug in checking whether a inode is already in log 2012-10-01 15:19:06 -04:00
tree-defrag.c btrfs: drop unused parameter from btrfs_release_path 2011-05-02 13:57:22 +02:00
tree-log.c Btrfs: add hole punching 2012-10-01 15:19:07 -04:00
tree-log.h btrfs: return void in functions without error conditions 2012-03-22 01:45:34 +01:00
ulist.c Btrfs: make aux field of ulist 64 bit 2012-10-01 15:18:53 -04:00
ulist.h Btrfs: make aux field of ulist 64 bit 2012-10-01 15:18:53 -04:00
version.h
volumes.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2012-08-29 11:36:22 -07:00
volumes.h Btrfs: revert checksum error statistic which can cause a BUG() 2012-08-28 16:53:39 -04:00
xattr.c Btrfs: use i_version instead of our own sequence 2012-05-30 10:23:27 -04:00
xattr.h fs/vfs/security: pass last path component to LSM on inode creation 2011-02-01 11:12:29 -05:00
zlib.c btrfs: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:21 +08:00