aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-12-27 04:53:28 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:45:25 -0500
commitd612d309e4c8401ad94c531678b59c4a8b7c41ce (patch)
treea50d72c0d2a92701df76e7e6effd96781728f600 /drivers/block
parent617049aa7d753e8c821ac77126ab90e9f1b66d6d (diff)
drbd: No longer answer P_RS_DATA_REQUEST packets when in C_AHEAD mode
When the sync source node replies to a P_RS_DATA_REQUEST packet when it is already in ahead mode. I.e. those two packets crossed each other on the wire, that may lead to diverging bitmaps. This never happens in a well-tuned-system. In a well-tuned- system the resync controller has reduced the resync speed to zero long before we got into ahead-mode. But we have to be prepared for the not-well-tuned-system of course as well. Because -> diverging bitmaps = non terminating resync. 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_int.h3
-rw-r--r--drivers/block/drbd/drbd_receiver.c12
-rw-r--r--drivers/block/drbd/drbd_worker.c4
3 files changed, 16 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index ec06e744be42..a529285b0cd3 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -205,8 +205,9 @@ enum drbd_packets {
205 /* P_CKPT_DISABLE_REQ = 0x26, * currently reserved for protocol D */ 205 /* P_CKPT_DISABLE_REQ = 0x26, * currently reserved for protocol D */
206 P_DELAY_PROBE = 0x27, /* is used on BOTH sockets */ 206 P_DELAY_PROBE = 0x27, /* is used on BOTH sockets */
207 P_OUT_OF_SYNC = 0x28, /* Mark as out of sync (Outrunning), data socket */ 207 P_OUT_OF_SYNC = 0x28, /* Mark as out of sync (Outrunning), data socket */
208 P_RS_CANCEL = 0x29, /* meta: Used to cancel RS_DATA_REQUEST packet by SyncSource */
208 209
209 P_MAX_CMD = 0x28, 210 P_MAX_CMD = 0x2A,
210 P_MAY_IGNORE = 0x100, /* Flag to test if (cmd > P_MAY_IGNORE) ... */ 211 P_MAY_IGNORE = 0x100, /* Flag to test if (cmd > P_MAY_IGNORE) ... */
211 P_MAX_OPT_CMD = 0x101, 212 P_MAX_OPT_CMD = 0x101,
212 213
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index f0a0f66fbe68..bf865bd83414 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4361,7 +4361,16 @@ static int got_NegRSDReply(struct drbd_conf *mdev, struct p_header80 *h)
4361 4361
4362 if (get_ldev_if_state(mdev, D_FAILED)) { 4362 if (get_ldev_if_state(mdev, D_FAILED)) {
4363 drbd_rs_complete_io(mdev, sector); 4363 drbd_rs_complete_io(mdev, sector);
4364 drbd_rs_failed_io(mdev, sector, size); 4364 switch (be16_to_cpu(h->command)) {
4365 case P_NEG_RS_DREPLY:
4366 drbd_rs_failed_io(mdev, sector, size);
4367 case P_RS_CANCEL:
4368 break;
4369 default:
4370 D_ASSERT(0);
4371 put_ldev(mdev);
4372 return false;
4373 }
4365 put_ldev(mdev); 4374 put_ldev(mdev);
4366 } 4375 }
4367 4376
@@ -4459,6 +4468,7 @@ static struct asender_cmd *get_asender_cmd(int cmd)
4459 [P_STATE_CHG_REPLY] = { sizeof(struct p_req_state_reply), got_RqSReply }, 4468 [P_STATE_CHG_REPLY] = { sizeof(struct p_req_state_reply), got_RqSReply },
4460 [P_RS_IS_IN_SYNC] = { sizeof(struct p_block_ack), got_IsInSync }, 4469 [P_RS_IS_IN_SYNC] = { sizeof(struct p_block_ack), got_IsInSync },
4461 [P_DELAY_PROBE] = { sizeof(struct p_delay_probe93), got_skip }, 4470 [P_DELAY_PROBE] = { sizeof(struct p_delay_probe93), got_skip },
4471 [P_RS_CANCEL] = { sizeof(struct p_block_ack), got_NegRSDReply},
4462 [P_MAX_CMD] = { 0, NULL }, 4472 [P_MAX_CMD] = { 0, NULL },
4463 }; 4473 };
4464 if (cmd > P_MAX_CMD || asender_tbl[cmd].process == NULL) 4474 if (cmd > P_MAX_CMD || asender_tbl[cmd].process == NULL)
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 7bfeb79e7105..1d7510ebaa43 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -988,7 +988,9 @@ int w_e_end_rsdata_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
988 put_ldev(mdev); 988 put_ldev(mdev);
989 } 989 }
990 990
991 if (likely((e->flags & EE_WAS_ERROR) == 0)) { 991 if (mdev->state.conn == C_AHEAD) {
992 ok = drbd_send_ack(mdev, P_RS_CANCEL, e);
993 } else if (likely((e->flags & EE_WAS_ERROR) == 0)) {
992 if (likely(mdev->state.pdsk >= D_INCONSISTENT)) { 994 if (likely(mdev->state.pdsk >= D_INCONSISTENT)) {
993 inc_rs_pending(mdev); 995 inc_rs_pending(mdev);
994 ok = drbd_send_block(mdev, P_RS_DATA_REPLY, e); 996 ok = drbd_send_block(mdev, P_RS_DATA_REPLY, e);