Add extra node_check function declaration back and show warning if node_check failed in node_prep_for_write().
v1->v2: Revert commit 851a8cd3f05b ("dm btree spine: remove extra node_check function declaration") to add extra node_check function declaration back. Fix commit message. v2->v3: Remove duplicate signature.
Li Lingfeng (1): Revert "dm btree spine: remove extra node_check function declaration"
Zhang Xiaoxu (1): dm btree spine: show warning if node_check failed in node_prep_for_write()
drivers/md/persistent-data/dm-btree-spine.c | 6 ++++++ 1 file changed, 6 insertions(+)
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8S2X7
--------------------------------
This reverts commit 851a8cd3f05bf21a0829f91dcab76d83313cd6ce.
For debug reason, we want to know the data on disk is corrupted by write or disk fault. So add extra node_check function declaration back to call node_check in node_prepare_for_write().
Signed-off-by: Li Lingfeng lilingfeng3@huawei.com --- drivers/md/persistent-data/dm-btree-spine.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c index 7540383b7cf3..ce6c5b3d3e28 100644 --- a/drivers/md/persistent-data/dm-btree-spine.c +++ b/drivers/md/persistent-data/dm-btree-spine.c @@ -16,6 +16,10 @@
#define BTREE_CSUM_XOR 121107
+static int node_check(struct dm_block_validator *v, + struct dm_block *b, + size_t block_size); + static void node_prepare_for_write(struct dm_block_validator *v, struct dm_block *b, size_t block_size)
From: Zhang Xiaoxu zhangxiaoxu5@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8S2X7
--------------------------------
The BUG_ON is unneed Since commit f73e2e70ec48 ("dm btree spine: remove paranoid node_check call in node_prep_for_write()") merged in v5.13.
For debug reason, we also want to know the data on disk is corrupted by write or disk fault. So also add check and print some info when data corrupted.
Signed-off-by: Zhang Xiaoxu zhangxiaoxu5@huawei.com Signed-off-by: Li Lingfeng lilingfeng3@huawei.com --- drivers/md/persistent-data/dm-btree-spine.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c index ce6c5b3d3e28..2fd26b59c3eb 100644 --- a/drivers/md/persistent-data/dm-btree-spine.c +++ b/drivers/md/persistent-data/dm-btree-spine.c @@ -31,6 +31,8 @@ static void node_prepare_for_write(struct dm_block_validator *v, h->csum = cpu_to_le32(dm_bm_checksum(&h->flags, block_size - sizeof(__le32), BTREE_CSUM_XOR)); + if (node_check(v, b, 4096)) + DMWARN_LIMIT("%s node_check failed", __func__); }
static int node_check(struct dm_block_validator *v,
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3653 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/4...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3653 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/4...
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3654 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/4...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3654 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/4...