Skip to content
Snippets Groups Projects
Commit 01439917 authored by James Simmons's avatar James Simmons Committed by John L. Hammond
Browse files

LU-9558 lnet: kernel socket accept takes new bool agrument

During the development of the linux 4.11 kernel it was discovered
that the kernel socket layer could get into lockdep situation. To
handle this a new bool argument was added to the accept member
of struct socket. For LNet we can always pass false.

Lustre-commit: 15045c90
Lustre-change: https://review.whamcloud.com/27642



Change-Id: I420cda95b70cf927b1a6e3493b631bc5a3585d74
Signed-off-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/27642


Reviewed-by: default avatarDoug Oucharek <doug@cadentcomputing.com>
Reviewed-by: default avatarBob Glossman <bob.glossman@intel.com>
Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Reviewed-on: https://review.whamcloud.com/28463


Tested-by: Jenkins
Tested-by: default avatarMaloo <hpdd-maloo@intel.com>
Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
parent 875465b5
No related branches found
No related tags found
No related merge requests found
......@@ -734,6 +734,27 @@ LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
[kmap_to_page is exported by the kernel])])
]) # LN_EXPORT_KMAP_TO_PAG
#
# LN_CONFIG_SOCK_ACCEPT
#
# 4.11 commit cdfbabfb2f0ce983fdaa42f20e5f7842178fc01e added a flag
# to handle a possible lockdep condition kernel socket accept.
#
AC_DEFUN([LN_CONFIG_SOCK_ACCEPT], [
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
LB_CHECK_COMPILE([if 'struct sock' accept function requires a bool argument],
kern_sock_flag, [
#include <linux/net.h>
],[
((struct socket *)0)->ops->accept(NULL, NULL, O_NONBLOCK, false);
],[
AC_DEFINE(HAVE_KERN_SOCK_ACCEPT_FLAG_ARG, 1,
['struct sock' accept function requires bool argument])
])
EXTRA_KCFLAGS="$tmp_flags"
]) # LN_CONFIG_SOCK_ACCEPT
#
# LN_PROG_LINUX
#
......@@ -753,10 +774,12 @@ LN_CONFIG_SK_SLEEP
LN_CONFIG_TCP_SENDPAGE
# 3.10
LN_EXPORT_KMAP_TO_PAGE
# 4.x
LN_CONFIG_SOCK_CREATE_KERN
# 3.15
LN_CONFIG_SK_DATA_READY
# 4.x
LN_CONFIG_SOCK_CREATE_KERN
# 4.11
LN_CONFIG_SOCK_ACCEPT
]) # LN_PROG_LINUX
#
......
......@@ -582,7 +582,11 @@ lnet_sock_accept(struct socket **newsockp, struct socket *sock)
newsock->ops = sock->ops;
#ifdef HAVE_KERN_SOCK_ACCEPT_FLAG_ARG
rc = sock->ops->accept(sock, newsock, O_NONBLOCK, false);
#else
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
#endif
if (rc == -EAGAIN) {
/* Nothing ready, so wait for activity */
init_waitqueue_entry(&wait, current);
......@@ -590,7 +594,11 @@ lnet_sock_accept(struct socket **newsockp, struct socket *sock)
set_current_state(TASK_INTERRUPTIBLE);
schedule();
remove_wait_queue(sk_sleep(sock->sk), &wait);
#ifdef HAVE_KERN_SOCK_ACCEPT_FLAG_ARG
rc = sock->ops->accept(sock, newsock, O_NONBLOCK, false);
#else
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
#endif
}
if (rc != 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment