diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-12-23 08:24:33 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2011-03-10 05:45:26 -0500 |
commit | da0a78161d2b2da4819a1f05a38bb1dcbe02d951 (patch) | |
tree | 2228b9b03e645d5339b812c6330b44756675b36c | |
parent | d612d309e4c8401ad94c531678b59c4a8b7c41ce (diff) |
drbd: Be more careful with SyncSource -> Ahead transitions
We may not get from SyncSource to Ahead if we have sent some
P_RS_DATA_REPLY packets to the peer and are waiting for
P_WRITE_ACK.
Again, this is not relevant for proper tuned systems, but makes
sure that the not-tuned system does not get diverging bitmaps.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 3 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_req.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index bf865bd83414..fd0957f9c230 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -4385,10 +4385,11 @@ static int got_BarrierAck(struct drbd_conf *mdev, struct p_header80 *h) | |||
4385 | 4385 | ||
4386 | if (mdev->state.conn == C_AHEAD && | 4386 | if (mdev->state.conn == C_AHEAD && |
4387 | atomic_read(&mdev->ap_in_flight) == 0 && | 4387 | atomic_read(&mdev->ap_in_flight) == 0 && |
4388 | atomic_read(&mdev->rs_pending_cnt) == 0 && | ||
4388 | list_empty(&mdev->start_resync_work.list)) { | 4389 | list_empty(&mdev->start_resync_work.list)) { |
4389 | struct drbd_work *w = &mdev->start_resync_work; | 4390 | struct drbd_work *w = &mdev->start_resync_work; |
4390 | w->cb = w_start_resync; | 4391 | w->cb = w_start_resync; |
4391 | drbd_queue_work_front(&mdev->data.work, w); | 4392 | drbd_queue_work(&mdev->data.work, w); |
4392 | } | 4393 | } |
4393 | 4394 | ||
4394 | return true; | 4395 | return true; |
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index 889175110c91..a3f6b04ebaba 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -1002,7 +1002,13 @@ allocate_barrier: | |||
1002 | congested = 1; | 1002 | congested = 1; |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | if (congested) { | 1005 | if (congested && atomic_read(&mdev->rs_pending_cnt) == 0) { |
1006 | /* rs_pending_cnt must be zero, otherwise the two peers | ||
1007 | might get different bitmaps. With sane configurations | ||
1008 | the resync stalls long before we might want to go into | ||
1009 | AHEAD mode. | ||
1010 | We could force the resync into PAUSE mode here if | ||
1011 | rs_pending_cnt is > 0 ... */ | ||
1006 | queue_barrier(mdev); | 1012 | queue_barrier(mdev); |
1007 | 1013 | ||
1008 | if (mdev->net_conf->on_congestion == OC_PULL_AHEAD) | 1014 | if (mdev->net_conf->on_congestion == OC_PULL_AHEAD) |