summaryrefslogtreecommitdiffstats
path: root/fs/dlm
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-28 07:12:09 +0200
committerDavid S. Miller <davem@davemloft.net>2020-05-28 20:11:44 +0200
commitb58f0e8f38c0a44afa59601a115bd231f23471e1 (patch)
tree591622253553216fe2635b360b4f31a62636226b /fs/dlm
parentMerge tag 'mlx5-updates-2020-05-26' of git://git.kernel.org/pub/scm/linux/ker... (diff)
downloadlinux-b58f0e8f38c0a44afa59601a115bd231f23471e1.tar.xz
linux-b58f0e8f38c0a44afa59601a115bd231f23471e1.zip
net: add sock_set_reuseaddr
Add a helper to directly set the SO_REUSEADDR sockopt from kernel space without going through a fake uaccess. For this the iscsi target now has to formally depend on inet to avoid a mostly theoretical compile failure. For actual operation it already did depend on having ipv4 or ipv6 support. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/dlm')
-rw-r--r--fs/dlm/lowcomms.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index f13dad0fd9ef..88f2574ca63a 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1127,12 +1127,8 @@ static struct socket *tcp_create_listen_sock(struct connection *con,
kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, (char *)&one,
sizeof(one));
- result = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
- (char *)&one, sizeof(one));
+ sock_set_reuseaddr(sock->sk);
- if (result < 0) {
- log_print("Failed to set SO_REUSEADDR on socket: %d", result);
- }
write_lock_bh(&sock->sk->sk_callback_lock);
sock->sk->sk_user_data = con;
save_listen_callbacks(sock);