diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2012-08-17 14:50:22 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-10-30 08:39:17 +0100 |
commit | 599377acb7cf3e1bdec13285096adac7ebaaaac5 (patch) | |
tree | b331f87ebae934a923e680db8c0bdfde3db409a8 /drivers/block/drbd/drbd_receiver.c | |
parent | c12a3d8c84a5e9913a97ca5e6513c913a7e5b288 (diff) | |
download | lwn-599377acb7cf3e1bdec13285096adac7ebaaaac5.tar.gz lwn-599377acb7cf3e1bdec13285096adac7ebaaaac5.zip |
drbd: Avoid NetworkFailure state during disconnect
Disconnecting is a cluster wide state change. In case the peer node agrees
to the state transition, it sends back the fact on the meta-data connection
and closes both sockets.
In case the node node that initiated the state transfer sees the closing
action on the data-socket, before the P_STATE_CHG_REPLY packet, it was
going into one of the network failure states.
At least with the fencing option set to something else thatn "dont-care",
the unclean shutdown of the connection causes a short IO freeze or
a fence operation.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 55c359a1a052..64e6a619241d 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -534,7 +534,6 @@ static int drbd_recv(struct drbd_conf *mdev, void *buf, size_t size) dev_err(DEV, "sock_recvmsg returned %d\n", rv); break; } else if (rv == 0) { - dev_info(DEV, "sock was shut down by peer\n"); break; } else { /* signal came in, or peer/link went down, @@ -547,9 +546,21 @@ static int drbd_recv(struct drbd_conf *mdev, void *buf, size_t size) set_fs(oldfs); + if (rv == 0) { + if (test_bit(DISCONNECT_SENT, &mdev->flags)) { + long t; /* time_left */ + t = wait_event_timeout(mdev->state_wait, mdev->state.conn < C_CONNECTED, + mdev->net_conf->ping_timeo * HZ/10); + if (t) + goto out; + } + dev_info(DEV, "sock was shut down by peer\n"); + } + if (rv != size) drbd_force_state(mdev, NS(conn, C_BROKEN_PIPE)); +out: return rv; } @@ -760,6 +771,7 @@ static int drbd_connect(struct drbd_conf *mdev) D_ASSERT(!mdev->data.socket); + clear_bit(DISCONNECT_SENT, &mdev->flags); if (drbd_request_state(mdev, NS(conn, C_WF_CONNECTION)) < SS_SUCCESS) return -2; @@ -4680,6 +4692,13 @@ int drbd_asender(struct drbd_thread *thi) received += rv; buf += rv; } else if (rv == 0) { + if (test_bit(DISCONNECT_SENT, &mdev->flags)) { + long t; /* time_left */ + t = wait_event_timeout(mdev->state_wait, mdev->state.conn < C_CONNECTED, + mdev->net_conf->ping_timeo * HZ/10); + if (t) + break; + } dev_err(DEV, "meta connection shut down by peer.\n"); goto reconnect; } else if (rv == -EAGAIN) { |