aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-02-08 13:27:03 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-04-01 23:19:30 -0400
commit66f5dcef137beef14560f1f6eba6717028b89089 (patch)
tree56930935b8f031e9c0466182e0eb9ed28ee222c4 /fs
parent4f18cd317a118c28482f97303600a2fe2ada6c79 (diff)
ocfs2: don't open-code kernel_sendmsg()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/cluster/tcp.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 2cd2406b4140..68d80c316381 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -940,33 +940,21 @@ static int o2net_send_tcp_msg(struct socket *sock, struct kvec *vec,
940 size_t veclen, size_t total) 940 size_t veclen, size_t total)
941{ 941{
942 int ret; 942 int ret;
943 mm_segment_t oldfs; 943 struct msghdr msg;
944 struct msghdr msg = {
945 .msg_iov = (struct iovec *)vec,
946 .msg_iovlen = veclen,
947 };
948 944
949 if (sock == NULL) { 945 if (sock == NULL) {
950 ret = -EINVAL; 946 ret = -EINVAL;
951 goto out; 947 goto out;
952 } 948 }
953 949
954 oldfs = get_fs(); 950 ret = kernel_sendmsg(sock, &msg, vec, veclen, total);
955 set_fs(get_ds()); 951 if (likely(ret == total))
956 ret = sock_sendmsg(sock, &msg, total); 952 return 0;
957 set_fs(oldfs); 953 mlog(ML_ERROR, "sendmsg returned %d instead of %zu\n", ret, total);
958 if (ret != total) { 954 if (ret >= 0)
959 mlog(ML_ERROR, "sendmsg returned %d instead of %zu\n", ret, 955 ret = -EPIPE; /* should be smarter, I bet */
960 total);
961 if (ret >= 0)
962 ret = -EPIPE; /* should be smarter, I bet */
963 goto out;
964 }
965
966 ret = 0;
967out: 956out:
968 if (ret < 0) 957 mlog(0, "returning error: %d\n", ret);
969 mlog(0, "returning error: %d\n", ret);
970 return ret; 958 return ret;
971} 959}
972 960