Commit a6d00c8e authored by Philipp Reisner's avatar Philipp Reisner

drbd: Implemented IO thawing for multiple volumes

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 4669265a
...@@ -1088,8 +1088,6 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, ...@@ -1088,8 +1088,6 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
union drbd_state ns, enum chg_state_flags flags) union drbd_state ns, enum chg_state_flags flags)
{ {
enum drbd_fencing_p fp; enum drbd_fencing_p fp;
enum drbd_req_event what = NOTHING;
union drbd_state nsm;
struct sib_info sib; struct sib_info sib;
sib.sib_reason = SIB_STATE_CHANGE; sib.sib_reason = SIB_STATE_CHANGE;
...@@ -1118,45 +1116,22 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, ...@@ -1118,45 +1116,22 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
/* Here we have the actions that are performed after a /* Here we have the actions that are performed after a
state change. This function might sleep */ state change. This function might sleep */
nsm.i = -1;
if (ns.susp_nod) { if (ns.susp_nod) {
if (os.conn < C_CONNECTED && ns.conn >= C_CONNECTED) enum drbd_req_event what = NOTHING;
if (os.conn < C_CONNECTED && conn_lowest_conn(mdev->tconn) >= C_CONNECTED)
what = RESEND; what = RESEND;
if (os.disk == D_ATTACHING && ns.disk > D_ATTACHING) if (os.disk == D_ATTACHING && conn_lowest_disk(mdev->tconn) > D_ATTACHING)
what = RESTART_FROZEN_DISK_IO; what = RESTART_FROZEN_DISK_IO;
if (what != NOTHING)
nsm.susp_nod = 0;
}
if (ns.susp_fen) {
/* case1: The outdate peer handler is successful: */
if (os.pdsk > D_OUTDATED && ns.pdsk <= D_OUTDATED) {
tl_clear(mdev->tconn);
if (test_bit(NEW_CUR_UUID, &mdev->flags)) {
drbd_uuid_new_current(mdev);
clear_bit(NEW_CUR_UUID, &mdev->flags);
}
spin_lock_irq(&mdev->tconn->req_lock);
_drbd_set_state(_NS(mdev, susp_fen, 0), CS_VERBOSE, NULL);
spin_unlock_irq(&mdev->tconn->req_lock);
}
/* case2: The connection was established again: */
if (os.conn < C_CONNECTED && ns.conn >= C_CONNECTED) {
clear_bit(NEW_CUR_UUID, &mdev->flags);
what = RESEND;
nsm.susp_fen = 0;
}
}
if (what != NOTHING) { if (what != NOTHING) {
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
_tl_restart(mdev->tconn, what); _tl_restart(mdev->tconn, what);
nsm.i &= mdev->state.i; _drbd_set_state(_NS(mdev, susp_nod, 0), CS_VERBOSE, NULL);
_drbd_set_state(mdev, nsm, CS_VERBOSE, NULL);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
} }
}
/* Became sync source. With protocol >= 96, we still need to send out /* Became sync source. With protocol >= 96, we still need to send out
* the sync uuid now. Need to do that before any drbd_send_state, or * the sync uuid now. Need to do that before any drbd_send_state, or
...@@ -1402,6 +1377,9 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused) ...@@ -1402,6 +1377,9 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)
struct drbd_tconn *tconn = w->tconn; struct drbd_tconn *tconn = w->tconn;
enum drbd_conns oc = acscw->oc; enum drbd_conns oc = acscw->oc;
union drbd_state ns_max = acscw->ns_max; union drbd_state ns_max = acscw->ns_max;
union drbd_state ns_min = acscw->ns_min;
struct drbd_conf *mdev;
int vnr;
kfree(acscw); kfree(acscw);
...@@ -1409,6 +1387,36 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused) ...@@ -1409,6 +1387,36 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)
if (oc == C_STANDALONE && ns_max.conn == C_UNCONNECTED) if (oc == C_STANDALONE && ns_max.conn == C_UNCONNECTED)
drbd_thread_start(&tconn->receiver); drbd_thread_start(&tconn->receiver);
if (ns_max.susp_fen) {
/* case1: The outdate peer handler is successful: */
if (ns_max.pdsk <= D_OUTDATED) {
tl_clear(tconn);
idr_for_each_entry(&tconn->volumes, mdev, vnr) {
if (test_bit(NEW_CUR_UUID, &mdev->flags)) {
drbd_uuid_new_current(mdev);
clear_bit(NEW_CUR_UUID, &mdev->flags);
}
}
conn_request_state(tconn,
(union drbd_state) { { .susp_fen = 1 } },
(union drbd_state) { { .susp_fen = 0 } },
CS_VERBOSE);
}
/* case2: The connection was established again: */
if (ns_min.conn >= C_CONNECTED) {
idr_for_each_entry(&tconn->volumes, mdev, vnr)
clear_bit(NEW_CUR_UUID, &mdev->flags);
spin_lock_irq(&tconn->req_lock);
_tl_restart(tconn, RESEND);
_conn_request_state(tconn,
(union drbd_state) { { .susp_fen = 1 } },
(union drbd_state) { { .susp_fen = 0 } },
CS_VERBOSE);
spin_unlock_irq(&tconn->req_lock);
}
}
//conn_err(tconn, STATE_FMT, STATE_ARGS("nms", nms)); //conn_err(tconn, STATE_FMT, STATE_ARGS("nms", nms));
after_all_state_ch(tconn); after_all_state_ch(tconn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment