Johannes Thumshirn
9d0a691a96
btrfs: reschedule when cloning lots of extents
...
[ Upstream commit 6b613cc97f0ace77f92f7bc112b8f6ad3f52baf8 ]
We have several occurrences of a soft lockup from fstest's generic/175
testcase, which look more or less like this one:
watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [xfs_io:10030]
Kernel panic - not syncing: softlockup: hung tasks
CPU: 0 PID: 10030 Comm: xfs_io Tainted: G L 5.9.0-rc5+ #768
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
Call Trace:
<IRQ>
dump_stack+0x77/0xa0
panic+0xfa/0x2cb
watchdog_timer_fn.cold+0x85/0xa5
? lockup_detector_update_enable+0x50/0x50
__hrtimer_run_queues+0x99/0x4c0
? recalibrate_cpu_khz+0x10/0x10
hrtimer_run_queues+0x9f/0xb0
update_process_times+0x28/0x80
tick_handle_periodic+0x1b/0x60
__sysvec_apic_timer_interrupt+0x76/0x210
asm_call_on_stack+0x12/0x20
</IRQ>
sysvec_apic_timer_interrupt+0x7f/0x90
asm_sysvec_apic_timer_interrupt+0x12/0x20
RIP: 0010:btrfs_tree_unlock+0x91/0x1a0 [btrfs]
RSP: 0018:ffffc90007123a58 EFLAGS: 00000282
RAX: ffff8881cea2fbe0 RBX: ffff8881cea2fbe0 RCX: 0000000000000000
RDX: ffff8881d23fd200 RSI: ffffffff82045220 RDI: ffff8881cea2fba0
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000032
R10: 0000160000000000 R11: 0000000000001000 R12: 0000000000001000
R13: ffff8882357fd5b0 R14: ffff88816fa76e70 R15: ffff8881cea2fad0
? btrfs_tree_unlock+0x15b/0x1a0 [btrfs]
btrfs_release_path+0x67/0x80 [btrfs]
btrfs_insert_replace_extent+0x177/0x2c0 [btrfs]
btrfs_replace_file_extents+0x472/0x7c0 [btrfs]
btrfs_clone+0x9ba/0xbd0 [btrfs]
btrfs_clone_files.isra.0+0xeb/0x140 [btrfs]
? file_update_time+0xcd/0x120
btrfs_remap_file_range+0x322/0x3b0 [btrfs]
do_clone_file_range+0xb7/0x1e0
vfs_clone_file_range+0x30/0xa0
ioctl_file_clone+0x8a/0xc0
do_vfs_ioctl+0x5b2/0x6f0
__x64_sys_ioctl+0x37/0xa0
do_syscall_64+0x33/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f87977fc247
RSP: 002b:00007ffd51a2f6d8 EFLAGS: 00000206 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f87977fc247
RDX: 00007ffd51a2f710 RSI: 000000004020940d RDI: 0000000000000003
RBP: 0000000000000004 R08: 00007ffd51a79080 R09: 0000000000000000
R10: 00005621f11352f2 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000000000 R14: 00005621f128b958 R15: 0000000080000000
Kernel Offset: disabled
---[ end Kernel panic - not syncing: softlockup: hung tasks ]---
All of these lockup reports have the call chain btrfs_clone_files() ->
btrfs_clone() in common. btrfs_clone_files() calls btrfs_clone() with
both source and destination extents locked and loops over the source
extent to create the clones.
Conditionally reschedule in the btrfs_clone() loop, to give some time back
to other processes.
CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-11-18 18:26:23 +01:00
..
2020-11-10 10:23:59 +01:00
2019-08-06 18:29:35 +02:00
2020-09-12 11:47:39 +02:00
2020-01-29 10:24:34 +01:00
2019-12-21 10:40:46 +01:00
2016-10-15 12:09:13 -07:00
2018-12-01 09:44:19 +01:00
2020-11-18 18:26:23 +01:00
2020-11-10 10:24:00 +01:00
2020-11-10 10:23:59 +01:00
2020-10-29 09:05:32 +01:00
2019-08-06 18:29:38 +02:00
2020-05-27 16:41:45 +02:00
2018-11-13 11:17:03 -08:00
2020-11-10 10:23:51 +01:00
2019-05-08 07:19:10 +02:00
2019-03-23 13:19:47 +01:00
2020-10-29 09:05:43 +01:00
2020-03-11 07:53:06 +01:00
2020-11-10 10:23:50 +01:00
2018-11-27 16:09:38 +01:00
2020-01-29 10:24:03 +01:00
2020-08-21 11:02:08 +02:00
2020-11-10 10:23:54 +01:00
2020-11-10 10:23:52 +01:00
2020-06-20 10:24:13 +02:00
2018-12-17 09:38:34 +01:00
2020-11-10 10:23:51 +01:00
2020-11-18 18:26:23 +01:00
2019-11-28 18:28:50 +01:00
2020-04-24 07:58:59 +02:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2019-05-31 06:48:12 -07:00
2017-11-30 08:39:04 +00:00
2020-09-03 11:21:19 +02:00
2020-08-26 10:29:05 +02:00
2020-01-29 10:24:19 +01:00
2019-11-25 09:52:23 +01:00
2018-11-13 11:17:02 -08:00
2016-10-10 20:16:43 -07:00
2020-08-21 11:02:06 +02:00
2019-03-13 14:04:52 -07:00
2020-11-10 10:23:56 +01:00
2018-02-03 17:05:38 +01:00
2020-06-30 15:38:22 -04:00
2020-06-20 10:24:09 +02:00
2019-02-06 17:33:30 +01:00
2020-10-29 09:05:43 +01:00
2020-08-21 11:02:08 +02:00
2016-10-10 20:16:43 -07:00
2020-02-28 15:42:43 +01:00
2020-06-20 10:24:11 +02:00
2020-06-20 10:24:11 +02:00
2020-01-12 11:24:20 +01:00
2020-10-29 09:05:36 +01:00
2016-10-10 20:16:43 -07:00
2020-10-29 09:05:45 +01:00
2020-08-26 10:29:03 +02:00
2018-09-05 09:20:03 +02:00
2018-09-05 09:20:10 +02:00
2018-12-17 09:38:32 +01:00
2020-11-10 10:23:58 +01:00
2020-10-29 09:05:44 +01:00
2020-08-21 11:02:11 +02:00
2020-11-10 10:23:52 +01:00
2018-12-21 14:11:31 +01:00
2016-10-10 20:16:43 -07:00
2017-01-09 08:32:24 +01:00
2020-06-03 08:16:42 +02:00
2019-07-10 09:55:38 +02:00
2018-06-26 08:08:09 +08:00
2019-11-06 12:18:04 +01:00
2020-10-01 20:40:12 +02:00
2020-11-10 10:23:56 +01:00
2020-05-20 08:15:32 +02:00
2018-02-25 11:05:55 +01:00
2020-06-30 15:38:35 -04:00
2017-07-05 14:40:26 +02:00
2018-02-28 10:18:33 +01:00
2019-03-27 14:13:04 +09:00
2019-03-05 17:57:05 +01:00
2019-03-13 14:04:58 -07:00
2020-10-14 09:48:13 +02:00
2020-05-20 08:15:41 +02:00
2018-01-31 12:55:52 +01:00
2020-05-27 16:41:40 +02:00
2020-09-03 11:21:21 +02:00
2020-04-02 17:20:27 +02:00
2017-09-20 08:20:01 +02:00
2017-09-20 08:19:59 +02:00
2016-10-07 18:46:29 -07:00
2020-04-02 17:20:38 +02:00
2020-01-12 11:24:13 +01:00
2018-02-22 15:43:48 +01:00
2017-07-21 07:42:22 +02:00
2017-10-18 09:35:39 +02:00
2020-03-11 07:53:07 +01:00
2020-05-02 17:23:10 +02:00
2018-02-17 13:21:15 +01:00
2020-03-20 09:07:44 +01:00
2019-06-11 12:22:45 +02:00
2020-05-02 17:23:20 +02:00
2017-03-15 10:02:43 +08:00
2017-01-26 08:24:37 +01:00
2019-06-11 12:22:49 +02:00
2020-01-04 13:41:06 +01:00
2016-10-11 15:06:30 -07:00
2016-10-07 18:46:30 -07:00
2019-06-11 12:22:45 +02:00
2017-06-14 15:06:01 +02:00
2019-02-06 17:33:29 +01:00
2017-05-08 07:47:54 +02:00
2019-09-06 10:19:37 +02:00
2016-10-08 11:06:08 -04:00
2020-08-21 11:01:55 +02:00