aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2012-08-28 05:33:35 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-09 08:08:23 -0500
commit797020117761eee21ef284cea90c51c690fca169 (patch)
treef631b73335e5a2211525a692ac57901d4c48b126
parent07fc96197aec46f7ad4f08a4b2a1ea426112e24d (diff)
drbd: Fix the way the STATE_SENT bit is cleared
With merging the commit 'drbd: Delay/reject other state changes while establishing a connection' the condition check for clearing the flag was wrong. Move the bit clearing to the __drbd_set_state() function in order to have it already cleared for the other parts of the function. I.e. clearing the susp_fen in the after_state_ch() function. 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_state.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c
index 9ae40c96c1be..a16278cde3db 100644
--- a/drivers/block/drbd/drbd_state.c
+++ b/drivers/block/drbd/drbd_state.c
@@ -186,6 +186,24 @@ enum drbd_conns conn_lowest_conn(struct drbd_tconn *tconn)
186 return conn; 186 return conn;
187} 187}
188 188
189static bool no_peer_wf_report_params(struct drbd_tconn *tconn)
190{
191 struct drbd_conf *mdev;
192 int vnr;
193 bool rv = true;
194
195 rcu_read_lock();
196 idr_for_each_entry(&tconn->volumes, mdev, vnr)
197 if (mdev->state.conn == C_WF_REPORT_PARAMS) {
198 rv = false;
199 break;
200 }
201 rcu_read_unlock();
202
203 return rv;
204}
205
206
189/** 207/**
190 * cl_wide_st_chg() - true if the state change is a cluster wide one 208 * cl_wide_st_chg() - true if the state change is a cluster wide one
191 * @mdev: DRBD device. 209 * @mdev: DRBD device.
@@ -971,6 +989,11 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns,
971 if (os.disk == D_ATTACHING && ns.disk >= D_NEGOTIATING) 989 if (os.disk == D_ATTACHING && ns.disk >= D_NEGOTIATING)
972 drbd_print_uuids(mdev, "attached to UUIDs"); 990 drbd_print_uuids(mdev, "attached to UUIDs");
973 991
992 /* Wake up role changes, that were delayed because of connection establishing */
993 if (os.conn == C_WF_REPORT_PARAMS && ns.conn != C_WF_REPORT_PARAMS &&
994 no_peer_wf_report_params(mdev->tconn))
995 clear_bit(STATE_SENT, &mdev->tconn->flags);
996
974 wake_up(&mdev->misc_wait); 997 wake_up(&mdev->misc_wait);
975 wake_up(&mdev->state_wait); 998 wake_up(&mdev->state_wait);
976 wake_up(&mdev->tconn->ping_wait); 999 wake_up(&mdev->tconn->ping_wait);
@@ -1457,12 +1480,6 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
1457 && verify_can_do_stop_sector(mdev)) 1480 && verify_can_do_stop_sector(mdev))
1458 drbd_send_state(mdev, ns); 1481 drbd_send_state(mdev, ns);
1459 1482
1460 /* Wake up role changes, that were delayed because of connection establishing */
1461 if (os.conn == C_WF_REPORT_PARAMS && ns.conn != C_WF_REPORT_PARAMS) {
1462 if (test_and_clear_bit(STATE_SENT, &mdev->tconn->flags))
1463 wake_up(&mdev->state_wait);
1464 }
1465
1466 /* This triggers bitmap writeout of potentially still unwritten pages 1483 /* This triggers bitmap writeout of potentially still unwritten pages
1467 * if the resync finished cleanly, or aborted because of peer disk 1484 * if the resync finished cleanly, or aborted because of peer disk
1468 * failure, or because of connection loss. 1485 * failure, or because of connection loss.