From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: netdev@vger.kernel.org
Cc: Neil Horman <nhorman@tuxdriver.com>,
Vlad Yasevich <vyasevich@gmail.com>,
linux-sctp@vger.kernel.org
Subject: [RFC PATCH 2/2] dlm: avoid using sctp_do_peeloff directly
Date: Tue, 16 Jun 2015 19:42:33 -0300 [thread overview]
Message-ID: <4a1e9e2f82a49135a5bd16cfe92a242572979cd6.1434492495.git.marcelo.leitner@gmail.com> (raw)
In-Reply-To: <cover.1434492495.git.marcelo.leitner@gmail.com>
This patch reverts 2f2d76cc3e93 ("dlm: Do not allocate a fd for
peeloff") but also makes use of a new sockopt:
SCTP_SOCKOPT_PEELOFF_KERNEL, which avoids allocating file descriptors
while doing this operation.
By this we avoid creating a direct dependency from dlm to sctp module,
which can then be left unloaded if dlm is not really using it.
Note that this was preferred other than a module split as it once was
split and was merged back in 2007 by commit 6ed7257b4670 ("[DLM]
Consolidate transport protocols") so that we don't revert it.
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
fs/dlm/lowcomms.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 754fd6c0b7470bab272b071e6ca6e4969e4e4209..aa50131e51ceaf2d56cc2252fe6c0c17b80af769 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -52,7 +52,6 @@
#include <linux/mutex.h>
#include <linux/sctp.h>
#include <linux/slab.h>
-#include <net/sctp/sctp.h>
#include <net/ipv6.h>
#include "dlm_internal.h"
@@ -671,6 +670,8 @@ static void process_sctp_notification(struct connection *con,
int prim_len, ret;
int addr_len;
struct connection *new_con;
+ sctp_peeloff_kernel_arg_t parg;
+ int parglen = sizeof(parg);
/*
* We get this before any data for an association.
@@ -719,19 +720,17 @@ static void process_sctp_notification(struct connection *con,
return;
/* Peel off a new sock */
- lock_sock(con->sock->sk);
- ret = sctp_do_peeloff(con->sock->sk,
- sn->sn_assoc_change.sac_assoc_id,
- &new_con->sock);
- release_sock(con->sock->sk);
+ parg.associd = sn->sn_assoc_change.sac_assoc_id;
+ ret = kernel_getsockopt(con->sock, IPPROTO_SCTP,
+ SCTP_SOCKOPT_PEELOFF_KERNEL,
+ (void *)&parg, &parglen);
if (ret < 0) {
log_print("Can't peel off a socket for "
"connection %d to node %d: err=%d",
- (int)sn->sn_assoc_change.sac_assoc_id,
- nodeid, ret);
+ parg.associd, nodeid, ret);
return;
}
- add_sock(new_con->sock, new_con);
+ add_sock(parg.socket, new_con);
linger.l_onoff = 1;
linger.l_linger = 0;
--
2.4.1
next prev parent reply other threads:[~2015-06-16 22:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-16 22:42 [RFC PATCH 0/2] sctp: add new getsockopt option SCTP_SOCKOPT_PEELOFF_KERNEL Marcelo Ricardo Leitner
2015-06-16 22:42 ` [RFC PATCH 1/2] " Marcelo Ricardo Leitner
2015-06-16 22:42 ` Marcelo Ricardo Leitner [this message]
2015-06-17 10:21 ` [RFC PATCH 0/2] " Neil Horman
2015-06-17 11:38 ` Marcelo Ricardo Leitner
2015-06-17 12:20 ` Neil Horman
2015-06-17 12:40 ` Marcelo Ricardo Leitner
2015-06-17 13:16 ` Neil Horman
2015-06-17 13:40 ` Marcelo Ricardo Leitner
2015-06-17 18:45 ` Neil Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4a1e9e2f82a49135a5bd16cfe92a242572979cd6.1434492495.git.marcelo.leitner@gmail.com \
--to=marcelo.leitner@gmail.com \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=vyasevich@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).