Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 Use psref instead of pserialize because that co...



details:   https://anonhg.NetBSD.org/src/rev/28ef52acfca2
branches:  trunk
changeset: 827727:28ef52acfca2
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Nov 10 07:25:39 2017 +0000

description:
Use psref instead of pserialize because that code is sleepable

diffstat:

 sys/netinet6/in6_ifattach.c |  12 +++++++-----
 sys/netinet6/nd6.c          |  13 ++++++-------
 2 files changed, 13 insertions(+), 12 deletions(-)

diffs (85 lines):

diff -r 0ada6d402f46 -r 28ef52acfca2 sys/netinet6/in6_ifattach.c
--- a/sys/netinet6/in6_ifattach.c       Fri Nov 10 07:24:28 2017 +0000
+++ b/sys/netinet6/in6_ifattach.c       Fri Nov 10 07:25:39 2017 +0000
@@ -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.113 2017/11/10 07:27:57 ozaki-r 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.113 2017/11/10 07:27:57 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -787,13 +787,15 @@
         */
        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);
        }
 }
 
diff -r 0ada6d402f46 -r 28ef52acfca2 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Fri Nov 10 07:24:28 2017 +0000
+++ b/sys/netinet6/nd6.c        Fri Nov 10 07:25:39 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.c,v 1.237 2017/11/10 07:24:28 ozaki-r Exp $        */
+/*     $NetBSD: nd6.c,v 1.238 2017/11/10 07:25:39 ozaki-r 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.237 2017/11/10 07:24:28 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.238 2017/11/10 07:25:39 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1446,7 +1446,7 @@
 
        switch (req) {
        case RTM_ADD: {
-               int s;
+               struct psref psref;
 
                RT_DPRINTF("rt_getkey(rt) = %p\n", rt_getkey(rt));
                /*
@@ -1554,9 +1554,8 @@
                 * 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 @@
                        }
                }
        out:
-               pserialize_read_exit(s);
+               ifa_release(ifa, &psref);
                /*
                 * If we have too many cache entries, initiate immediate
                 * purging for some entries.



Home | Main Index | Thread Index | Old Index