lkml.org 
[lkml]   [2015]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Patch v2 01/10] drbd: Fix the wrong logic of moving history
Date
Logic of moving history is wrong. May overlap
history when more than two history.
If won't extent more that two history. The loop
can be delete.

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com
CC: linux-kernel@vger.kernel.org
---
drbd/drbd_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
index 9871894..a3dc39e 100644
--- a/drbd/drbd_main.c
+++ b/drbd/drbd_main.c
@@ -3466,8 +3466,8 @@ void drbd_uuid_move_history(struct drbd_device *device) __must_hold(local)
{
int i;

- for (i = UI_HISTORY_START; i < UI_HISTORY_END; i++)
- device->ldev->md.uuid[i+1] = device->ldev->md.uuid[i];
+ for (i = UI_HISTORY_END; i > UI_HISTORY_START; i--)
+ device->ldev->md.uuid[i] = device->ldev->md.uuid[i-1];
}

void __drbd_uuid_set(struct drbd_device *device, int idx, u64 val) __must_hold(local)
--
1.8.4.5


\
 
 \ /
  Last update: 2015-07-13 11:01    [W:0.139 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site