From: Lars Ellenberg Date: Thu, 27 Mar 2014 09:34:13 +0000 (+0100) Subject: drbd: clear CRASHED_PRIMARY only after successful resync X-Git-Tag: firefly_0821_release~176^2~3399^2~30 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2f2abeae3cd139fb3581249388bf2018612a87e5;p=firefly-linux-kernel-4.4.55.git drbd: clear CRASHED_PRIMARY only after successful resync If we lost a disk during the first resync after primary crash, we could have prematurely cleared the CRASHED_PRIMARY flag. Testing on C_CONNECTED is not what we meant there, but testing for both peers to become D_UP_TO_DATE. Signed-off-by: Philipp Reisner Signed-off-by: Lars Ellenberg --- diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index 4a75b7a03b9d..c35c0f001bb7 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c @@ -1238,7 +1238,8 @@ static void after_state_ch(struct drbd_device *device, union drbd_state os, sib.os = os; sib.ns = ns; - if (os.conn != C_CONNECTED && ns.conn == C_CONNECTED) { + if ((os.disk != D_UP_TO_DATE || os.pdsk != D_UP_TO_DATE) + && (ns.disk == D_UP_TO_DATE && ns.pdsk == D_UP_TO_DATE)) { clear_bit(CRASHED_PRIMARY, &device->flags); if (device->p_uuid) device->p_uuid[UI_FLAGS] &= ~((u64)2);