Skip to content

Commit

Permalink
drbd: switch to sock_recvmsg()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Dec 3, 2017
1 parent 9858322 commit f7765c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 1 addition & 7 deletions drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1847,20 +1847,14 @@ int drbd_send(struct drbd_connection *connection, struct socket *sock,
void *buf, size_t size, unsigned msg_flags)
{
struct kvec iov = {.iov_base = buf, .iov_len = size};
struct msghdr msg;
struct msghdr msg = {.msg_flags = msg_flags | MSG_NOSIGNAL};
int rv, sent = 0;

if (!sock)
return -EBADR;

/* THINK if (signal_pending) return ... ? */

msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = msg_flags | MSG_NOSIGNAL;

iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, &iov, 1, size);

if (sock == connection->data.socket) {
Expand Down
3 changes: 2 additions & 1 deletion drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,8 @@ static int drbd_recv_short(struct socket *sock, void *buf, size_t size, int flag
struct msghdr msg = {
.msg_flags = (flags ? flags : MSG_WAITALL | MSG_NOSIGNAL)
};
return kernel_recvmsg(sock, &msg, &iov, 1, size, msg.msg_flags);
iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &iov, 1, size);
return sock_recvmsg(sock, &msg, msg.msg_flags);
}

static int drbd_recv(struct drbd_connection *connection, void *buf, size_t size)
Expand Down

0 comments on commit f7765c3

Please sign in to comment.