From 34fc71e7ba64b5f23bf03e6579ff9029f87a9242 Mon Sep 17 00:00:00 2001 From: Philipp Reisner Date: Wed, 17 Mar 2010 14:18:41 +0100 Subject: [PATCH 16/16] drbd: Do not upgrade state to Outdated if already Inconsistent [Bugz 277] There was a race condition: In a situation with a SyncSource+Primary and a SyncTarget+Secondary node, and a resync dependency to some other device. After both nodes decided to do the resync, the other device finishes its resync process. At that time SyncSource already sent the P_SYNC_UUID packet, and already updated its peer disk state to Inconsistent. The SyncTarget node waits for the P_SYNC_UUID and sends a state packet to report the resync dependency change. That packet still carries a disk state of Outdated. Impact: If application writes come in, during that time on the Primary node, those do not get replicated, and the out-of-sync counter gets increased. => The completion of resync is not detected on the primary node. => stalled. Those blocks get resync'ed with the next resync, since the are get marked as out-of-sync in the bitmap. In order to fix this, we filter out that wrong state change in the sanitize_state() function. --- drbd/drbd_main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c index 0a3dac0..41ca61a 100644 --- a/drbd/drbd_main.c +++ b/drbd/drbd_main.c @@ -932,7 +932,7 @@ STATIC union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state break; case C_WF_BITMAP_S: case C_PAUSED_SYNC_S: - ns.pdsk = D_OUTDATED; + ns.pdsk = os.pdsk > D_OUTDATED ? D_OUTDATED : os.pdsk; break; case C_SYNC_SOURCE: ns.pdsk = D_INCONSISTENT; -- 1.6.3.3