diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-03-15 13:24:49 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-03 19:16:26 -0400 |
commit | 38fa9988fa838324a0cce6e2f9d3c674230659d5 (patch) | |
tree | 8797715df160a1ab72927c89c654a5752122a2d6 | |
parent | 34f646bd5731cfd456fbacc95c12a2cf52275e54 (diff) |
drbd: Do not modify the connection state with something else that conn_request_state()
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_actlog.c | 2 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 16 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 10 |
3 files changed, 11 insertions, 17 deletions
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c index c1a90616776b..89f1a6904a46 100644 --- a/drivers/block/drbd/drbd_actlog.c +++ b/drivers/block/drbd/drbd_actlog.c | |||
@@ -769,7 +769,7 @@ static void drbd_try_clear_on_disk_bm(struct drbd_conf *mdev, sector_t sector, | |||
769 | dump_stack(); | 769 | dump_stack(); |
770 | 770 | ||
771 | lc_put(mdev->resync, &ext->lce); | 771 | lc_put(mdev->resync, &ext->lce); |
772 | drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); | 772 | conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD); |
773 | return; | 773 | return; |
774 | } | 774 | } |
775 | } else { | 775 | } else { |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index dfa092087d75..ac2a25f6b256 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -2922,7 +2922,7 @@ static int receive_protocol(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
2922 | return true; | 2922 | return true; |
2923 | 2923 | ||
2924 | disconnect: | 2924 | disconnect: |
2925 | drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); | 2925 | conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD); |
2926 | return false; | 2926 | return false; |
2927 | } | 2927 | } |
2928 | 2928 | ||
@@ -3101,7 +3101,7 @@ disconnect: | |||
3101 | crypto_free_hash(csums_tfm); | 3101 | crypto_free_hash(csums_tfm); |
3102 | /* but free the verify_tfm again, if csums_tfm did not work out */ | 3102 | /* but free the verify_tfm again, if csums_tfm did not work out */ |
3103 | crypto_free_hash(verify_tfm); | 3103 | crypto_free_hash(verify_tfm); |
3104 | drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); | 3104 | conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD); |
3105 | return false; | 3105 | return false; |
3106 | } | 3106 | } |
3107 | 3107 | ||
@@ -3161,7 +3161,7 @@ static int receive_sizes(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
3161 | mdev->state.disk >= D_OUTDATED && | 3161 | mdev->state.disk >= D_OUTDATED && |
3162 | mdev->state.conn < C_CONNECTED) { | 3162 | mdev->state.conn < C_CONNECTED) { |
3163 | dev_err(DEV, "The peer's disk size is too small!\n"); | 3163 | dev_err(DEV, "The peer's disk size is too small!\n"); |
3164 | drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); | 3164 | conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD); |
3165 | mdev->ldev->dc.disk_size = my_usize; | 3165 | mdev->ldev->dc.disk_size = my_usize; |
3166 | put_ldev(mdev); | 3166 | put_ldev(mdev); |
3167 | return false; | 3167 | return false; |
@@ -3237,7 +3237,7 @@ static int receive_uuids(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
3237 | (mdev->ed_uuid & ~((u64)1)) != (p_uuid[UI_CURRENT] & ~((u64)1))) { | 3237 | (mdev->ed_uuid & ~((u64)1)) != (p_uuid[UI_CURRENT] & ~((u64)1))) { |
3238 | dev_err(DEV, "Can only connect to data with current UUID=%016llX\n", | 3238 | dev_err(DEV, "Can only connect to data with current UUID=%016llX\n", |
3239 | (unsigned long long)mdev->ed_uuid); | 3239 | (unsigned long long)mdev->ed_uuid); |
3240 | drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); | 3240 | conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD); |
3241 | return false; | 3241 | return false; |
3242 | } | 3242 | } |
3243 | 3243 | ||
@@ -3442,7 +3442,7 @@ static int receive_state(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
3442 | if (test_and_clear_bit(CONN_DRY_RUN, &mdev->flags)) | 3442 | if (test_and_clear_bit(CONN_DRY_RUN, &mdev->flags)) |
3443 | return false; | 3443 | return false; |
3444 | D_ASSERT(os.conn == C_WF_REPORT_PARAMS); | 3444 | D_ASSERT(os.conn == C_WF_REPORT_PARAMS); |
3445 | drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); | 3445 | conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD); |
3446 | return false; | 3446 | return false; |
3447 | } | 3447 | } |
3448 | } | 3448 | } |
@@ -3467,7 +3467,7 @@ static int receive_state(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
3467 | tl_clear(mdev->tconn); | 3467 | tl_clear(mdev->tconn); |
3468 | drbd_uuid_new_current(mdev); | 3468 | drbd_uuid_new_current(mdev); |
3469 | clear_bit(NEW_CUR_UUID, &mdev->flags); | 3469 | clear_bit(NEW_CUR_UUID, &mdev->flags); |
3470 | drbd_force_state(mdev, NS2(conn, C_PROTOCOL_ERROR, susp, 0)); | 3470 | conn_request_state(mdev->tconn, NS2(conn, C_PROTOCOL_ERROR, susp, 0), CS_HARD); |
3471 | return false; | 3471 | return false; |
3472 | } | 3472 | } |
3473 | rv = _drbd_set_state(mdev, ns, cs_flags, NULL); | 3473 | rv = _drbd_set_state(mdev, ns, cs_flags, NULL); |
@@ -3475,7 +3475,7 @@ static int receive_state(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
3475 | spin_unlock_irq(&mdev->tconn->req_lock); | 3475 | spin_unlock_irq(&mdev->tconn->req_lock); |
3476 | 3476 | ||
3477 | if (rv < SS_SUCCESS) { | 3477 | if (rv < SS_SUCCESS) { |
3478 | drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); | 3478 | conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD); |
3479 | return false; | 3479 | return false; |
3480 | } | 3480 | } |
3481 | 3481 | ||
@@ -3648,7 +3648,7 @@ decode_bitmap_c(struct drbd_conf *mdev, | |||
3648 | * during all our tests. */ | 3648 | * during all our tests. */ |
3649 | 3649 | ||
3650 | dev_err(DEV, "receive_bitmap_c: unknown encoding %u\n", p->encoding); | 3650 | dev_err(DEV, "receive_bitmap_c: unknown encoding %u\n", p->encoding); |
3651 | drbd_force_state(mdev, NS(conn, C_PROTOCOL_ERROR)); | 3651 | conn_request_state(mdev->tconn, NS(conn, C_PROTOCOL_ERROR), CS_HARD); |
3652 | return -EIO; | 3652 | return -EIO; |
3653 | } | 3653 | } |
3654 | 3654 | ||
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index e459cb2076bd..a730520e468e 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -1290,12 +1290,6 @@ int w_send_read_req(struct drbd_work *w, int cancel) | |||
1290 | ok = drbd_send_drequest(mdev, P_DATA_REQUEST, req->i.sector, req->i.size, | 1290 | ok = drbd_send_drequest(mdev, P_DATA_REQUEST, req->i.sector, req->i.size, |
1291 | (unsigned long)req); | 1291 | (unsigned long)req); |
1292 | 1292 | ||
1293 | if (!ok) { | ||
1294 | /* ?? we set C_TIMEOUT or C_BROKEN_PIPE in drbd_send(); | ||
1295 | * so this is probably redundant */ | ||
1296 | if (mdev->state.conn >= C_CONNECTED) | ||
1297 | drbd_force_state(mdev, NS(conn, C_NETWORK_FAILURE)); | ||
1298 | } | ||
1299 | req_mod(req, ok ? HANDED_OVER_TO_NETWORK : SEND_FAILED); | 1293 | req_mod(req, ok ? HANDED_OVER_TO_NETWORK : SEND_FAILED); |
1300 | 1294 | ||
1301 | return ok; | 1295 | return ok; |
@@ -1510,7 +1504,7 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side) | |||
1510 | if (r > 0) { | 1504 | if (r > 0) { |
1511 | dev_info(DEV, "before-resync-target handler returned %d, " | 1505 | dev_info(DEV, "before-resync-target handler returned %d, " |
1512 | "dropping connection.\n", r); | 1506 | "dropping connection.\n", r); |
1513 | drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); | 1507 | conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD); |
1514 | return; | 1508 | return; |
1515 | } | 1509 | } |
1516 | } else /* C_SYNC_SOURCE */ { | 1510 | } else /* C_SYNC_SOURCE */ { |
@@ -1523,7 +1517,7 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side) | |||
1523 | } else { | 1517 | } else { |
1524 | dev_info(DEV, "before-resync-source handler returned %d, " | 1518 | dev_info(DEV, "before-resync-source handler returned %d, " |
1525 | "dropping connection.\n", r); | 1519 | "dropping connection.\n", r); |
1526 | drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); | 1520 | conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD); |
1527 | return; | 1521 | return; |
1528 | } | 1522 | } |
1529 | } | 1523 | } |