remarkable-linux/fs/btrfs
Filipe David Borba Manana f45388f387 Btrfs: fix deadlock in uuid scan kthread
If there's an ongoing transaction when the uuid scan kthread attempts
to create one, the kthread will block, waiting for that transaction to
finish while it's keeping locks on the tree root, and in turn the existing
transaction is waiting for those locks to be free.

The stack trace reported by the kernel follows.

[36700.671601] INFO: task btrfs-uuid:15480 blocked for more than 120 seconds.
[36700.671602] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[36700.671602] btrfs-uuid      D 0000000000000000     0 15480      2 0x00000000
[36700.671604]  ffff880710bd5b88 0000000000000046 ffff8803d36ba850 0000000000030000
[36700.671605]  ffff8806d76dc530 ffff880710bd5fd8 ffff880710bd5fd8 ffff880710bd5fd8
[36700.671607]  ffff8808098ac530 ffff8806d76dc530 ffff880710bd5b98 ffff8805e4508e40
[36700.671608] Call Trace:
[36700.671610]  [<ffffffff816f36b9>] schedule+0x29/0x70
[36700.671620]  [<ffffffffa05a3bdf>] wait_current_trans.isra.33+0xbf/0x120 [btrfs]
[36700.671623]  [<ffffffff81066760>] ? add_wait_queue+0x60/0x60
[36700.671629]  [<ffffffffa05a5b06>] start_transaction+0x3d6/0x530 [btrfs]
[36700.671636]  [<ffffffffa05bb1f4>] ? btrfs_get_token_32+0x64/0xf0 [btrfs]
[36700.671642]  [<ffffffffa05a5fbb>] btrfs_start_transaction+0x1b/0x20 [btrfs]
[36700.671649]  [<ffffffffa05c8a81>] btrfs_uuid_scan_kthread+0x211/0x3d0 [btrfs]
[36700.671655]  [<ffffffffa05c8870>] ? __btrfs_open_devices+0x2a0/0x2a0 [btrfs]
[36700.671657]  [<ffffffff81065fa0>] kthread+0xc0/0xd0
[36700.671659]  [<ffffffff81065ee0>] ? flush_kthread_worker+0xb0/0xb0
[36700.671661]  [<ffffffff816fcd1c>] ret_from_fork+0x7c/0xb0
[36700.671662]  [<ffffffff81065ee0>] ? flush_kthread_worker+0xb0/0xb0
[36700.671663] INFO: task btrfs:15481 blocked for more than 120 seconds.
[36700.671664] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[36700.671665] btrfs           D 0000000000000000     0 15481  15212 0x00000004
[36700.671666]  ffff880248cbf4c8 0000000000000086 ffff8803d36ba700 ffff8801dbd5c280
[36700.671668]  ffff880807815c40 ffff880248cbffd8 ffff880248cbffd8 ffff880248cbffd8
[36700.671669]  ffff8805e86a0000 ffff880807815c40 ffff880248cbf4d8 ffff8801dbd5c280
[36700.671670] Call Trace:
[36700.671672]  [<ffffffff816f36b9>] schedule+0x29/0x70
[36700.671679]  [<ffffffffa05d9b0d>] btrfs_tree_lock+0x6d/0x230 [btrfs]
[36700.671680]  [<ffffffff81066760>] ? add_wait_queue+0x60/0x60
[36700.671685]  [<ffffffffa0582829>] btrfs_search_slot+0x999/0xb00 [btrfs]
[36700.671691]  [<ffffffffa05bd9de>] ? btrfs_lookup_first_ordered_extent+0x5e/0xb0 [btrfs]
[36700.671698]  [<ffffffffa05e3e54>] __btrfs_write_out_cache+0x8c4/0xa80 [btrfs]
[36700.671704]  [<ffffffffa05e4362>] btrfs_write_out_cache+0xb2/0xf0 [btrfs]
[36700.671710]  [<ffffffffa05c4441>] ? free_extent_buffer+0x61/0xc0 [btrfs]
[36700.671716]  [<ffffffffa0594c82>] btrfs_write_dirty_block_groups+0x562/0x650 [btrfs]
[36700.671723]  [<ffffffffa0610092>] commit_cowonly_roots+0x171/0x24b [btrfs]
[36700.671729]  [<ffffffffa05a4dde>] btrfs_commit_transaction+0x4fe/0xa10 [btrfs]
[36700.671735]  [<ffffffffa0610af3>] create_subvol+0x5c0/0x636 [btrfs]
[36700.671742]  [<ffffffffa05d49ff>] btrfs_mksubvol.isra.60+0x33f/0x3f0 [btrfs]
[36700.671747]  [<ffffffffa05d4bf2>] btrfs_ioctl_snap_create_transid+0x142/0x190 [btrfs]
[36700.671752]  [<ffffffffa05d4c6c>] ? btrfs_ioctl_snap_create+0x2c/0x80 [btrfs]
[36700.671757]  [<ffffffffa05d4c9e>] btrfs_ioctl_snap_create+0x5e/0x80 [btrfs]
[36700.671759]  [<ffffffff8113a764>] ? handle_pte_fault+0x84/0x920
[36700.671764]  [<ffffffffa05d87eb>] btrfs_ioctl+0xf0b/0x1d00 [btrfs]
[36700.671766]  [<ffffffff8113c120>] ? handle_mm_fault+0x210/0x310
[36700.671768]  [<ffffffff816f83a4>] ? __do_page_fault+0x284/0x4e0
[36700.671770]  [<ffffffff81180aa6>] do_vfs_ioctl+0x96/0x550
[36700.671772]  [<ffffffff81170fe3>] ? __sb_end_write+0x33/0x70
[36700.671774]  [<ffffffff81180ff1>] SyS_ioctl+0x91/0xb0
[36700.671775]  [<ffffffff816fcdc2>] system_call_fastpath+0x16/0x1b

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-09-01 08:16:39 -04:00
..
tests Btrfs: separate out tests into their own directory 2013-09-01 08:15:38 -04:00
acl.c Btrfs: skip adding an acl attribute if we don't have to 2012-12-16 20:46:15 -05: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: allocate prelim_ref with a slab allocater 2013-09-01 08:16:27 -04:00
backref.h Btrfs: allocate prelim_ref with a slab allocater 2013-09-01 08:16:27 -04:00
btrfs_inode.h Btrfs: don't cache the csum value into the extent state tree 2013-09-01 08:04:33 -04:00
check-integrity.c Btrfs: Use %z to format size_t 2013-09-01 08:16:19 -04:00
check-integrity.h Btrfs: add optional integrity check code 2011-12-21 19:14:09 +01:00
compat.h Btrfs: drop remaining LINUX_KERNEL_VERSION checks and compat code 2009-01-06 09:38:55 -05:00
compression.c Btrfs: Remove superfluous casts from u64 to unsigned long long 2013-09-01 08:16:08 -04:00
compression.h btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
ctree.c Btrfs: Make btrfs_header_chunk_tree_uuid() return unsigned long 2013-09-01 08:16:16 -04:00
ctree.h Btrfs: fix memory leak of uuid_root in free_fs_info 2013-09-01 08:16:37 -04:00
delayed-inode.c Btrfs: fix printing of non NULL terminated string 2013-09-01 08:16:20 -04:00
delayed-inode.h [readdir] convert btrfs 2013-06-29 12:57:00 +04:00
delayed-ref.c Btrfs: get rid of sparse warnings 2013-09-01 08:15:50 -04:00
delayed-ref.h Btrfs: handle running extent ops with skinny metadata 2013-05-17 21:40:15 -04:00
dev-replace.c Btrfs: Make BTRFS_DEV_REPLACE_DEVID an unsigned long long constant 2013-09-01 08:16:09 -04:00
dev-replace.h Btrfs: add new sources for device replace code 2012-12-12 17:15:41 -05:00
dir-item.c btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
disk-io.c Btrfs: fix for patch "cleanup: don't check the same thing twice" 2013-09-01 08:16:29 -04:00
disk-io.h Btrfs: introduce grab/put functions for the root of the fs/file tree 2013-06-14 11:29:38 -04:00
export.c Btrfs: cleanup: don't check the same thing twice 2013-06-14 11:29:30 -04:00
export.h NFS support for btrfs - v3 2008-09-25 11:04:06 -04:00
extent-tree.c Btrfs: remove ourselves from the cluster list under lock 2013-09-01 08:16:23 -04:00
extent_io.c Btrfs: PAGE_CACHE_SIZE is already unsigned long 2013-09-01 08:16:17 -04:00
extent_io.h btrfs: mark some local function as 'static' 2013-09-01 08:15:51 -04:00
extent_map.c btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
extent_map.h Btrfs: fix bad extent logging 2013-05-06 15:54:34 -04:00
file-item.c Btrfs: Remove superfluous casts from u64 to unsigned long long 2013-09-01 08:16:08 -04:00
file.c Btrf: cleanup: don't check for root_refs == 0 twice 2013-09-01 08:16:29 -04:00
free-space-cache.c Btrfs: convert all bug_ons in free-space-cache.c 2013-09-01 08:16:33 -04:00
free-space-cache.h Btrfs: separate out tests into their own directory 2013-09-01 08:15:38 -04:00
hash.h btrfs: extended inode refs 2012-10-09 09:14:45 -04:00
inode-item.c btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
inode-map.c Btrfs: don't use global block reservation for inode cache truncation 2013-05-17 21:40:22 -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: allow partial ordered extent completion 2013-09-01 08:16:34 -04:00
ioctl.c btrfs: return btrfs error code for dev excl ops err 2013-09-01 08:16:35 -04:00
Kconfig Btrfs: add support for asserts 2013-09-01 08:16:32 -04:00
locking.c btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
locking.h Btrfs: remove btrfs_try_spin_lock 2013-03-14 14:57:10 -04:00
lzo.c Btrfs: return -1 when lzo compression makes data bigger 2013-09-01 07:57:19 -04:00
Makefile Btrfs: introduce a tree for items that map UUIDs to something 2013-09-01 08:15:52 -04:00
math.h Btrfs: cleanup duplicated division functions 2012-12-11 13:31:30 -05:00
ordered-data.c Btrfs: allow partial ordered extent completion 2013-09-01 08:16:34 -04:00
ordered-data.h Btrfs: allow partial ordered extent completion 2013-09-01 08:16:34 -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: Remove superfluous casts from u64 to unsigned long long 2013-09-01 08:16:08 -04:00
print-tree.h btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
qgroup.c Btrfs: Remove superfluous casts from u64 to unsigned long long 2013-09-01 08:16:08 -04:00
raid56.c Btrfs, raid56: fix memory leak when allocating pages for p/q stripes failed 2013-09-01 08:04:27 -04:00
raid56.h Btrfs: RAID5 and RAID6 2013-02-01 14:24:23 -05:00
rcu-string.h Btrfs: use rcu to protect device->name 2012-06-14 21:29:16 -04:00
reada.c Btrfs: fix reada debug code compilation 2013-05-06 15:54:55 -04:00
relocation.c Btrf: cleanup: don't check for root_refs == 0 twice 2013-09-01 08:16:29 -04:00
root-tree.c Btrfs: Remove superfluous casts from u64 to unsigned long long 2013-09-01 08:16:08 -04:00
scrub.c Btrf: cleanup: don't check for root_refs == 0 twice 2013-09-01 08:16:29 -04:00
send.c btrfs: reuse kbasename helper 2013-09-01 08:16:36 -04:00
send.h btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
struct-funcs.c Btrfs: rewrite BTRFS_SETGET_FUNCS 2012-07-23 16:28:06 -04:00
super.c Btrfs: allocate prelim_ref with a slab allocater 2013-09-01 08:16:27 -04:00
sysfs.c btrfs: fixup/remove module.h usage as required 2013-03-01 15:01:01 -05:00
transaction.c Btrfs: Remove superfluous casts from u64 to unsigned long long 2013-09-01 08:16:08 -04:00
transaction.h btrfs: mark some local function as 'static' 2013-09-01 08:15:51 -04:00
tree-defrag.c btrfs: remove cache only arguments from defrag path 2013-02-20 12:59:36 -05:00
tree-log.c Btrfs: don't ignore errors from btrfs_run_delayed_items 2013-09-01 08:04:54 -04:00
tree-log.h btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
ulist.c Btrfs: fix crash regarding to ulist_add_merge 2013-07-02 11:50:59 -04:00
ulist.h Btrfs: add a rb_tree to improve performance of ulist search 2013-05-06 15:54:44 -04:00
uuid-tree.c Btrfs: check UUID tree during mount if required 2013-09-01 08:15:58 -04:00
volumes.c Btrfs: fix deadlock in uuid scan kthread 2013-09-01 08:16:39 -04:00
volumes.h Btrfs: add btrfs_alloc_device and switch to it 2013-09-01 08:16:04 -04:00
xattr.c btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -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: fix message printing 2012-10-09 09:19:57 -04:00