Kent Overstreet
e0cb5722e1
bcachefs: Fix snapshot_create_lock lock ordering
...
======================================================
WARNING: possible circular locking dependency detected
6.10.0-rc2-ktest-00018-gebd1d148b278 #144 Not tainted
------------------------------------------------------
fio/1345 is trying to acquire lock:
ffff88813e200ab8 (&c->snapshot_create_lock){++++}-{3:3}, at: bch2_truncate+0x76/0xf0
but task is already holding lock:
ffff888105a1fa38 (&sb->s_type->i_mutex_key#13){+.+.}-{3:3}, at: do_truncate+0x7b/0xc0
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&sb->s_type->i_mutex_key#13){+.+.}-{3:3}:
down_write+0x3d/0xd0
bch2_write_iter+0x1c0/0x10f0
vfs_write+0x24a/0x560
__x64_sys_pwrite64+0x77/0xb0
x64_sys_call+0x17e5/0x1ab0
do_syscall_64+0x68/0x130
entry_SYSCALL_64_after_hwframe+0x4b/0x53
-> #1 (sb_writers#10){.+.+}-{0:0}:
mnt_want_write+0x4a/0x1d0
filename_create+0x69/0x1a0
user_path_create+0x38/0x50
bch2_fs_file_ioctl+0x315/0xbf0
__x64_sys_ioctl+0x297/0xaf0
x64_sys_call+0x10cb/0x1ab0
do_syscall_64+0x68/0x130
entry_SYSCALL_64_after_hwframe+0x4b/0x53
-> #0 (&c->snapshot_create_lock){++++}-{3:3}:
__lock_acquire+0x1445/0x25b0
lock_acquire+0xbd/0x2b0
down_read+0x40/0x180
bch2_truncate+0x76/0xf0
bchfs_truncate+0x240/0x3f0
bch2_setattr+0x7b/0xb0
notify_change+0x322/0x4b0
do_truncate+0x8b/0xc0
do_ftruncate+0x110/0x270
__x64_sys_ftruncate+0x43/0x80
x64_sys_call+0x1373/0x1ab0
do_syscall_64+0x68/0x130
entry_SYSCALL_64_after_hwframe+0x4b/0x53
other info that might help us debug this:
Chain exists of:
&c->snapshot_create_lock --> sb_writers#10 --> &sb->s_type->i_mutex_key#13
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&sb->s_type->i_mutex_key#13);
lock(sb_writers#10);
lock(&sb->s_type->i_mutex_key#13);
rlock(&c->snapshot_create_lock);
*** DEADLOCK ***
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-10 13:17:16 -04:00
..
2024-05-29 09:25:15 -07:00
2024-03-12 20:32:19 -07:00
2024-02-26 11:36:28 +01:00
2024-05-27 13:12:13 +02:00
2024-01-11 20:11:35 -08:00
2024-06-10 13:17:16 -04:00
2024-03-12 20:32:19 -07:00
2024-03-12 20:32:19 -07:00
2024-06-07 15:13:12 -07:00
2024-05-21 13:11:44 -07:00
2024-05-25 14:23:58 -07:00
2024-03-12 20:32:19 -07:00
2024-05-03 02:36:51 -04:00
2024-05-19 09:21:03 -07:00
2024-03-26 09:04:54 +01:00
2023-12-28 04:57:57 -08:00
2024-04-23 16:08:55 -05:00
2024-05-13 14:14:05 -07:00
2024-04-13 10:33:02 +02:00
2024-02-27 11:21:33 +01:00
2024-05-24 09:31:50 -07:00
2024-04-25 21:59:59 +09:00
2024-01-23 10:58:56 -05:00
2024-05-03 11:50:28 +02:00
2024-05-21 09:51:42 -07:00
2024-05-20 13:23:43 -07:00
2024-04-25 21:07:02 -07:00
2024-03-26 09:04:53 +01:00
2024-05-23 12:04:36 -07:00
2024-05-21 09:51:42 -07:00
2023-12-29 11:58:34 -08:00
2024-04-24 16:55:28 -07:00
2023-12-21 12:51:00 -05:00
2024-03-12 20:32:19 -07:00
2024-05-19 09:21:03 -07:00
2024-05-24 13:34:07 +02:00
2024-05-09 18:09:57 +02:00
2024-05-21 09:51:42 -07:00
2024-05-25 13:23:42 -07:00
2024-03-27 13:17:15 +01:00
2024-05-04 19:02:39 +02:00
2024-05-06 09:07:20 -04:00
2024-03-26 09:04:55 +01:00
2024-05-27 08:09:12 -07:00
2024-05-23 13:51:09 -07:00
2024-05-22 20:14:47 -04:00
2024-06-05 19:19:27 -07:00
2024-05-20 12:43:58 -07:00
2024-05-25 14:19:01 -07:00
2024-05-22 20:14:47 -04:00
2024-03-26 09:04:54 +01:00
2024-05-14 17:44:14 -07:00
2024-05-22 09:23:18 -07:00
2024-06-05 19:19:26 -07:00
2024-03-09 12:33:22 -08:00
2024-03-12 20:32:19 -07:00
2024-03-26 09:04:53 +01:00
2024-04-12 14:52:29 +02:00
2024-04-25 20:56:25 -07:00
2024-05-21 08:34:51 -07:00
2024-03-27 13:17:15 +01:00
2024-06-07 01:05:26 -05:00
2024-05-19 14:02:03 -07:00
2024-04-23 13:27:43 +02:00
2024-02-27 11:21:31 +01:00
2024-05-23 09:31:50 -04:00
2024-03-21 15:09:29 -07:00
2024-04-23 15:37:02 +02:00
2024-03-12 20:32:19 -07:00
2024-05-10 04:34:52 +09:00
2024-04-03 16:06:39 +02:00
2024-05-03 08:30:58 -07:00
2024-05-27 20:50:35 +05:30
2024-04-10 07:23:47 +09:00
2024-05-21 13:11:44 -07:00
2024-04-26 10:33:05 +02:00
2024-03-12 20:03:34 -07:00
2024-05-02 20:35:57 +02:00
2024-04-24 15:55:28 -07:00
2024-05-19 14:02:03 -07:00
2023-10-30 19:28:19 -10:00
2024-05-21 09:51:42 -07:00
2023-11-02 20:53:31 -10:00
2024-05-23 12:04:36 -07:00
2024-04-25 20:56:20 -07:00
2024-05-29 09:39:34 -07:00
2024-04-11 10:21:24 +02:00
2024-02-08 10:12:26 +01:00
2024-05-05 14:00:48 -07:00
2024-05-19 09:21:03 -07:00
2024-05-10 08:26:31 +02:00
2024-04-05 15:53:47 +02:00
2024-03-12 20:03:34 -07:00
2024-04-15 16:03:24 -04:00
2024-02-02 13:11:50 +01:00
2024-04-05 15:53:45 +02:00
2024-03-15 09:00:09 -07:00
2024-05-02 20:35:57 +02:00
2024-05-13 06:58:35 +02:00
2024-03-14 17:43:30 -07:00
2024-04-17 13:49:44 +02:00
2024-02-20 09:53:33 +01:00
2024-03-11 10:21:06 -07:00
2024-02-27 11:21:31 +01:00
2024-02-08 10:12:37 +01:00
2023-11-18 14:56:16 +01:00
2024-02-06 14:31:05 +01:00
2024-05-22 09:23:18 -07:00
2024-02-07 21:16:29 +01:00
2024-03-13 12:53:53 -07:00
2024-04-15 16:03:25 -04:00
2024-05-21 08:08:00 -07:00
2024-02-02 13:11:49 +01:00
2023-11-18 14:56:16 +01:00
2024-03-12 20:03:34 -07:00
2023-11-18 14:56:16 +01:00
2024-05-21 13:11:44 -07:00
2023-12-12 16:20:02 +01:00
2024-04-15 14:54:13 -07:00
2024-02-20 09:23:52 +01:00
2024-05-02 16:28:20 +02:00
2024-05-24 13:34:07 +02:00
2024-04-15 16:03:25 -04:00
2024-03-26 09:01:18 +01:00
2024-05-20 12:31:43 -07:00
2023-12-28 04:57:57 -08:00
2024-04-10 16:23:02 -06:00
2024-05-19 09:21:03 -07:00
2024-02-15 23:43:47 -05:00