Patch "nilfs2: determine empty node blocks as corrupted" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nilfs2: determine empty node blocks as corrupted

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nilfs2-determine-empty-node-blocks-as-corrupted.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9ffde729ae53c9404b09a11000b80e5b9f509ed4
Author: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxx>
Date:   Wed Sep 4 17:13:08 2024 +0900

    nilfs2: determine empty node blocks as corrupted
    
    [ Upstream commit 111b812d3662f3a1b831d19208f83aa711583fe6 ]
    
    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@xxxxxxxxx
    Fixes: 17c76b0104e4 ("nilfs2: B-tree based block mapping")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxx>
    Cc: Lizhi Xu <lizhi.xu@xxxxxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index c2aca9cd78644..7cfff27b4b4a5 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -350,7 +350,7 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node,
 	if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN ||
 		     level >= NILFS_BTREE_LEVEL_MAX ||
 		     (flags & NILFS_BTREE_NODE_ROOT) ||
-		     nchildren < 0 ||
+		     nchildren <= 0 ||
 		     nchildren > NILFS_BTREE_NODE_NCHILDREN_MAX(size))) {
 		nilfs_crit(inode->i_sb,
 			   "bad btree node (ino=%lu, blocknr=%llu): level = %d, flags = 0x%x, nchildren = %d",




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux