bcachefs: Fix race path in bch2_inode_insert()
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 23 May 2024 00:36:42 +0000 (20:36 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 23 May 2024 00:37:47 +0000 (20:37 -0400)
commitd93ff5fa40b9db5f505d508336bc171f54db862e
tree42d8e00b8727ce105455860ac19d932b3c9e8545
parentcd3b31f9d4174cccafd8da615d73f40c1ce48939
bcachefs: Fix race path in bch2_inode_insert()

__destroy_new_inode() is appropriate when we have _just_allocated the
inode, but not when it's been fully initialized and on i_sb_list.

Reported-by: syzbot+a0ddc9873c280a4cb18f@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs.c