aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-10-27 06:21:30 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:34:46 -0500
commit67531718d8f1259f01ab84c2aa25f7b03c7afd46 (patch)
tree6f76323440f8ce3793b5d5f1a19808207f38db5b /drivers/block/drbd/drbd_main.c
parent422028b1ca4c07995af82a18abced022ff4c296c (diff)
drbd: Implemented two new connection states Ahead/Behind
In this connection mode, the ahead node no longer replicates application IO. The behind's disk becomes out dated. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r--drivers/block/drbd/drbd_main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index e81d009dd061..46f27d6c0b21 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -871,16 +871,19 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state
871 871
872 if (ns.conn >= C_CONNECTED && 872 if (ns.conn >= C_CONNECTED &&
873 ((ns.disk == D_CONSISTENT || ns.disk == D_OUTDATED) || 873 ((ns.disk == D_CONSISTENT || ns.disk == D_OUTDATED) ||
874 (ns.disk == D_NEGOTIATING && ns.conn == C_WF_BITMAP_T))) { 874 (ns.disk == D_NEGOTIATING && ns.conn == C_WF_BITMAP_T) ||
875 ns.conn >= C_AHEAD)) {
875 switch (ns.conn) { 876 switch (ns.conn) {
876 case C_WF_BITMAP_T: 877 case C_WF_BITMAP_T:
877 case C_PAUSED_SYNC_T: 878 case C_PAUSED_SYNC_T:
879 case C_BEHIND:
878 ns.disk = D_OUTDATED; 880 ns.disk = D_OUTDATED;
879 break; 881 break;
880 case C_CONNECTED: 882 case C_CONNECTED:
881 case C_WF_BITMAP_S: 883 case C_WF_BITMAP_S:
882 case C_SYNC_SOURCE: 884 case C_SYNC_SOURCE:
883 case C_PAUSED_SYNC_S: 885 case C_PAUSED_SYNC_S:
886 case C_AHEAD:
884 ns.disk = D_UP_TO_DATE; 887 ns.disk = D_UP_TO_DATE;
885 break; 888 break;
886 case C_SYNC_TARGET: 889 case C_SYNC_TARGET:
@@ -893,16 +896,18 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state
893 } 896 }
894 897
895 if (ns.conn >= C_CONNECTED && 898 if (ns.conn >= C_CONNECTED &&
896 (ns.pdsk == D_CONSISTENT || ns.pdsk == D_OUTDATED)) { 899 (ns.pdsk == D_CONSISTENT || ns.pdsk == D_OUTDATED || ns.conn >= C_AHEAD)) {
897 switch (ns.conn) { 900 switch (ns.conn) {
898 case C_CONNECTED: 901 case C_CONNECTED:
899 case C_WF_BITMAP_T: 902 case C_WF_BITMAP_T:
900 case C_PAUSED_SYNC_T: 903 case C_PAUSED_SYNC_T:
901 case C_SYNC_TARGET: 904 case C_SYNC_TARGET:
905 case C_BEHIND:
902 ns.pdsk = D_UP_TO_DATE; 906 ns.pdsk = D_UP_TO_DATE;
903 break; 907 break;
904 case C_WF_BITMAP_S: 908 case C_WF_BITMAP_S:
905 case C_PAUSED_SYNC_S: 909 case C_PAUSED_SYNC_S:
910 case C_AHEAD:
906 /* remap any consistent state to D_OUTDATED, 911 /* remap any consistent state to D_OUTDATED,
907 * but disallow "upgrade" of not even consistent states. 912 * but disallow "upgrade" of not even consistent states.
908 */ 913 */
@@ -1374,6 +1379,9 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
1374 if (os.conn == C_WF_REPORT_PARAMS && ns.conn >= C_CONNECTED) 1379 if (os.conn == C_WF_REPORT_PARAMS && ns.conn >= C_CONNECTED)
1375 drbd_send_state(mdev); 1380 drbd_send_state(mdev);
1376 1381
1382 if (os.conn != C_AHEAD && ns.conn == C_AHEAD)
1383 drbd_send_state(mdev);
1384
1377 /* We are in the progress to start a full sync... */ 1385 /* We are in the progress to start a full sync... */
1378 if ((os.conn != C_STARTING_SYNC_T && ns.conn == C_STARTING_SYNC_T) || 1386 if ((os.conn != C_STARTING_SYNC_T && ns.conn == C_STARTING_SYNC_T) ||
1379 (os.conn != C_STARTING_SYNC_S && ns.conn == C_STARTING_SYNC_S)) 1387 (os.conn != C_STARTING_SYNC_S && ns.conn == C_STARTING_SYNC_S))