[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241024132225.2271667-1-yukuai1@huaweicloud.com>
Date: Thu, 24 Oct 2024 21:22:13 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: stable@...r.kernel.org,
gregkh@...uxfoundation.org,
harry.wentland@....com,
sunpeng.li@....com,
Rodrigo.Siqueira@....com,
alexander.deucher@....com,
christian.koenig@....com,
Xinhui.Pan@....com,
airlied@...il.com,
daniel@...ll.ch,
viro@...iv.linux.org.uk,
brauner@...nel.org,
Liam.Howlett@...cle.com,
akpm@...ux-foundation.org,
hughd@...gle.com,
willy@...radead.org,
sashal@...nel.org,
srinivasan.shanmugam@....com,
chiahsuan.chung@....com,
mingo@...nel.org,
mgorman@...hsingularity.net,
yukuai3@...wei.com,
chengming.zhou@...ux.dev,
zhangpeng.00@...edance.com,
chuck.lever@...cle.com
Cc: amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
maple-tree@...ts.infradead.org,
linux-mm@...ck.org,
yukuai1@...weicloud.com,
yi.zhang@...wei.com,
yangerkun@...wei.com
Subject: [PATCH 6.6 16/28] Revert "maple_tree: correct tree corruption on spanning store"
From: Yu Kuai <yukuai3@...wei.com>
This reverts commit 677f1df179cb68c12ddf7707ec325eb50e99c7d9.
Above commit contain manual changes and will cause conflicts for
following patches. The commit be backported from mainline later, without
conflicts.
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
lib/maple_tree.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index f73e3772c883..291412b91047 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2236,8 +2236,6 @@ static inline void mas_node_or_none(struct ma_state *mas,
/*
* mas_wr_node_walk() - Find the correct offset for the index in the @mas.
- * If @mas->index cannot be found within the containing
- * node, we traverse to the last entry in the node.
* @wr_mas: The maple write state
*
* Uses mas_slot_locked() and does not need to worry about dead nodes.
@@ -3657,7 +3655,7 @@ static bool mas_wr_walk(struct ma_wr_state *wr_mas)
return true;
}
-static void mas_wr_walk_index(struct ma_wr_state *wr_mas)
+static bool mas_wr_walk_index(struct ma_wr_state *wr_mas)
{
struct ma_state *mas = wr_mas->mas;
@@ -3666,9 +3664,11 @@ static void mas_wr_walk_index(struct ma_wr_state *wr_mas)
wr_mas->content = mas_slot_locked(mas, wr_mas->slots,
mas->offset);
if (ma_is_leaf(wr_mas->type))
- return;
+ return true;
mas_wr_walk_traverse(wr_mas);
+
}
+ return true;
}
/*
* mas_extend_spanning_null() - Extend a store of a %NULL to include surrounding %NULLs.
@@ -3905,8 +3905,8 @@ static inline int mas_wr_spanning_store(struct ma_wr_state *wr_mas)
memset(&b_node, 0, sizeof(struct maple_big_node));
/* Copy l_mas and store the value in b_node. */
mas_store_b_node(&l_wr_mas, &b_node, l_wr_mas.node_end);
- /* Copy r_mas into b_node if there is anything to copy. */
- if (r_mas.max > r_mas.last)
+ /* Copy r_mas into b_node. */
+ if (r_mas.offset <= r_wr_mas.node_end)
mas_mab_cp(&r_mas, r_mas.offset, r_wr_mas.node_end,
&b_node, b_node.b_end + 1);
else
--
2.39.2
Powered by blists - more mailing lists