]> www.infradead.org Git - users/hch/misc.git/commit
nilfs2: determine empty node blocks as corrupted
authorRyusuke Konishi <konishi.ryusuke@gmail.com>
Wed, 4 Sep 2024 08:13:08 +0000 (17:13 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 9 Sep 2024 23:47:42 +0000 (16:47 -0700)
commit111b812d3662f3a1b831d19208f83aa711583fe6
tree18f96dd678cb534c9a03644ec0d4c2dd45b7dae8
parent9403001ad65ae4f4c5de368bdda3a0636b51d51a
nilfs2: determine empty node blocks as corrupted

Due to the nature of b-trees, nilfs2 itself and admin tools such as
mkfs.nilfs2 will never create an intermediate b-tree node block with 0
child nodes, nor will they delete (key, pointer)-entries that would result
in such a state.  However, it is possible that a b-tree node block is
corrupted on the backing device and is read with 0 child nodes.

Because operation is not guaranteed if the number of child nodes is 0 for
intermediate node blocks other than the root node, modify
nilfs_btree_node_broken(), which performs sanity checks when reading a
b-tree node block, so that such cases will be judged as metadata
corruption.

Link: https://lkml.kernel.org/r/20240904081401.16682-3-konishi.ryusuke@gmail.com
Fixes: 17c76b0104e4 ("nilfs2: B-tree based block mapping")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: Lizhi Xu <lizhi.xu@windriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/nilfs2/btree.c