circular locking dependency warning in f2fs
Hi,
when trying to boot from an f2fs file system with lock debugging enabled, I get the attached circular locking dependency warning. Is this a known problem ?
Thanks,
Guenter
---
[ 10.315522] ======================================================
[ 10.315620] WARNING: possible circular locking dependency detected
[ 10.315753] 6.5.0-rc6-00027-g91aa6c412d7f #1 Tainted: G N
[ 10.315843] ------------------------------------------------------
[ 10.315922] seedrng/717 is trying to acquire lock:
[ 10.316010] ffff8e0e02c6b868 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_add_inline_entry+0x134/0x2d0
[ 10.316315]
[ 10.316315] but task is already holding lock:
[ 10.316391] ffff8e0e02c6b278 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_add_dentry+0x41/0xc0
[ 10.316543]
[ 10.316543] which lock already depends on the new lock.
[ 10.316543]
[ 10.316641]
[ 10.316641] the existing dependency chain (in reverse order) is:
[ 10.316745]
[ 10.316745] -> #1 (&fi->i_xattr_sem){.+.+}-{3:3}:
[ 10.316883] down_read+0x3d/0x170
[ 10.316973] f2fs_getxattr+0x370/0x440
[ 10.317036] __f2fs_get_acl+0x38/0x1e0
[ 10.317094] f2fs_init_acl+0x69/0x420
[ 10.317151] f2fs_init_inode_metadata+0x72/0x450
[ 10.317218] f2fs_add_regular_entry+0x372/0x510
[ 10.317283] f2fs_add_dentry+0xb8/0xc0
[ 10.317340] f2fs_do_add_link+0xd9/0x110
[ 10.317399] f2fs_mkdir+0xdf/0x180
[ 10.317453] vfs_mkdir+0x142/0x220
[ 10.317508] do_mkdirat+0x7c/0x120
[ 10.317561] __x64_sys_mkdir+0x47/0x70
[ 10.317617] do_syscall_64+0x3f/0x90
[ 10.317673] entry_SYSCALL_64_after_hwframe+0x73/0xdd
[ 10.317757]
[ 10.317757] -> #0 (&fi->i_sem){+.+.}-{3:3}:
[ 10.317843] __lock_acquire+0x16bf/0x2860
[ 10.317907] lock_acquire+0xcc/0x2c0
[ 10.317962] down_write+0x3a/0xc0
[ 10.318014] f2fs_add_inline_entry+0x134/0x2d0
[ 10.318077] f2fs_add_dentry+0x55/0xc0
[ 10.318141] f2fs_do_add_link+0xd9/0x110
[ 10.318201] f2fs_create+0xe8/0x170
[ 10.318255] lookup_open.isra.0+0x58e/0x6c0
[ 10.318317] path_openat+0x2af/0xa40
[ 10.318372] do_filp_open+0xb1/0x160
[ 10.318428] do_sys_openat2+0x91/0xc0
[ 10.318485] __x64_sys_open+0x54/0xa0
[ 10.318541] do_syscall_64+0x3f/0x90
[ 10.318597] entry_SYSCALL_64_after_hwframe+0x73/0xdd
[ 10.318676]
[ 10.318676] other info that might help us debug this:
[ 10.318676]
[ 10.318799] Possible unsafe locking scenario:
[ 10.318799]
[ 10.318875] CPU0 CPU1
[ 10.318935] ---- ----
[ 10.318999] rlock(&fi->i_xattr_sem);
[ 10.319068] lock(&fi->i_sem);
[ 10.319166] lock(&fi->i_xattr_sem);
[ 10.319264] lock(&fi->i_sem);
[ 10.319325]
[ 10.319325] *** DEADLOCK ***
[ 10.319325]
[ 10.319413] 4 locks held by seedrng/717:
[ 10.319500] #0: ffff8e0e049693e8 (sb_writers#4){.+.+}-{0:0}, at: path_openat+0xa08/0xa40
[ 10.319645] #1: ffff8e0e02c6ac28 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: path_openat+0x29b/0xa40
[ 10.319783] #2: ffff8e0e050623a8 (&sbi->cp_rwsem){.+.+}-{3:3}, at: f2fs_create+0xcc/0x170
[ 10.319899] #3: ffff8e0e02c6b278 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_add_dentry+0x41/0xc0
[ 10.320029]
[ 10.320029] stack backtrace:
[ 10.320166] CPU: 7 PID: 717 Comm: seedrng Tainted: G N 6.5.0-rc6-00027-g91aa6c412d7f #1
[ 10.320302] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
[ 10.320499] Call Trace:
[ 10.320579] <TASK>
[ 10.320665] dump_stack_lvl+0x64/0xb0
[ 10.320766] check_noncircular+0x151/0x170
[ 10.320834] ? register_lock_class+0x42/0x7a0
[ 10.320906] __lock_acquire+0x16bf/0x2860
[ 10.320974] lock_acquire+0xcc/0x2c0
[ 10.321026] ? f2fs_add_inline_entry+0x134/0x2d0
[ 10.321098] down_write+0x3a/0xc0
[ 10.321156] ? f2fs_add_inline_entry+0x134/0x2d0
[ 10.321220] f2fs_add_inline_entry+0x134/0x2d0
[ 10.321290] f2fs_add_dentry+0x55/0xc0
[ 10.321348] f2fs_do_add_link+0xd9/0x110
[ 10.321410] f2fs_create+0xe8/0x170
[ 10.321464] lookup_open.isra.0+0x58e/0x6c0
[ 10.321536] ? verify_cpu+0x20/0x100
[ 10.321605] ? verify_cpu+0x20/0x100
[ 10.321662] path_openat+0x2af/0xa40
[ 10.321722] do_filp_open+0xb1/0x160
[ 10.321777] ? alloc_fd+0x3c/0x220
[ 10.321838] ? _raw_spin_unlock+0x1e/0x40
[ 10.321901] do_sys_openat2+0x91/0xc0
[ 10.321959] __x64_sys_open+0x54/0xa0
[ 10.322014] do_syscall_64+0x3f/0x90
[ 10.322066] entry_SYSCALL_64_after_hwframe+0x73/0xdd
[ 10.322182] RIP: 0033:0x7ffbe94532de
[ 10.322384] Code: c3 8b 07 85 c0 75 24 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> e9 4b ce ff ff 41 54 4
9 89 f4 be 00 88 08 00 55 53 48 81 ec a0
[ 10.322619] RSP: 002b:00007ffc0cfc7ed8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
[ 10.322730] RAX: ffffffffffffffda RBX: 00007ffbe9495b48 RCX: 00007ffbe94532de
[ 10.322821] RDX: 0000000000000100 RSI: 0000000000008241 RDI: 000055f2b0816001
[ 10.322910] RBP: 000055f2b0816001 R08: 0000000000000000 R09: 0000000000000000
[ 10.322999] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
[ 10.323089] R13: 000055f2b0816001 R14: 000055f2b0816059 R15: 00007ffc0cfc8148
[ 10.323221] </TASK>
[ 10.383174] seedrng (717) used greatest stack depth: 12624 bytes left_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hi,
Quoted 60 lines · Guenter Roeck
Hi,
when trying to boot from an f2fs file system with lock debugging enabled, I get the attached circular locking dependency warning. Is this a known problem ?
Thanks,
Guenter---
[ 10.315522] ====================================================== [ 10.315620] WARNING: possible circular locking dependency detected [ 10.315753] 6.5.0-rc6-00027-g91aa6c412d7f #1 Tainted: G N [ 10.315843] ------------------------------------------------------ [ 10.315922] seedrng/717 is trying to acquire lock: [ 10.316010] ffff8e0e02c6b868 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_add_inline_entry+0x134/0x2d0 [ 10.316315] [ 10.316315] but task is already holding lock: [ 10.316391] ffff8e0e02c6b278 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_add_dentry+0x41/0xc0 [ 10.316543] [ 10.316543] which lock already depends on the new lock. [ 10.316543] [ 10.316641] [ 10.316641] the existing dependency chain (in reverse order) is: [ 10.316745] [ 10.316745] -> #1 (&fi->i_xattr_sem){.+.+}-{3:3}: [ 10.316883] down_read+0x3d/0x170 [ 10.316973] f2fs_getxattr+0x370/0x440 [ 10.317036] __f2fs_get_acl+0x38/0x1e0 [ 10.317094] f2fs_init_acl+0x69/0x420 [ 10.317151] f2fs_init_inode_metadata+0x72/0x450 [ 10.317218] f2fs_add_regular_entry+0x372/0x510 [ 10.317283] f2fs_add_dentry+0xb8/0xc0 [ 10.317340] f2fs_do_add_link+0xd9/0x110 [ 10.317399] f2fs_mkdir+0xdf/0x180 [ 10.317453] vfs_mkdir+0x142/0x220 [ 10.317508] do_mkdirat+0x7c/0x120 [ 10.317561] __x64_sys_mkdir+0x47/0x70 [ 10.317617] do_syscall_64+0x3f/0x90 [ 10.317673] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.317757] [ 10.317757] -> #0 (&fi->i_sem){+.+.}-{3:3}: [ 10.317843] __lock_acquire+0x16bf/0x2860 [ 10.317907] lock_acquire+0xcc/0x2c0 [ 10.317962] down_write+0x3a/0xc0 [ 10.318014] f2fs_add_inline_entry+0x134/0x2d0 [ 10.318077] f2fs_add_dentry+0x55/0xc0 [ 10.318141] f2fs_do_add_link+0xd9/0x110 [ 10.318201] f2fs_create+0xe8/0x170 [ 10.318255] lookup_open.isra.0+0x58e/0x6c0 [ 10.318317] path_openat+0x2af/0xa40 [ 10.318372] do_filp_open+0xb1/0x160 [ 10.318428] do_sys_openat2+0x91/0xc0 [ 10.318485] __x64_sys_open+0x54/0xa0 [ 10.318541] do_syscall_64+0x3f/0x90 [ 10.318597] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.318676] [ 10.318676] other info that might help us debug this: [ 10.318676]
Quoted 8 lines
[ 10.318799] Possible unsafe locking scenario: [ 10.318799] [ 10.318875] CPU0 CPU1 [ 10.318935] ---- ---- [ 10.318999] rlock(&fi->i_xattr_sem); [ 10.319068] lock(&fi->i_sem); [ 10.319166] lock(&fi->i_xattr_sem); [ 10.319264] lock(&fi->i_sem);
It looks like the same one reported by syzbot.
https://syzkaller.appspot.com/bug?extid=a4976ce949df66b1ddf1
However, I suspect it's a false alarm, since I'm interpreting the loop as below.
CPU0 CPU1lock(new_inode#1->i_xattr_sem)
lock(new_inode#2->i_sem)
lock(dir->i_xattr_sem)lock(new_inode#1->i_sem)
This looks fine to me.
Quoted 40 lines
[ 10.319325] [ 10.319325] *** DEADLOCK *** [ 10.319325] [ 10.319413] 4 locks held by seedrng/717: [ 10.319500] #0: ffff8e0e049693e8 (sb_writers#4){.+.+}-{0:0}, at: path_openat+0xa08/0xa40 [ 10.319645] #1: ffff8e0e02c6ac28 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: path_openat+0x29b/0xa40 [ 10.319783] #2: ffff8e0e050623a8 (&sbi->cp_rwsem){.+.+}-{3:3}, at: f2fs_create+0xcc/0x170 [ 10.319899] #3: ffff8e0e02c6b278 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_add_dentry+0x41/0xc0 [ 10.320029] [ 10.320029] stack backtrace: [ 10.320166] CPU: 7 PID: 717 Comm: seedrng Tainted: G N 6.5.0-rc6-00027-g91aa6c412d7f #1 [ 10.320302] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014 [ 10.320499] Call Trace: [ 10.320579] <TASK> [ 10.320665] dump_stack_lvl+0x64/0xb0 [ 10.320766] check_noncircular+0x151/0x170 [ 10.320834] ? register_lock_class+0x42/0x7a0 [ 10.320906] __lock_acquire+0x16bf/0x2860 [ 10.320974] lock_acquire+0xcc/0x2c0 [ 10.321026] ? f2fs_add_inline_entry+0x134/0x2d0 [ 10.321098] down_write+0x3a/0xc0 [ 10.321156] ? f2fs_add_inline_entry+0x134/0x2d0 [ 10.321220] f2fs_add_inline_entry+0x134/0x2d0 [ 10.321290] f2fs_add_dentry+0x55/0xc0 [ 10.321348] f2fs_do_add_link+0xd9/0x110 [ 10.321410] f2fs_create+0xe8/0x170 [ 10.321464] lookup_open.isra.0+0x58e/0x6c0 [ 10.321536] ? verify_cpu+0x20/0x100 [ 10.321605] ? verify_cpu+0x20/0x100 [ 10.321662] path_openat+0x2af/0xa40 [ 10.321722] do_filp_open+0xb1/0x160 [ 10.321777] ? alloc_fd+0x3c/0x220 [ 10.321838] ? _raw_spin_unlock+0x1e/0x40 [ 10.321901] do_sys_openat2+0x91/0xc0 [ 10.321959] __x64_sys_open+0x54/0xa0 [ 10.322014] do_syscall_64+0x3f/0x90 [ 10.322066] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.322182] RIP: 0033:0x7ffbe94532de [ 10.322384] Code: c3 8b 07 85 c0 75 24 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> e9 4b ce ff ff 41 54 49 89 f4 be 00 88 08 00 55 53 48 81 ec a0
Quoted 8 lines
[ 10.322619] RSP: 002b:00007ffc0cfc7ed8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 [ 10.322730] RAX: ffffffffffffffda RBX: 00007ffbe9495b48 RCX: 00007ffbe94532de [ 10.322821] RDX: 0000000000000100 RSI: 0000000000008241 RDI: 000055f2b0816001 [ 10.322910] RBP: 000055f2b0816001 R08: 0000000000000000 R09: 0000000000000000 [ 10.322999] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002 [ 10.323089] R13: 000055f2b0816001 R14: 000055f2b0816059 R15: 00007ffc0cfc8148 [ 10.323221] </TASK> [ 10.383174] seedrng (717) used greatest stack depth: 12624 bytes left
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 77 lines · Jaegeuk Kim
Hi,
Quoted 60 lines · Guenter Roeck
Hi,
when trying to boot from an f2fs file system with lock debugging enabled, I get the attached circular locking dependency warning. Is this a known problem ?
Thanks,
Guenter---
[ 10.315522] ====================================================== [ 10.315620] WARNING: possible circular locking dependency detected [ 10.315753] 6.5.0-rc6-00027-g91aa6c412d7f #1 Tainted: G N [ 10.315843] ------------------------------------------------------ [ 10.315922] seedrng/717 is trying to acquire lock: [ 10.316010] ffff8e0e02c6b868 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_add_inline_entry+0x134/0x2d0 [ 10.316315] [ 10.316315] but task is already holding lock: [ 10.316391] ffff8e0e02c6b278 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_add_dentry+0x41/0xc0 [ 10.316543] [ 10.316543] which lock already depends on the new lock. [ 10.316543] [ 10.316641] [ 10.316641] the existing dependency chain (in reverse order) is: [ 10.316745] [ 10.316745] -> #1 (&fi->i_xattr_sem){.+.+}-{3:3}: [ 10.316883] down_read+0x3d/0x170 [ 10.316973] f2fs_getxattr+0x370/0x440 [ 10.317036] __f2fs_get_acl+0x38/0x1e0 [ 10.317094] f2fs_init_acl+0x69/0x420 [ 10.317151] f2fs_init_inode_metadata+0x72/0x450 [ 10.317218] f2fs_add_regular_entry+0x372/0x510 [ 10.317283] f2fs_add_dentry+0xb8/0xc0 [ 10.317340] f2fs_do_add_link+0xd9/0x110 [ 10.317399] f2fs_mkdir+0xdf/0x180 [ 10.317453] vfs_mkdir+0x142/0x220 [ 10.317508] do_mkdirat+0x7c/0x120 [ 10.317561] __x64_sys_mkdir+0x47/0x70 [ 10.317617] do_syscall_64+0x3f/0x90 [ 10.317673] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.317757] [ 10.317757] -> #0 (&fi->i_sem){+.+.}-{3:3}: [ 10.317843] __lock_acquire+0x16bf/0x2860 [ 10.317907] lock_acquire+0xcc/0x2c0 [ 10.317962] down_write+0x3a/0xc0 [ 10.318014] f2fs_add_inline_entry+0x134/0x2d0 [ 10.318077] f2fs_add_dentry+0x55/0xc0 [ 10.318141] f2fs_do_add_link+0xd9/0x110 [ 10.318201] f2fs_create+0xe8/0x170 [ 10.318255] lookup_open.isra.0+0x58e/0x6c0 [ 10.318317] path_openat+0x2af/0xa40 [ 10.318372] do_filp_open+0xb1/0x160 [ 10.318428] do_sys_openat2+0x91/0xc0 [ 10.318485] __x64_sys_open+0x54/0xa0 [ 10.318541] do_syscall_64+0x3f/0x90 [ 10.318597] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.318676] [ 10.318676] other info that might help us debug this: [ 10.318676]Quoted 8 lines
[ 10.318799] Possible unsafe locking scenario: [ 10.318799] [ 10.318875] CPU0 CPU1 [ 10.318935] ---- ---- [ 10.318999] rlock(&fi->i_xattr_sem); [ 10.319068] lock(&fi->i_sem); [ 10.319166] lock(&fi->i_xattr_sem); [ 10.319264] lock(&fi->i_sem);It looks like the same one reported by syzbot.
https://syzkaller.appspot.com/bug?extid=a4976ce949df66b1ddf1However, I suspect it's a false alarm, since I'm interpreting the loop as below.
Quoted 8 lines
CPU0 CPU1
lock(new_inode#1->i_xattr_sem)lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)This looks fine to me.
Based on your feedback, am I correct assuming that you don't plan to fix this ?
Thanks,
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 85 lines · Guenter Roeck
Quoted 83 lines · Jaegeuk Kim
Hi,
Quoted 60 lines · Guenter Roeck
Hi,
when trying to boot from an f2fs file system with lock debugging enabled, I get the attached circular locking dependency warning. Is this a known problem ?
Thanks,
Guenter---
[ 10.315522] ====================================================== [ 10.315620] WARNING: possible circular locking dependency detected [ 10.315753] 6.5.0-rc6-00027-g91aa6c412d7f #1 Tainted: G N [ 10.315843] ------------------------------------------------------ [ 10.315922] seedrng/717 is trying to acquire lock: [ 10.316010] ffff8e0e02c6b868 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_add_inline_entry+0x134/0x2d0 [ 10.316315] [ 10.316315] but task is already holding lock: [ 10.316391] ffff8e0e02c6b278 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_add_dentry+0x41/0xc0 [ 10.316543] [ 10.316543] which lock already depends on the new lock. [ 10.316543] [ 10.316641] [ 10.316641] the existing dependency chain (in reverse order) is: [ 10.316745] [ 10.316745] -> #1 (&fi->i_xattr_sem){.+.+}-{3:3}: [ 10.316883] down_read+0x3d/0x170 [ 10.316973] f2fs_getxattr+0x370/0x440 [ 10.317036] __f2fs_get_acl+0x38/0x1e0 [ 10.317094] f2fs_init_acl+0x69/0x420 [ 10.317151] f2fs_init_inode_metadata+0x72/0x450 [ 10.317218] f2fs_add_regular_entry+0x372/0x510 [ 10.317283] f2fs_add_dentry+0xb8/0xc0 [ 10.317340] f2fs_do_add_link+0xd9/0x110 [ 10.317399] f2fs_mkdir+0xdf/0x180 [ 10.317453] vfs_mkdir+0x142/0x220 [ 10.317508] do_mkdirat+0x7c/0x120 [ 10.317561] __x64_sys_mkdir+0x47/0x70 [ 10.317617] do_syscall_64+0x3f/0x90 [ 10.317673] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.317757] [ 10.317757] -> #0 (&fi->i_sem){+.+.}-{3:3}: [ 10.317843] __lock_acquire+0x16bf/0x2860 [ 10.317907] lock_acquire+0xcc/0x2c0 [ 10.317962] down_write+0x3a/0xc0 [ 10.318014] f2fs_add_inline_entry+0x134/0x2d0 [ 10.318077] f2fs_add_dentry+0x55/0xc0 [ 10.318141] f2fs_do_add_link+0xd9/0x110 [ 10.318201] f2fs_create+0xe8/0x170 [ 10.318255] lookup_open.isra.0+0x58e/0x6c0 [ 10.318317] path_openat+0x2af/0xa40 [ 10.318372] do_filp_open+0xb1/0x160 [ 10.318428] do_sys_openat2+0x91/0xc0 [ 10.318485] __x64_sys_open+0x54/0xa0 [ 10.318541] do_syscall_64+0x3f/0x90 [ 10.318597] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.318676] [ 10.318676] other info that might help us debug this: [ 10.318676]Quoted 8 lines
[ 10.318799] Possible unsafe locking scenario: [ 10.318799] [ 10.318875] CPU0 CPU1 [ 10.318935] ---- ---- [ 10.318999] rlock(&fi->i_xattr_sem); [ 10.319068] lock(&fi->i_sem); [ 10.319166] lock(&fi->i_xattr_sem); [ 10.319264] lock(&fi->i_sem);It looks like the same one reported by syzbot.
https://syzkaller.appspot.com/bug?extid=a4976ce949df66b1ddf1However, I suspect it's a false alarm, since I'm interpreting the loop as below.
CPU0 CPU1
lock(new_inode#1->i_xattr_sem)lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)
Quoted 5 lines
Quoted 2 lines
This looks fine to me.
Based on your feedback, am I correct assuming that you don't plan to fix this ?
I'm quite open to something that I may miss. Chao, what do you think?
Quoted 3 lines
Thanks,
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 86 lines · Jaegeuk Kim
Quoted 85 lines · Guenter Roeck
Quoted 83 lines · Jaegeuk Kim
Hi,
Quoted 60 lines · Guenter Roeck
Hi,
when trying to boot from an f2fs file system with lock debugging enabled, I get the attached circular locking dependency warning. Is this a known problem ?
Thanks,
Guenter---
[ 10.315522] ====================================================== [ 10.315620] WARNING: possible circular locking dependency detected [ 10.315753] 6.5.0-rc6-00027-g91aa6c412d7f #1 Tainted: G N [ 10.315843] ------------------------------------------------------ [ 10.315922] seedrng/717 is trying to acquire lock: [ 10.316010] ffff8e0e02c6b868 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_add_inline_entry+0x134/0x2d0 [ 10.316315] [ 10.316315] but task is already holding lock: [ 10.316391] ffff8e0e02c6b278 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_add_dentry+0x41/0xc0 [ 10.316543] [ 10.316543] which lock already depends on the new lock. [ 10.316543] [ 10.316641] [ 10.316641] the existing dependency chain (in reverse order) is: [ 10.316745] [ 10.316745] -> #1 (&fi->i_xattr_sem){.+.+}-{3:3}: [ 10.316883] down_read+0x3d/0x170 [ 10.316973] f2fs_getxattr+0x370/0x440 [ 10.317036] __f2fs_get_acl+0x38/0x1e0 [ 10.317094] f2fs_init_acl+0x69/0x420 [ 10.317151] f2fs_init_inode_metadata+0x72/0x450 [ 10.317218] f2fs_add_regular_entry+0x372/0x510 [ 10.317283] f2fs_add_dentry+0xb8/0xc0 [ 10.317340] f2fs_do_add_link+0xd9/0x110 [ 10.317399] f2fs_mkdir+0xdf/0x180 [ 10.317453] vfs_mkdir+0x142/0x220 [ 10.317508] do_mkdirat+0x7c/0x120 [ 10.317561] __x64_sys_mkdir+0x47/0x70 [ 10.317617] do_syscall_64+0x3f/0x90 [ 10.317673] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.317757] [ 10.317757] -> #0 (&fi->i_sem){+.+.}-{3:3}: [ 10.317843] __lock_acquire+0x16bf/0x2860 [ 10.317907] lock_acquire+0xcc/0x2c0 [ 10.317962] down_write+0x3a/0xc0 [ 10.318014] f2fs_add_inline_entry+0x134/0x2d0 [ 10.318077] f2fs_add_dentry+0x55/0xc0 [ 10.318141] f2fs_do_add_link+0xd9/0x110 [ 10.318201] f2fs_create+0xe8/0x170 [ 10.318255] lookup_open.isra.0+0x58e/0x6c0 [ 10.318317] path_openat+0x2af/0xa40 [ 10.318372] do_filp_open+0xb1/0x160 [ 10.318428] do_sys_openat2+0x91/0xc0 [ 10.318485] __x64_sys_open+0x54/0xa0 [ 10.318541] do_syscall_64+0x3f/0x90 [ 10.318597] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.318676] [ 10.318676] other info that might help us debug this: [ 10.318676]Quoted 8 lines
[ 10.318799] Possible unsafe locking scenario: [ 10.318799] [ 10.318875] CPU0 CPU1 [ 10.318935] ---- ---- [ 10.318999] rlock(&fi->i_xattr_sem); [ 10.319068] lock(&fi->i_sem); [ 10.319166] lock(&fi->i_xattr_sem); [ 10.319264] lock(&fi->i_sem);It looks like the same one reported by syzbot.
https://syzkaller.appspot.com/bug?extid=a4976ce949df66b1ddf1However, I suspect it's a false alarm, since I'm interpreting the loop as below.
CPU0 CPU1
lock(new_inode#1->i_xattr_sem)lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
This looks fine to me.
Based on your feedback, am I correct assuming that you don't plan to fix this ?
I'm quite open to something that I may miss. Chao, what do you think?
Just to give you a background: Recently I started boot testing from f2fs. Apparently my test bed is the only one testing f2fs, meaning I was the only one reporting that f2fs crashes in v6.1.y. I then extended my j2fs test coverage to multiple architectures, only to discover that a recent commit introduced this lockdep splatch.
My tests always run with lockdep debugging enabled. At the same time, I can not tolerate persistent warnings because those would hide real problems. As consequence, I disable any feature generating such warnings if the reponsible maintainer(s) tell me that they won't fix it. In this context, it doesn't matter if the warning is a false positive or not.
Ultimately I am quite neutral in this regard; it is up to you if you are going to address the warning or not. I would just like to know if the above warning is going to be fixed so I can adjust my test coverage accordingly.
Side question: Does this possibly need down_read_nested() ?
Thanks,
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 75 lines · Jaegeuk Kim
Quoted 74 lines · Guenter Roeck
Quoted 72 lines · Jaegeuk Kim
Hi,
Quoted 68 lines · Guenter Roeck
Hi,
when trying to boot from an f2fs file system with lock debugging enabled, I get the attached circular locking dependency warning. Is this a known problem ?
Thanks,
Guenter---
[ 10.315522] ====================================================== [ 10.315620] WARNING: possible circular locking dependency detected [ 10.315753] 6.5.0-rc6-00027-g91aa6c412d7f #1 Tainted: G N [ 10.315843] ------------------------------------------------------ [ 10.315922] seedrng/717 is trying to acquire lock: [ 10.316010] ffff8e0e02c6b868 (&fi->i_sem){+.+.}-{3:3}, at: f2fs_add_inline_entry+0x134/0x2d0 [ 10.316315] [ 10.316315] but task is already holding lock: [ 10.316391] ffff8e0e02c6b278 (&fi->i_xattr_sem){.+.+}-{3:3}, at: f2fs_add_dentry+0x41/0xc0 [ 10.316543] [ 10.316543] which lock already depends on the new lock. [ 10.316543] [ 10.316641] [ 10.316641] the existing dependency chain (in reverse order) is: [ 10.316745] [ 10.316745] -> #1 (&fi->i_xattr_sem){.+.+}-{3:3}: [ 10.316883] down_read+0x3d/0x170 [ 10.316973] f2fs_getxattr+0x370/0x440 [ 10.317036] __f2fs_get_acl+0x38/0x1e0 [ 10.317094] f2fs_init_acl+0x69/0x420 [ 10.317151] f2fs_init_inode_metadata+0x72/0x450 [ 10.317218] f2fs_add_regular_entry+0x372/0x510 [ 10.317283] f2fs_add_dentry+0xb8/0xc0 [ 10.317340] f2fs_do_add_link+0xd9/0x110 [ 10.317399] f2fs_mkdir+0xdf/0x180 [ 10.317453] vfs_mkdir+0x142/0x220 [ 10.317508] do_mkdirat+0x7c/0x120 [ 10.317561] __x64_sys_mkdir+0x47/0x70 [ 10.317617] do_syscall_64+0x3f/0x90 [ 10.317673] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.317757] [ 10.317757] -> #0 (&fi->i_sem){+.+.}-{3:3}: [ 10.317843] __lock_acquire+0x16bf/0x2860 [ 10.317907] lock_acquire+0xcc/0x2c0 [ 10.317962] down_write+0x3a/0xc0 [ 10.318014] f2fs_add_inline_entry+0x134/0x2d0 [ 10.318077] f2fs_add_dentry+0x55/0xc0 [ 10.318141] f2fs_do_add_link+0xd9/0x110 [ 10.318201] f2fs_create+0xe8/0x170 [ 10.318255] lookup_open.isra.0+0x58e/0x6c0 [ 10.318317] path_openat+0x2af/0xa40 [ 10.318372] do_filp_open+0xb1/0x160 [ 10.318428] do_sys_openat2+0x91/0xc0 [ 10.318485] __x64_sys_open+0x54/0xa0 [ 10.318541] do_syscall_64+0x3f/0x90 [ 10.318597] entry_SYSCALL_64_after_hwframe+0x73/0xdd [ 10.318676] [ 10.318676] other info that might help us debug this: [ 10.318676] [ 10.318799] Possible unsafe locking scenario: [ 10.318799] [ 10.318875] CPU0 CPU1 [ 10.318935] ---- ---- [ 10.318999] rlock(&fi->i_xattr_sem); [ 10.319068] lock(&fi->i_sem); [ 10.319166] lock(&fi->i_xattr_sem); [ 10.319264] lock(&fi->i_sem);
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
It looks like the same one reported by syzbot.
https://syzkaller.appspot.com/bug?extid=a4976ce949df66b1ddf1However, I suspect it's a false alarm, since I'm interpreting the loop as below.
CPU0 CPU1
lock(new_inode#1->i_xattr_sem)
The call path is as below:
CPU0 CPU1
- f2fs_create
- f2fs_do_add_link
- f2fs_down_read(&F2FS_I(dir)->i_xattr_sem);
lock(dir#1->i_xattr_sem)
- f2fs_mkdir
- f2fs_do_add_link
- f2fs_add_regular_entry
- f2fs_down_write(&F2FS_I(inode)->i_sem); lock(new_dir_inode->i_sem)
- f2fs_init_inode_metadata
- __f2fs_get_acl
- f2fs_getxattr
- f2fs_down_read(&F2FS_I(inode)->i_xattr_sem); lock(dir#2->i_xattr_sem)
- f2fs_down_write(&F2FS_I(inode)->i_sem);
lock(new_reg_inode->i_sem)
1. i_xattr_sems were from different directories, otherwise, create and mkdir may race on dir->i_rwsem.
2. fi->i_sems were from different type of inodes, one is regular, and another is directory.
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)This looks fine to me.
Based on your feedback, am I correct assuming that you don't plan to fix this ?
I'm quite open to something that I may miss. Chao, what do you think?
Jaegeuk, I agree with you, it looks like a false alarm.
Thanks,
Quoted 4 lines
Quoted 4 lines
Thanks,
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 7 lines · Chao Yu
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)This looks fine to me.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Based on your feedback, am I correct assuming that you don't plan to fix this ?
I'm quite open to something that I may miss. Chao, what do you think?
Jaegeuk, I agree with you, it looks like a false alarm.
False positive lockdep reports still need to be eliminated, for example by fixing the lockdep annotations. Otherwise it's impossible to distinguish them from true positives.
- Eric
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 11 lines · Eric Biggers
Quoted 10 lines · Chao Yu
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)This looks fine to me.
Based on your feedback, am I correct assuming that you don't plan to fix this ?
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
I'm quite open to something that I may miss. Chao, what do you think?
Jaegeuk, I agree with you, it looks like a false alarm.
False positive lockdep reports still need to be eliminated, for example by fixing the lockdep annotations. Otherwise it's impossible to distinguish them from true positives.
Exactly, and that is why I don't test features with known lockdep annotation issues. I'll drop f2fs from my list of features to test for the time being.
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao,
Do you have some bandwidth to address this? Otherwise, I'll do some.
Thanks,
Quoted 23 lines · Guenter Roeck
Quoted 11 lines · Eric Biggers
Quoted 10 lines · Chao Yu
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)This looks fine to me.
Based on your feedback, am I correct assuming that you don't plan to fix this ?
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
I'm quite open to something that I may miss. Chao, what do you think?
Jaegeuk, I agree with you, it looks like a false alarm.
False positive lockdep reports still need to be eliminated, for example by fixing the lockdep annotations. Otherwise it's impossible to distinguish them from true positives.
Quoted 4 lines
Exactly, and that is why I don't test features with known lockdep annotation issues. I'll drop f2fs from my list of features to test for the time being.
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
May I know if this works?
https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u
Quoted 34 lines · Jaegeuk Kim
Chao,
Do you have some bandwidth to address this? Otherwise, I'll do some.
Thanks,
Quoted 27 lines · Guenter Roeck
Quoted 11 lines · Eric Biggers
Quoted 10 lines · Chao Yu
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)This looks fine to me.
Based on your feedback, am I correct assuming that you don't plan to fix this ?
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
I'm quite open to something that I may miss. Chao, what do you think?
Jaegeuk, I agree with you, it looks like a false alarm.
False positive lockdep reports still need to be eliminated, for example by fixing the lockdep annotations. Otherwise it's impossible to distinguish them from true positives.
Exactly, and that is why I don't test features with known lockdep annotation issues. I'll drop f2fs from my list of features to test for the time being.
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 4 lines · Jaegeuk Kim
May I know if this works?
https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u
Yes, that fixes the problem for me. That makes me wonder, though:
Why not just use the _nested functions unconditionally ?
Thanks,
Guenter
Quoted 31 lines · Jaegeuk Kim
Quoted 30 lines
Chao,
Do you have some bandwidth to address this? Otherwise, I'll do some.
Thanks,
Quoted 23 lines · Guenter Roeck
Quoted 20 lines · Eric Biggers
Quoted 7 lines · Chao Yu
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)This looks fine to me.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Based on your feedback, am I correct assuming that you don't plan to fix this ?
I'm quite open to something that I may miss. Chao, what do you think?
Jaegeuk, I agree with you, it looks like a false alarm.
False positive lockdep reports still need to be eliminated, for example by fixing the lockdep annotations. Otherwise it's impossible to distinguish them from true positives.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Exactly, and that is why I don't test features with known lockdep annotation issues. I'll drop f2fs from my list of features to test for the time being.
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 8 lines · Guenter Roeck
Quoted 4 lines · Jaegeuk Kim
May I know if this works?
https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u
Yes, that fixes the problem for me. That makes me wonder, though:
Why not just use the_nestedfunctions unconditionally ?
I think we should ignore that in this case only.
Quoted 39 lines
Thanks,
GuenterQuoted 35 lines · Jaegeuk Kim
Quoted 34 lines
Chao,
Do you have some bandwidth to address this? Otherwise, I'll do some.
Thanks,
Quoted 27 lines · Guenter Roeck
Quoted 11 lines · Eric Biggers
Quoted 10 lines · Chao Yu
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)This looks fine to me.
Based on your feedback, am I correct assuming that you don't plan to fix this ?
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
I'm quite open to something that I may miss. Chao, what do you think?
Jaegeuk, I agree with you, it looks like a false alarm.
False positive lockdep reports still need to be eliminated, for example by fixing the lockdep annotations. Otherwise it's impossible to distinguish them from true positives.
Exactly, and that is why I don't test features with known lockdep annotation issues. I'll drop f2fs from my list of features to test for the time being.
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 4 lines · Jaegeuk Kim
Quoted 3 lines · Guenter Roeck
Quoted 2 lines · Jaegeuk Kim
May I know if this works?
Quoted 8 lines
Quoted 5 lines
Yes, that fixes the problem for me. That makes me wonder, though:
Why not just use the_nestedfunctions unconditionally ?I think we should ignore that in this case only.
Not sure I understand. If CONFIG_DEBUG_LOCK_ALLOC is not enabled, the _nested functions map to the standard (unnested) functions.
From include/linux/rwsem.h:
#ifdef CONFIG_DEBUG_LOCK_ALLOC
...
#else
# define down_read_nested(sem, subclass) down_read(sem) # define down_read_killable_nested(sem, subclass) down_read_killable(sem) # define down_write_nest_lock(sem, nest_lock) down_write(sem) # define down_write_nested(sem, subclass) down_write(sem) # define down_write_killable_nested(sem, subclass) down_write_killable(sem) # define down_read_non_owner(sem) down_read(sem) # define up_read_non_owner(sem) up_read(sem) #endif
All you accomplish with the additional set of #ifdefs is to make the code more difficult to read.
Never mind, I guess this is your call to make.
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 3 lines · Jaegeuk Kim
Chao,
Do you have some bandwidth to address this? Otherwise, I'll do some.
Jaegeuk, it seems I'm late... anyway, the fix looks good to me.
Thanks,
Quoted 31 lines
Thanks,
Quoted 27 lines · Guenter Roeck
Quoted 11 lines · Eric Biggers
Quoted 10 lines · Chao Yu
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
lock(new_inode#2->i_sem) lock(dir->i_xattr_sem)
lock(new_inode#1->i_sem)This looks fine to me.
Based on your feedback, am I correct assuming that you don't plan to fix this ?
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
I'm quite open to something that I may miss. Chao, what do you think?
Jaegeuk, I agree with you, it looks like a false alarm.
False positive lockdep reports still need to be eliminated, for example by fixing the lockdep annotations. Otherwise it's impossible to distinguish them from true positives.
Exactly, and that is why I don't test features with known lockdep annotation issues. I'll drop f2fs from my list of features to test for the time being.
Guenter
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel