return rv;
}
-static int drbd_recv(struct drbd_conf *mdev, void *buf, size_t size)
+static int drbd_recv(struct drbd_tconn *tconn, void *buf, size_t size)
{
mm_segment_t oldfs;
struct kvec iov = {
set_fs(KERNEL_DS);
for (;;) {
- rv = sock_recvmsg(mdev->tconn->data.socket, &msg, size, msg.msg_flags);
+ rv = sock_recvmsg(tconn->data.socket, &msg, size, msg.msg_flags);
if (rv == size)
break;
if (rv < 0) {
if (rv == -ECONNRESET)
- dev_info(DEV, "sock was reset by peer\n");
+ conn_info(tconn, "sock was reset by peer\n");
else if (rv != -ERESTARTSYS)
- dev_err(DEV, "sock_recvmsg returned %d\n", rv);
+ conn_err(tconn, "sock_recvmsg returned %d\n", rv);
break;
} else if (rv == 0) {
- dev_info(DEV, "sock was shut down by peer\n");
+ conn_info(tconn, "sock was shut down by peer\n");
break;
} else {
/* signal came in, or peer/link went down,
set_fs(oldfs);
if (rv != size)
- drbd_force_state(mdev, NS(conn, C_BROKEN_PIPE));
+ drbd_force_state(tconn->volume0, NS(conn, C_BROKEN_PIPE));
return rv;
}
struct p_header *h = &mdev->tconn->data.rbuf.header;
int r;
- r = drbd_recv(mdev, h, sizeof(*h));
+ r = drbd_recv(mdev->tconn, h, sizeof(*h));
if (unlikely(r != sizeof(*h))) {
if (!signal_pending(current))
dev_warn(DEV, "short read expecting header on sock: r=%d\n", r);
crypto_hash_digestsize(mdev->tconn->integrity_r_tfm) : 0;
if (dgs) {
- rr = drbd_recv(mdev, dig_in, dgs);
+ rr = drbd_recv(mdev->tconn, dig_in, dgs);
if (rr != dgs) {
if (!signal_pending(current))
dev_warn(DEV,
page_chain_for_each(page) {
unsigned len = min_t(int, ds, PAGE_SIZE);
data = kmap(page);
- rr = drbd_recv(mdev, data, len);
+ rr = drbd_recv(mdev->tconn, data, len);
if (drbd_insert_fault(mdev, DRBD_FAULT_RECEIVE)) {
dev_err(DEV, "Fault injection: Corrupting data on receive\n");
data[0] = data[0] ^ (unsigned long)-1;
data = kmap(page);
while (data_size) {
- rr = drbd_recv(mdev, data, min_t(int, data_size, PAGE_SIZE));
+ rr = drbd_recv(mdev->tconn, data, min_t(int, data_size, PAGE_SIZE));
if (rr != min_t(int, data_size, PAGE_SIZE)) {
rv = 0;
if (!signal_pending(current))
crypto_hash_digestsize(mdev->tconn->integrity_r_tfm) : 0;
if (dgs) {
- rr = drbd_recv(mdev, dig_in, dgs);
+ rr = drbd_recv(mdev->tconn, dig_in, dgs);
if (rr != dgs) {
if (!signal_pending(current))
dev_warn(DEV,
bio_for_each_segment(bvec, bio, i) {
expect = min_t(int, data_size, bvec->bv_len);
- rr = drbd_recv(mdev,
+ rr = drbd_recv(mdev->tconn,
kmap(bvec->bv_page)+bvec->bv_offset,
expect);
kunmap(bvec->bv_page);
peer_req->digest = di;
peer_req->flags |= EE_HAS_DIGEST;
- if (drbd_recv(mdev, di->digest, digest_size) != digest_size)
+ if (drbd_recv(mdev->tconn, di->digest, digest_size) != digest_size)
goto out_free_e;
if (cmd == P_CSUM_RS_REQUEST) {
if (mdev->tconn->agreed_pro_version >= 87) {
unsigned char *my_alg = mdev->tconn->net_conf->integrity_alg;
- if (drbd_recv(mdev, p_integrity_alg, data_size) != data_size)
+ if (drbd_recv(mdev->tconn, p_integrity_alg, data_size) != data_size)
return false;
p_integrity_alg[SHARED_SECRET_MAX-1] = 0;
/* initialize verify_alg and csums_alg */
memset(p->verify_alg, 0, 2 * SHARED_SECRET_MAX);
- if (drbd_recv(mdev, &p->head.payload, header_size) != header_size)
+ if (drbd_recv(mdev->tconn, &p->head.payload, header_size) != header_size)
return false;
mdev->sync_conf.rate = be32_to_cpu(p->rate);
return false;
}
- if (drbd_recv(mdev, p->verify_alg, data_size) != data_size)
+ if (drbd_recv(mdev->tconn, p->verify_alg, data_size) != data_size)
return false;
/* we expect NUL terminated string */
}
if (want == 0)
return 0;
- err = drbd_recv(mdev, buffer, want);
+ err = drbd_recv(mdev->tconn, buffer, want);
if (err != want) {
if (err >= 0)
err = -EIO;
/* use the page buff */
p = buffer;
memcpy(p, h, sizeof(*h));
- if (drbd_recv(mdev, p->head.payload, data_size) != data_size)
+ if (drbd_recv(mdev->tconn, p->head.payload, data_size) != data_size)
goto out;
if (data_size <= (sizeof(*p) - sizeof(p->head))) {
dev_err(DEV, "ReportCBitmap packet too small (l:%u)\n", data_size);
size = data_size;
while (size > 0) {
want = min_t(int, size, sizeof(sink));
- r = drbd_recv(mdev, sink, want);
+ r = drbd_recv(mdev->tconn, sink, want);
if (!expect(r > 0))
break;
size -= r;
}
if (shs) {
- rv = drbd_recv(mdev, &header->payload, shs);
+ rv = drbd_recv(mdev->tconn, &header->payload, shs);
if (unlikely(rv != shs)) {
if (!signal_pending(current))
dev_warn(DEV, "short read while reading sub header: rv=%d\n", rv);
return -1;
}
- rv = drbd_recv(mdev, &p->head.payload, expect);
+ rv = drbd_recv(mdev->tconn, &p->head.payload, expect);
if (rv != expect) {
if (!signal_pending(current))
goto fail;
}
- rv = drbd_recv(mdev, peers_ch, length);
+ rv = drbd_recv(mdev->tconn, peers_ch, length);
if (rv != length) {
if (!signal_pending(current))
goto fail;
}
- rv = drbd_recv(mdev, response , resp_size);
+ rv = drbd_recv(mdev->tconn, response , resp_size);
if (rv != resp_size) {
if (!signal_pending(current))