diff options
Diffstat (limited to 'fs/dlm/lowcomms-tcp.c')
-rw-r--r-- | fs/dlm/lowcomms-tcp.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/fs/dlm/lowcomms-tcp.c b/fs/dlm/lowcomms-tcp.c index f1efd17b2614..07e0a122c32f 100644 --- a/fs/dlm/lowcomms-tcp.c +++ b/fs/dlm/lowcomms-tcp.c | |||
@@ -268,12 +268,12 @@ static void close_connection(struct connection *con, bool and_other) | |||
268 | static int receive_from_sock(struct connection *con) | 268 | static int receive_from_sock(struct connection *con) |
269 | { | 269 | { |
270 | int ret = 0; | 270 | int ret = 0; |
271 | struct msghdr msg; | 271 | struct msghdr msg = {}; |
272 | struct iovec iov[2]; | 272 | struct kvec iov[2]; |
273 | mm_segment_t fs; | ||
274 | unsigned len; | 273 | unsigned len; |
275 | int r; | 274 | int r; |
276 | int call_again_soon = 0; | 275 | int call_again_soon = 0; |
276 | int nvec; | ||
277 | 277 | ||
278 | mutex_lock(&con->sock_mutex); | 278 | mutex_lock(&con->sock_mutex); |
279 | 279 | ||
@@ -293,21 +293,13 @@ static int receive_from_sock(struct connection *con) | |||
293 | cbuf_init(&con->cb, PAGE_CACHE_SIZE); | 293 | cbuf_init(&con->cb, PAGE_CACHE_SIZE); |
294 | } | 294 | } |
295 | 295 | ||
296 | msg.msg_control = NULL; | ||
297 | msg.msg_controllen = 0; | ||
298 | msg.msg_iovlen = 1; | ||
299 | msg.msg_iov = iov; | ||
300 | msg.msg_name = NULL; | ||
301 | msg.msg_namelen = 0; | ||
302 | msg.msg_flags = 0; | ||
303 | |||
304 | /* | 296 | /* |
305 | * iov[0] is the bit of the circular buffer between the current end | 297 | * iov[0] is the bit of the circular buffer between the current end |
306 | * point (cb.base + cb.len) and the end of the buffer. | 298 | * point (cb.base + cb.len) and the end of the buffer. |
307 | */ | 299 | */ |
308 | iov[0].iov_len = con->cb.base - cbuf_data(&con->cb); | 300 | iov[0].iov_len = con->cb.base - cbuf_data(&con->cb); |
309 | iov[0].iov_base = page_address(con->rx_page) + cbuf_data(&con->cb); | 301 | iov[0].iov_base = page_address(con->rx_page) + cbuf_data(&con->cb); |
310 | iov[1].iov_len = 0; | 302 | nvec = 1; |
311 | 303 | ||
312 | /* | 304 | /* |
313 | * iov[1] is the bit of the circular buffer between the start of the | 305 | * 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 | iov[0].iov_len = PAGE_CACHE_SIZE - cbuf_data(&con->cb); | 309 | iov[0].iov_len = PAGE_CACHE_SIZE - cbuf_data(&con->cb); |
318 | iov[1].iov_len = con->cb.base; | 310 | iov[1].iov_len = con->cb.base; |
319 | iov[1].iov_base = page_address(con->rx_page); | 311 | iov[1].iov_base = page_address(con->rx_page); |
320 | msg.msg_iovlen = 2; | 312 | nvec = 2; |
321 | } | 313 | } |
322 | len = iov[0].iov_len + iov[1].iov_len; | 314 | len = iov[0].iov_len + iov[1].iov_len; |
323 | 315 | ||
324 | fs = get_fs(); | 316 | r = ret = kernel_recvmsg(con->sock, &msg, iov, nvec, len, |
325 | set_fs(get_ds()); | ||
326 | r = ret = sock_recvmsg(con->sock, &msg, len, | ||
327 | MSG_DONTWAIT | MSG_NOSIGNAL); | 317 | MSG_DONTWAIT | MSG_NOSIGNAL); |
328 | set_fs(fs); | ||
329 | 318 | ||
330 | if (ret <= 0) | 319 | if (ret <= 0) |
331 | goto out_close; | 320 | goto out_close; |