aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2010-10-07 09:55:39 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2010-10-14 12:38:47 -0400
commite9ef7bb6f9696471ddddf0065afac8b435e5d051 (patch)
tree565678cffe217fb8ca884626909632d4a360c7b4 /drivers/block
parent4ac4aadacb5badc45679cd94cd362132daafe8c4 (diff)
drbd: allow for explicit resync-finished notifications
Preparation patch so more drbd_send_state() usage on the peer will not confuse drbd in receive_state(). Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/drbd/drbd_receiver.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 585049dfb711..990fe01afa50 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3260,6 +3260,40 @@ static int receive_state(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned
3260 os = ns = mdev->state; 3260 os = ns = mdev->state;
3261 spin_unlock_irq(&mdev->req_lock); 3261 spin_unlock_irq(&mdev->req_lock);
3262 3262
3263 /* peer says his disk is uptodate, while we think it is inconsistent,
3264 * and this happens while we think we have a sync going on. */
3265 if (os.pdsk == D_INCONSISTENT && real_peer_disk == D_UP_TO_DATE &&
3266 os.conn > C_CONNECTED && os.disk == D_UP_TO_DATE) {
3267 /* If we are (becoming) SyncSource, but peer is still in sync
3268 * preparation, ignore its uptodate-ness to avoid flapping, it
3269 * will change to inconsistent once the peer reaches active
3270 * syncing states.
3271 * It may have changed syncer-paused flags, however, so we
3272 * cannot ignore this completely. */
3273 if (peer_state.conn > C_CONNECTED &&
3274 peer_state.conn < C_SYNC_SOURCE)
3275 real_peer_disk = D_INCONSISTENT;
3276
3277 /* if peer_state changes to connected at the same time,
3278 * it explicitly notifies us that it finished resync.
3279 * Maybe we should finish it up, too? */
3280 else if (os.conn >= C_SYNC_SOURCE &&
3281 peer_state.conn == C_CONNECTED) {
3282 if (drbd_bm_total_weight(mdev) <= mdev->rs_failed)
3283 drbd_resync_finished(mdev);
3284 return TRUE;
3285 }
3286 }
3287
3288 /* peer says his disk is inconsistent, while we think it is uptodate,
3289 * and this happens while the peer still thinks we have a sync going on,
3290 * but we think we are already done with the sync.
3291 * We ignore this to avoid flapping pdsk.
3292 * This should not happen, if the peer is a recent version of drbd. */
3293 if (os.pdsk == D_UP_TO_DATE && real_peer_disk == D_INCONSISTENT &&
3294 os.conn == C_CONNECTED && peer_state.conn > C_SYNC_SOURCE)
3295 real_peer_disk = D_UP_TO_DATE;
3296
3263 if (ns.conn == C_WF_REPORT_PARAMS) 3297 if (ns.conn == C_WF_REPORT_PARAMS)
3264 ns.conn = C_CONNECTED; 3298 ns.conn = C_CONNECTED;
3265 3299