Module Name:    src
Committed By:   snj
Date:           Fri Nov 17 20:26:19 UTC 2017

Modified Files:
        src/sys/netinet6 [netbsd-8]: in6_ifattach.c nd6.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #354):
        sys/netinet6/in6_ifattach.c: revision 1.113
        sys/netinet6/nd6.c: revision 1.238
Use psref instead of pserialize because that code is sleepable
--
Use psref instead of pserialize because that code is sleepable


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.112.6.1 src/sys/netinet6/in6_ifattach.c
cvs rdiff -u -r1.232.2.3 -r1.232.2.4 src/sys/netinet6/nd6.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/in6_ifattach.c
diff -u src/sys/netinet6/in6_ifattach.c:1.112 src/sys/netinet6/in6_ifattach.c:1.112.6.1
--- src/sys/netinet6/in6_ifattach.c:1.112	Thu Feb 23 07:57:10 2017
+++ src/sys/netinet6/in6_ifattach.c	Fri Nov 17 20:26:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_ifattach.c,v 1.112 2017/02/23 07:57:10 ozaki-r Exp $	*/
+/*	$NetBSD: in6_ifattach.c,v 1.112.6.1 2017/11/17 20:26:19 snj Exp $	*/
 /*	$KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.112 2017/02/23 07:57:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.112.6.1 2017/11/17 20:26:19 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -787,13 +787,15 @@ in6_ifattach(struct ifnet *ifp, struct i
 	 */
 	if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) &&
 	    ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) {
-		int s = pserialize_read_enter();
-		ia = in6ifa_ifpforlinklocal(ifp, 0);
+		int bound = curlwp_bind();
+		struct psref psref;
+		ia = in6ifa_ifpforlinklocal_psref(ifp, 0, &psref);
 		if (ia == NULL && in6_ifattach_linklocal(ifp, altifp) != 0) {
 			printf("%s: cannot assign link-local address\n",
 			    ifp->if_xname);
 		}
-		pserialize_read_exit(s);
+		ia6_release(ia, &psref);
+		curlwp_bindx(bound);
 	}
 }
 

Index: src/sys/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.232.2.3 src/sys/netinet6/nd6.c:1.232.2.4
--- src/sys/netinet6/nd6.c:1.232.2.3	Fri Nov 17 20:24:05 2017
+++ src/sys/netinet6/nd6.c	Fri Nov 17 20:26:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.232.2.3 2017/11/17 20:24:05 snj Exp $	*/
+/*	$NetBSD: nd6.c,v 1.232.2.4 2017/11/17 20:26:19 snj Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.232.2.3 2017/11/17 20:24:05 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.232.2.4 2017/11/17 20:26:19 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1446,7 +1446,7 @@ nd6_rtrequest(int req, struct rtentry *r
 
 	switch (req) {
 	case RTM_ADD: {
-		int s;
+		struct psref psref;
 
 		RT_DPRINTF("rt_getkey(rt) = %p\n", rt_getkey(rt));
 		/*
@@ -1554,9 +1554,8 @@ nd6_rtrequest(int req, struct rtentry *r
 		 * check if rt_getkey(rt) is an address assigned
 		 * to the interface.
 		 */
-		s = pserialize_read_enter();
-		ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp,
-		    &satocsin6(rt_getkey(rt))->sin6_addr);
+		ifa = (struct ifaddr *)in6ifa_ifpwithaddr_psref(ifp,
+		    &satocsin6(rt_getkey(rt))->sin6_addr, &psref);
 		if (ifa != NULL) {
 			if (nd6_useloopback) {
 				rt->rt_ifp = lo0ifp;	/* XXX */
@@ -1593,7 +1592,7 @@ nd6_rtrequest(int req, struct rtentry *r
 			}
 		}
 	out:
-		pserialize_read_exit(s);
+		ifa_release(ifa, &psref);
 		/*
 		 * If we have too many cache entries, initiate immediate
 		 * purging for some entries.

Reply via email to