[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200513062649.2100053-28-hch@lst.de>
Date: Wed, 13 May 2020 08:26:42 +0200
From: Christoph Hellwig <hch@....de>
To: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: Eric Dumazet <edumazet@...gle.com>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Vlad Yasevich <vyasevich@...il.com>,
Neil Horman <nhorman@...driver.com>,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
Jon Maloy <jmaloy@...hat.com>,
Ying Xue <ying.xue@...driver.com>, drbd-dev@...ts.linbit.com,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-nvme@...ts.infradead.org,
target-devel@...r.kernel.org, linux-afs@...ts.infradead.org,
linux-cifs@...r.kernel.org, cluster-devel@...hat.com,
ocfs2-devel@....oracle.com, netdev@...r.kernel.org,
linux-sctp@...r.kernel.org, ceph-devel@...r.kernel.org,
rds-devel@....oracle.com, linux-nfs@...r.kernel.org
Subject: [PATCH 27/33] sctp: export sctp_setsockopt_bindx
And call it directly from dlm instead of going through kernel_setsockopt.
Signed-off-by: Christoph Hellwig <hch@....de>
---
fs/dlm/lowcomms.c | 13 ++++++++-----
include/net/sctp/sctp.h | 3 +++
net/sctp/socket.c | 5 +++--
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index b722a09a7ca05..e4939d770df53 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1005,14 +1005,17 @@ static int sctp_bind_addrs(struct connection *con, uint16_t port)
memcpy(&localaddr, dlm_local_addr[i], sizeof(localaddr));
make_sockaddr(&localaddr, port, &addr_len);
- if (!i)
+ if (!i) {
result = kernel_bind(con->sock,
(struct sockaddr *)&localaddr,
addr_len);
- else
- result = kernel_setsockopt(con->sock, SOL_SCTP,
- SCTP_SOCKOPT_BINDX_ADD,
- (char *)&localaddr, addr_len);
+ } else {
+ lock_sock(con->sock->sk);
+ result = sctp_setsockopt_bindx(con->sock->sk,
+ (struct sockaddr *)&localaddr, addr_len,
+ SCTP_BINDX_ADD_ADDR);
+ release_sock(con->sock->sk);
+ }
if (result < 0) {
log_print("Can't bind to %d addr number %d, %d.\n",
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 3ab5c6bbb90bd..f702b14d768ba 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -615,4 +615,7 @@ static inline bool sctp_newsk_ready(const struct sock *sk)
return sock_flag(sk, SOCK_DEAD) || sk->sk_socket;
}
+int sctp_setsockopt_bindx(struct sock *sk, struct sockaddr *kaddrs,
+ int addrs_size, int op);
+
#endif /* __net_sctp_h__ */
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 1c96b52c4aa28..30c981d9f6158 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -979,8 +979,8 @@ int sctp_asconf_mgmt(struct sctp_sock *sp, struct sctp_sockaddr_entry *addrw)
*
* Returns 0 if ok, <0 errno code on error.
*/
-static int sctp_setsockopt_bindx(struct sock *sk, struct sockaddr *kaddrs,
- int addrs_size, int op)
+int sctp_setsockopt_bindx(struct sock *sk, struct sockaddr *kaddrs,
+ int addrs_size, int op)
{
int err;
int addrcnt = 0;
@@ -1032,6 +1032,7 @@ static int sctp_setsockopt_bindx(struct sock *sk, struct sockaddr *kaddrs,
return -EINVAL;
}
}
+EXPORT_SYMBOL(sctp_setsockopt_bindx);
static int sctp_connect_new_asoc(struct sctp_endpoint *ep,
const union sctp_addr *daddr,
--
2.26.2
Powered by blists - more mailing lists