提交 2f2d76cc 编写于 作者: B Benjamin Poirier 提交者: David S. Miller

dlm: Do not allocate a fd for peeloff

avoids allocating a fd that a) propagates to every kernel thread and
usermodehelper b) is not properly released.

References: http://article.gmane.org/gmane.linux.network.drbd/22529Signed-off-by: NBenjamin Poirier <bpoirier@suse.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0343c554
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/sctp.h> #include <linux/sctp.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <net/sctp/sctp.h>
#include <net/sctp/user.h> #include <net/sctp/user.h>
#include <net/ipv6.h> #include <net/ipv6.h>
...@@ -474,9 +475,6 @@ static void process_sctp_notification(struct connection *con, ...@@ -474,9 +475,6 @@ static void process_sctp_notification(struct connection *con,
int prim_len, ret; int prim_len, ret;
int addr_len; int addr_len;
struct connection *new_con; struct connection *new_con;
sctp_peeloff_arg_t parg;
int parglen = sizeof(parg);
int err;
/* /*
* We get this before any data for an association. * We get this before any data for an association.
...@@ -525,23 +523,19 @@ static void process_sctp_notification(struct connection *con, ...@@ -525,23 +523,19 @@ static void process_sctp_notification(struct connection *con,
return; return;
/* Peel off a new sock */ /* Peel off a new sock */
parg.associd = sn->sn_assoc_change.sac_assoc_id; sctp_lock_sock(con->sock->sk);
ret = kernel_getsockopt(con->sock, IPPROTO_SCTP, ret = sctp_do_peeloff(con->sock->sk,
SCTP_SOCKOPT_PEELOFF, sn->sn_assoc_change.sac_assoc_id,
(void *)&parg, &parglen); &new_con->sock);
sctp_release_sock(con->sock->sk);
if (ret < 0) { if (ret < 0) {
log_print("Can't peel off a socket for " log_print("Can't peel off a socket for "
"connection %d to node %d: err=%d", "connection %d to node %d: err=%d",
parg.associd, nodeid, ret); (int)sn->sn_assoc_change.sac_assoc_id,
return; nodeid, ret);
}
new_con->sock = sockfd_lookup(parg.sd, &err);
if (!new_con->sock) {
log_print("sockfd_lookup error %d", err);
return; return;
} }
add_sock(new_con->sock, new_con); add_sock(new_con->sock, new_con);
sockfd_put(new_con->sock);
log_print("connecting to %d sctp association %d", log_print("connecting to %d sctp association %d",
nodeid, (int)sn->sn_assoc_change.sac_assoc_id); nodeid, (int)sn->sn_assoc_change.sac_assoc_id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册