summaryrefslogtreecommitdiff
path: root/fs/dlm
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-29 14:09:40 +0200
committerDavid S. Miller <davem@davemloft.net>2020-05-29 13:10:39 -0700
commit40ef92c6ec09bd8aaffccfa41a715d1df5625f95 (patch)
tree23f65f7f76323bef1a6110720ae0c97725fff893 /fs/dlm
parentf26e9b2c0bf3a7a515b2e92763182bcd81628a5f (diff)
downloadlwn-40ef92c6ec09bd8aaffccfa41a715d1df5625f95.tar.gz
lwn-40ef92c6ec09bd8aaffccfa41a715d1df5625f95.zip
sctp: add sctp_sock_set_nodelay
Add a helper to directly set the SCTP_NODELAY sockopt from kernel space without going through a fake uaccess. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/dlm')
-rw-r--r--fs/dlm/lowcomms.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 69333728d871..9f1c3cdc9d65 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -914,7 +914,6 @@ static int sctp_bind_addrs(struct connection *con, uint16_t port)
static void sctp_connect_to_sock(struct connection *con)
{
struct sockaddr_storage daddr;
- int one = 1;
int result;
int addr_len;
struct socket *sock;
@@ -961,8 +960,7 @@ static void sctp_connect_to_sock(struct connection *con)
log_print("connecting to %d", con->nodeid);
/* Turn off Nagle's algorithm */
- kernel_setsockopt(sock, SOL_SCTP, SCTP_NODELAY, (char *)&one,
- sizeof(one));
+ sctp_sock_set_nodelay(sock->sk);
/*
* Make sock->ops->connect() function return in specified time,
@@ -1176,7 +1174,6 @@ static int sctp_listen_for_all(void)
struct socket *sock = NULL;
int result = -EINVAL;
struct connection *con = nodeid2con(0, GFP_NOFS);
- int one = 1;
if (!con)
return -ENOMEM;
@@ -1191,10 +1188,7 @@ static int sctp_listen_for_all(void)
}
sock_set_rcvbuf(sock->sk, NEEDED_RMEM);
- result = kernel_setsockopt(sock, SOL_SCTP, SCTP_NODELAY, (char *)&one,
- sizeof(one));
- if (result < 0)
- log_print("Could not set SCTP NODELAY error %d\n", result);
+ sctp_sock_set_nodelay(sock->sk);
write_lock_bh(&sock->sk->sk_callback_lock);
/* Init con struct */