Re: [syzbot] [nilfs?] WARNING in nilfs_btree_assign (3)

From: Ryusuke Konishi
Date: Tue Jan 14 2025 - 06:28:53 EST


Isolation test 2: the reproducers output a lot of
nilfs_btree_propagate messages, but the metadata corruption is not
escalated to the bmap layer, so test the effectiveness of that fix.

#syz test

diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index ef5061bb56da..8a280379e813 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -2103,11 +2103,14 @@ static int nilfs_btree_propagate(struct nilfs_bmap *btree,

ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0);
if (ret < 0) {
- if (unlikely(ret == -ENOENT))
+ if (unlikely(ret == -ENOENT)) {
nilfs_crit(btree->b_inode->i_sb,
"writing node/leaf block does not appear in b-tree (ino=%lu) at key=%llu, level=%d",
btree->b_inode->i_ino,
(unsigned long long)key, level);
+ /* Notify bmap layer of metadata corruption */
+ ret = -EINVAL;
+ }
goto out;
}

--
2.43.0