Commit 58addbff authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] dlm: use kern_recvmsg()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9340b0d3
...@@ -268,12 +268,12 @@ static void close_connection(struct connection *con, bool and_other) ...@@ -268,12 +268,12 @@ static void close_connection(struct connection *con, bool and_other)
static int receive_from_sock(struct connection *con) static int receive_from_sock(struct connection *con)
{ {
int ret = 0; int ret = 0;
struct msghdr msg; struct msghdr msg = {};
struct iovec iov[2]; struct kvec iov[2];
mm_segment_t fs;
unsigned len; unsigned len;
int r; int r;
int call_again_soon = 0; int call_again_soon = 0;
int nvec;
mutex_lock(&con->sock_mutex); mutex_lock(&con->sock_mutex);
...@@ -293,21 +293,13 @@ static int receive_from_sock(struct connection *con) ...@@ -293,21 +293,13 @@ static int receive_from_sock(struct connection *con)
cbuf_init(&con->cb, PAGE_CACHE_SIZE); cbuf_init(&con->cb, PAGE_CACHE_SIZE);
} }
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_iovlen = 1;
msg.msg_iov = iov;
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_flags = 0;
/* /*
* iov[0] is the bit of the circular buffer between the current end * iov[0] is the bit of the circular buffer between the current end
* point (cb.base + cb.len) and the end of the buffer. * point (cb.base + cb.len) and the end of the buffer.
*/ */
iov[0].iov_len = con->cb.base - cbuf_data(&con->cb); iov[0].iov_len = con->cb.base - cbuf_data(&con->cb);
iov[0].iov_base = page_address(con->rx_page) + cbuf_data(&con->cb); iov[0].iov_base = page_address(con->rx_page) + cbuf_data(&con->cb);
iov[1].iov_len = 0; nvec = 1;
/* /*
* iov[1] is the bit of the circular buffer between the start of the * iov[1] is the bit of the circular buffer between the start of the
...@@ -317,15 +309,12 @@ static int receive_from_sock(struct connection *con) ...@@ -317,15 +309,12 @@ static int receive_from_sock(struct connection *con)
iov[0].iov_len = PAGE_CACHE_SIZE - cbuf_data(&con->cb); iov[0].iov_len = PAGE_CACHE_SIZE - cbuf_data(&con->cb);
iov[1].iov_len = con->cb.base; iov[1].iov_len = con->cb.base;
iov[1].iov_base = page_address(con->rx_page); iov[1].iov_base = page_address(con->rx_page);
msg.msg_iovlen = 2; nvec = 2;
} }
len = iov[0].iov_len + iov[1].iov_len; len = iov[0].iov_len + iov[1].iov_len;
fs = get_fs(); r = ret = kernel_recvmsg(con->sock, &msg, iov, nvec, len,
set_fs(get_ds());
r = ret = sock_recvmsg(con->sock, &msg, len,
MSG_DONTWAIT | MSG_NOSIGNAL); MSG_DONTWAIT | MSG_NOSIGNAL);
set_fs(fs);
if (ret <= 0) if (ret <= 0)
goto out_close; goto out_close;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment