Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933558AbbFJHtX (ORCPT ); Wed, 10 Jun 2015 03:49:23 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:42779 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754199AbbFJHtE (ORCPT ); Wed, 10 Jun 2015 03:49:04 -0400 From: Nick Wang To: philipp.reisner@linbit.com, lars.ellenberg@linbit.com, drbd-dev@lists.linbit.com Cc: linux-kernel@vger.kernel.org, nwang@suse.com Subject: [PATCH 01/10] drbd: Fix potenial risk of overlap the old history when move history. Date: Wed, 10 Jun 2015 15:48:20 +0800 Message-Id: <1433922509-10280-2-git-send-email-nwang@suse.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1433922509-10280-1-git-send-email-nwang@suse.com> References: <1433922509-10280-1-git-send-email-nwang@suse.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1168 Lines: 35 Fix the potential history overlap when using more than two history uuids. Signed-off-by: Nick Wang CC: Philipp Reisner CC: Lars Ellenberg 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 f41aa8a..2ffb569 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/