* [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early
@ 2024-06-14 12:16 syzbot
2024-06-15 11:44 ` [PATCH] bcachefs: bch2_fs_read_write_early needs to hold write lock Edward Adam Davis
2024-06-17 13:52 ` [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early Kent Overstreet
0 siblings, 2 replies; 4+ messages in thread
From: syzbot @ 2024-06-14 12:16 UTC (permalink / raw)
To: bfoster, kent.overstreet, linux-bcachefs, linux-kernel,
syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 2ccbdf43d5e7 Merge tag 'for-linus' of git://git.kernel.org..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1689a256980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
dashboard link: https://syzkaller.appspot.com/bug?extid=4366624c0b5aac4906cf
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=110cda0e980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=164f91fe980000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-2ccbdf43.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c40c1cd990d2/vmlinux-2ccbdf43.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a2a94050804e/bzImage-2ccbdf43.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/a79f654b4644/mount_0.gz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4366624c0b5aac4906cf@syzkaller.appspotmail.com
------------[ cut here ]------------
WARNING: CPU: 0 PID: 10 at fs/bcachefs/super.c:525 bch2_fs_read_write_early+0x8a/0xa0 fs/bcachefs/super.c:525
Modules linked in:
CPU: 0 PID: 10 Comm: kworker/0:1 Not tainted 6.10.0-rc3-syzkaller-00044-g2ccbdf43d5e7 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: bcachefs_write_ref bch2_delete_dead_snapshots_work
RIP: 0010:bch2_fs_read_write_early+0x8a/0xa0 fs/bcachefs/super.c:525
Code: ac b8 76 fd 48 8d bb 78 02 00 00 be ff ff ff ff e8 0b cd d0 06 31 ff 89 c5 89 c6 e8 90 b3 76 fd 85 ed 75 c7 e8 87 b8 76 fd 90 <0f> 0b 90 eb bc 48 c7 c7 58 a2 e4 8f e8 c5 8b d2 fd eb 9b 0f 1f 00
RSP: 0018:ffffc900000d7910 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888041080000 RCX: ffffffff84172cc0
RDX: ffff888017e90000 RSI: ffffffff84172cc9 RDI: 0000000000000005
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 1ffffffff272c7ee R12: ffff8880410801a8
R13: ffff888041080ae0 R14: 0000000000000001 R15: ffff88801f971800
FS: 0000000000000000(0000) GS:ffff88806b000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555581085788 CR3: 0000000025a9e000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
bch2_delete_dead_snapshots+0xfdc/0x4e50 fs/bcachefs/snapshot.c:1569
bch2_delete_dead_snapshots_work+0x20/0x160 fs/bcachefs/snapshot.c:1690
process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231
process_scheduled_works kernel/workqueue.c:3312 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] bcachefs: bch2_fs_read_write_early needs to hold write lock
2024-06-14 12:16 [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early syzbot
@ 2024-06-15 11:44 ` Edward Adam Davis
2024-06-17 13:50 ` Kent Overstreet
2024-06-17 13:52 ` [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early Kent Overstreet
1 sibling, 1 reply; 4+ messages in thread
From: Edward Adam Davis @ 2024-06-15 11:44 UTC (permalink / raw)
To: syzbot+4366624c0b5aac4906cf
Cc: bfoster, kent.overstreet, linux-bcachefs, linux-kernel,
syzkaller-bugs
bch2_fs_read_write_early() needs to hold state_lock to pretect and sync data.
Reported-by: syzbot+4366624c0b5aac4906cf@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
fs/bcachefs/snapshot.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index 51918acfd726..b27a4327274d 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -1566,7 +1566,9 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
return 0;
if (!test_bit(BCH_FS_started, &c->flags)) {
+ down_write(&c->state_lock);
ret = bch2_fs_read_write_early(c);
+ up_write(&c->state_lock);
bch_err_msg(c, ret, "deleting dead snapshots: error going rw");
if (ret)
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bcachefs: bch2_fs_read_write_early needs to hold write lock
2024-06-15 11:44 ` [PATCH] bcachefs: bch2_fs_read_write_early needs to hold write lock Edward Adam Davis
@ 2024-06-17 13:50 ` Kent Overstreet
0 siblings, 0 replies; 4+ messages in thread
From: Kent Overstreet @ 2024-06-17 13:50 UTC (permalink / raw)
To: Edward Adam Davis
Cc: syzbot+4366624c0b5aac4906cf, bfoster, linux-bcachefs,
linux-kernel, syzkaller-bugs
On Sat, Jun 15, 2024 at 07:44:04PM +0800, Edward Adam Davis wrote:
> bch2_fs_read_write_early() needs to hold state_lock to pretect and sync data.
>
> Reported-by: syzbot+4366624c0b5aac4906cf@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
this is incorrect - delete_dead_snapshots() may be called synchronously
or asynchronously, and if it's called asynchronously we do hold
state_lock, so this will deadlock
> ---
> fs/bcachefs/snapshot.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
> index 51918acfd726..b27a4327274d 100644
> --- a/fs/bcachefs/snapshot.c
> +++ b/fs/bcachefs/snapshot.c
> @@ -1566,7 +1566,9 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
> return 0;
>
> if (!test_bit(BCH_FS_started, &c->flags)) {
> + down_write(&c->state_lock);
> ret = bch2_fs_read_write_early(c);
> + up_write(&c->state_lock);
> bch_err_msg(c, ret, "deleting dead snapshots: error going rw");
> if (ret)
> return ret;
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early
2024-06-14 12:16 [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early syzbot
2024-06-15 11:44 ` [PATCH] bcachefs: bch2_fs_read_write_early needs to hold write lock Edward Adam Davis
@ 2024-06-17 13:52 ` Kent Overstreet
1 sibling, 0 replies; 4+ messages in thread
From: Kent Overstreet @ 2024-06-17 13:52 UTC (permalink / raw)
To: syzbot; +Cc: bfoster, linux-bcachefs, linux-kernel, syzkaller-bugs
On Fri, Jun 14, 2024 at 05:16:20AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 2ccbdf43d5e7 Merge tag 'for-linus' of git://git.kernel.org..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1689a256980000
> kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
> dashboard link: https://syzkaller.appspot.com/bug?extid=4366624c0b5aac4906cf
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=110cda0e980000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=164f91fe980000
>
> Downloadable assets:
> disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-2ccbdf43.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/c40c1cd990d2/vmlinux-2ccbdf43.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/a2a94050804e/bzImage-2ccbdf43.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/a79f654b4644/mount_0.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+4366624c0b5aac4906cf@syzkaller.appspotmail.com
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 10 at fs/bcachefs/super.c:525 bch2_fs_read_write_early+0x8a/0xa0 fs/bcachefs/super.c:525
> Modules linked in:
> CPU: 0 PID: 10 Comm: kworker/0:1 Not tainted 6.10.0-rc3-syzkaller-00044-g2ccbdf43d5e7 #0
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
> Workqueue: bcachefs_write_ref bch2_delete_dead_snapshots_work
> RIP: 0010:bch2_fs_read_write_early+0x8a/0xa0 fs/bcachefs/super.c:525
> Code: ac b8 76 fd 48 8d bb 78 02 00 00 be ff ff ff ff e8 0b cd d0 06 31 ff 89 c5 89 c6 e8 90 b3 76 fd 85 ed 75 c7 e8 87 b8 76 fd 90 <0f> 0b 90 eb bc 48 c7 c7 58 a2 e4 8f e8 c5 8b d2 fd eb 9b 0f 1f 00
> RSP: 0018:ffffc900000d7910 EFLAGS: 00010293
> RAX: 0000000000000000 RBX: ffff888041080000 RCX: ffffffff84172cc0
> RDX: ffff888017e90000 RSI: ffffffff84172cc9 RDI: 0000000000000005
> RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
> R10: 0000000000000000 R11: 1ffffffff272c7ee R12: ffff8880410801a8
> R13: ffff888041080ae0 R14: 0000000000000001 R15: ffff88801f971800
> FS: 0000000000000000(0000) GS:ffff88806b000000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000555581085788 CR3: 0000000025a9e000 CR4: 0000000000350ef0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> <TASK>
> bch2_delete_dead_snapshots+0xfdc/0x4e50 fs/bcachefs/snapshot.c:1569
> bch2_delete_dead_snapshots_work+0x20/0x160 fs/bcachefs/snapshot.c:1690
> process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231
> process_scheduled_works kernel/workqueue.c:3312 [inline]
> worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393
> kthread+0x2c1/0x3a0 kernel/kthread.c:389
> ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
> ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
> </TASK>
>
>
> ---
> This report is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@googlegroups.com.
>
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
>
> If the report is already addressed, let syzbot know by replying with:
#syz fix: bcachefs: delete_dead_snapshots() doesn't need to go RW
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-17 13:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 12:16 [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early syzbot
2024-06-15 11:44 ` [PATCH] bcachefs: bch2_fs_read_write_early needs to hold write lock Edward Adam Davis
2024-06-17 13:50 ` Kent Overstreet
2024-06-17 13:52 ` [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early Kent Overstreet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox