* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2015, Intel Corporation.
+ * Copyright (c) 2015, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
int fd = -1;
int rc;
- rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
+#ifdef HAVE_SOCK_CREATE_KERN_USE_NET
+ rc = sock_create_kern(&init_net, PF_INET, SOCK_STREAM, 0, &sock);
+#else
+ rc = sock_create_kern(PF_INET, SOCK_STREAM, 0, &sock);
+#endif
if (rc != 0) {
CERROR("Can't create socket: %d\n", rc);
return rc;
/* All errors are fatal except bind failure if the port is in use */
*fatal = 1;
- rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
+#ifdef HAVE_SOCK_CREATE_KERN_USE_NET
+ rc = sock_create_kern(&init_net, PF_INET, SOCK_STREAM, 0, &sock);
+#else
+ rc = sock_create_kern(PF_INET, SOCK_STREAM, 0, &sock);
+#endif
*sockp = sock;
if (rc != 0) {
CERROR("Can't create socket: %d\n", rc);
int
lnet_sock_accept(struct socket **newsockp, struct socket *sock)
{
- wait_queue_t wait;
+ wait_queue_entry_t wait;
struct socket *newsock;
int rc;
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);
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)