From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guoqing Jiang Date: Tue, 8 Aug 2017 09:31:18 +0800 Subject: [Cluster-devel] [PATCH] dlm: use sock_create_lite inside tcp_accept_from_sock In-Reply-To: <1953416834.39897494.1502133047028.JavaMail.zimbra@redhat.com> References: <20170807063120.13767-1-gqjiang@suse.com> <1304237737.39896960.1502132801360.JavaMail.zimbra@redhat.com> <1953416834.39897494.1502133047028.JavaMail.zimbra@redhat.com> Message-ID: <59891466.7040208@suse.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 08/08/2017 03:10 AM, Bob Peterson wrote: > | | Signed-off-by: Guoqing Jiang > | | --- > | | fs/dlm/lowcomms.c | 2 +- > | | 1 file changed, 1 insertion(+), 1 deletion(-) > | | > | | diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c > | | index 9382db9..4813d0e 100644 > | | --- a/fs/dlm/lowcomms.c > | | +++ b/fs/dlm/lowcomms.c > | | @@ -729,7 +729,7 @@ static int tcp_accept_from_sock(struct connection *con) > | | mutex_unlock(&connections_lock); > | | > | | memset(&peeraddr, 0, sizeof(peeraddr)); > | | - result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family, > | | + result = sock_create_lite(dlm_local_addr[0]->ss_family, > | | SOCK_STREAM, IPPROTO_TCP, &newsock); > | | if (result < 0) > | | return -ENOMEM; > | > | Isn't this also a problem for the sctp equivalent, sctp_connect_to_sock? > | > | Regards, > | > | Bob Peterson > | Red Hat File Systems > | > > In fact, I see 5 different calls to sock_create_kern in DLM. > Shouldn't it be done to all of them? Only this one called accept immediately after the socket is created, so others probably are safe. Plus, the sock is used after sock_create_kern, so I am not sure it can be replaced with sock_create_lite. result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family, SOCK_STREAM, IPPROTO_SCTP, &sock); ... sock->sk->sk_user_data = con; > One could also argue that sock_create_kern should itself be fixed, > not its callers. Pls see https://patchwork.ozlabs.org/patch/780356/ for more infos. Thanks, GUoqing