* returns false if we should retry,
* true if we think connection is dead
*/
-static int we_should_drop_the_connection(struct drbd_conf *mdev, struct socket *sock)
+static int we_should_drop_the_connection(struct drbd_tconn *tconn, struct socket *sock)
{
int drop_it;
/* long elapsed = (long)(jiffies - mdev->last_received); */
- drop_it = mdev->tconn->meta.socket == sock
- || !mdev->tconn->asender.task
- || get_t_state(&mdev->tconn->asender) != RUNNING
- || mdev->state.conn < C_CONNECTED;
+ drop_it = tconn->meta.socket == sock
+ || !tconn->asender.task
+ || get_t_state(&tconn->asender) != RUNNING
+ || tconn->volume0->state.conn < C_CONNECTED;
if (drop_it)
return true;
- drop_it = !--mdev->tconn->ko_count;
+ drop_it = !--tconn->ko_count;
if (!drop_it) {
- dev_err(DEV, "[%s/%d] sock_sendmsg time expired, ko = %u\n",
- current->comm, current->pid, mdev->tconn->ko_count);
- request_ping(mdev->tconn);
+ conn_err(tconn, "[%s/%d] sock_sendmsg time expired, ko = %u\n",
+ current->comm, current->pid, tconn->ko_count);
+ request_ping(tconn);
}
return drop_it; /* && (mdev->state == R_PRIMARY) */;
}
-static void drbd_update_congested(struct drbd_conf *mdev)
+static void drbd_update_congested(struct drbd_tconn *tconn)
{
- struct sock *sk = mdev->tconn->data.socket->sk;
+ struct sock *sk = tconn->data.socket->sk;
if (sk->sk_wmem_queued > sk->sk_sndbuf * 4 / 5)
- set_bit(NET_CONGESTED, &mdev->tconn->flags);
+ set_bit(NET_CONGESTED, &tconn->flags);
}
/* The idea of sendpage seems to be to put some kind of reference
return _drbd_no_send_page(mdev, page, offset, size, msg_flags);
msg_flags |= MSG_NOSIGNAL;
- drbd_update_congested(mdev);
+ drbd_update_congested(mdev->tconn);
set_fs(KERNEL_DS);
do {
sent = mdev->tconn->data.socket->ops->sendpage(mdev->tconn->data.socket, page,
offset, len,
msg_flags);
if (sent == -EAGAIN) {
- if (we_should_drop_the_connection(mdev,
+ if (we_should_drop_the_connection(mdev->tconn,
mdev->tconn->data.socket))
break;
else
if (sock == mdev->tconn->data.socket) {
mdev->tconn->ko_count = mdev->tconn->net_conf->ko_count;
- drbd_update_congested(mdev);
+ drbd_update_congested(mdev->tconn);
}
do {
/* STRANGE
*/
rv = kernel_sendmsg(sock, &msg, &iov, 1, size);
if (rv == -EAGAIN) {
- if (we_should_drop_the_connection(mdev, sock))
+ if (we_should_drop_the_connection(mdev->tconn, sock))
break;
else
continue;