Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346244
b: refs/heads/master
c: b66623e
h: refs/heads/master
v: v3
  • Loading branch information
Philipp Reisner committed Nov 9, 2012
1 parent f578eda commit 3458a98
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 39a1aa7f49dc8eae5c8d3a4bf759eb7abeabe6c0
refs/heads/master: b66623e33efbbf55717df7bfc49882371118b866
1 change: 1 addition & 0 deletions trunk/drivers/block/drbd/drbd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,7 @@ enum {
* so shrink_page_list() would not recurse into,
* and potentially deadlock on, this drbd worker.
*/
DISCONNECT_SENT,
};

struct drbd_tconn { /* is a resource from the config file */
Expand Down
30 changes: 29 additions & 1 deletion trunk/drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ static int drbd_recv(struct drbd_tconn *tconn, void *buf, size_t size)
conn_err(tconn, "sock_recvmsg returned %d\n", rv);
break;
} else if (rv == 0) {
conn_info(tconn, "sock was shut down by peer\n");
break;
} else {
/* signal came in, or peer/link went down,
Expand All @@ -535,9 +534,25 @@ static int drbd_recv(struct drbd_tconn *tconn, void *buf, size_t size)

set_fs(oldfs);

if (rv == 0) {
if (test_bit(DISCONNECT_SENT, &tconn->flags)) {
long t;
rcu_read_lock();
t = rcu_dereference(tconn->net_conf)->ping_timeo * HZ/10;
rcu_read_unlock();

t = wait_event_timeout(tconn->ping_wait, tconn->cstate < C_WF_REPORT_PARAMS, t);

if (t)
goto out;
}
conn_info(tconn, "sock was shut down by peer\n");
}

if (rv != size)
conn_request_state(tconn, NS(conn, C_BROKEN_PIPE), CS_HARD);

out:
return rv;
}

Expand Down Expand Up @@ -894,6 +909,7 @@ static int conn_connect(struct drbd_tconn *tconn)
.door_bell = COMPLETION_INITIALIZER_ONSTACK(ad.door_bell),
};

clear_bit(DISCONNECT_SENT, &tconn->flags);
if (conn_request_state(tconn, NS(conn, C_WF_CONNECTION), CS_VERBOSE) < SS_SUCCESS)
return -2;

Expand Down Expand Up @@ -5316,6 +5332,18 @@ int drbd_asender(struct drbd_thread *thi)
received += rv;
buf += rv;
} else if (rv == 0) {
if (test_bit(DISCONNECT_SENT, &tconn->flags)) {
long t;
rcu_read_lock();
t = rcu_dereference(tconn->net_conf)->ping_timeo * HZ/10;
rcu_read_unlock();

t = wait_event_timeout(tconn->ping_wait,
tconn->cstate < C_WF_REPORT_PARAMS,
t);
if (t)
break;
}
conn_err(tconn, "meta connection shut down by peer.\n");
goto reconnect;
} else if (rv == -EAGAIN) {
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/block/drbd/drbd_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,9 @@ conn_cl_wide(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state v
goto abort;
}

if (val.conn == C_DISCONNECTING)
set_bit(DISCONNECT_SENT, &tconn->flags);

wait_event(tconn->ping_wait, (rv = _conn_rq_cond(tconn, mask, val)));
clear_bit(CONN_WD_ST_CHG_REQ, &tconn->flags);

Expand Down

0 comments on commit 3458a98

Please sign in to comment.