[PATCH] persistent-data: fix bug about btree of updating internal node's minima key in btree_split_beneath.

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

 



Signed-off-by: monty <monty_pavel@xxxxxxxx>
---
 drivers/md/persistent-data/dm-btree.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index f21ce6a..25ce5ec 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -694,6 +694,8 @@ static int btree_split_beneath(struct shadow_spine *s, uint64_t key)
 	if (key < le64_to_cpu(rn->keys[0])) {
 		unlock_block(s->info, right);
 		s->nodes[1] = left;
+		if (key < le64_to_cpu(ln->keys[0]))
+			ln->keys[0] = cpu_to_le64(key);
 	} else {
 		unlock_block(s->info, left);
 		s->nodes[1] = right;
-- 
1.7.1

>From 5c926190bdeb71a9b1918cca1ccb5e62251f533c Mon Sep 17 00:00:00 2001
From: monty <monty_pavel@xxxxxxxx>
Date: Mon, 18 Dec 2017 15:52:31 -0500
Subject: [PATCH] persistent-data: fix bug about btree of updating internal node's minima
 key in btree_split_beneath.

 fix bug about btree_split_beneath func, this bug may cause a key had
 been inserted to btree, but dm_btree_lookup can not find the key in
 btree later.

Signed-off-by: monty <monty_pavel@xxxxxxxx>
---
 drivers/md/persistent-data/dm-btree.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index f21ce6a..25ce5ec 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -694,6 +694,8 @@ static int btree_split_beneath(struct shadow_spine *s, uint64_t key)
 	if (key < le64_to_cpu(rn->keys[0])) {
 		unlock_block(s->info, right);
 		s->nodes[1] = left;
+		if (key < le64_to_cpu(ln->keys[0]))
+			ln->keys[0] = cpu_to_le64(key);
 	} else {
 		unlock_block(s->info, left);
 		s->nodes[1] = right;
-- 
1.7.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux