Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Disable rt_update mechanism by default
details: https://anonhg.NetBSD.org/src/rev/ee4cbb2658eb
branches: trunk
changeset: 350749:ee4cbb2658eb
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Jan 19 06:58:55 2017 +0000
description:
Disable rt_update mechanism by default
This is a workaround for PR kern/51877. Enable again once the issue
is fixed.
diffstat:
sys/net/route.c | 18 ++++++++++++++++--
sys/net/rtsock.c | 9 +++++++--
2 files changed, 23 insertions(+), 4 deletions(-)
diffs (147 lines):
diff -r 5045bce22956 -r ee4cbb2658eb sys/net/route.c
--- a/sys/net/route.c Thu Jan 19 06:56:33 2017 +0000
+++ b/sys/net/route.c Thu Jan 19 06:58:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.187 2017/01/17 07:53:06 ozaki-r Exp $ */
+/* $NetBSD: route.c,v 1.188 2017/01/19 06:58:55 ozaki-r Exp $ */
/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.187 2017/01/17 07:53:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.188 2017/01/19 06:58:55 ozaki-r Exp $");
#include <sys/param.h>
#ifdef RTFLUSH_DEBUG
@@ -288,7 +288,9 @@
static void rtcache_ref(struct rtentry *, struct route *);
+#ifdef NET_MPSAFE
static void rt_update_wait(void);
+#endif
static bool rt_wait_ok(void);
static void rt_wait_refcnt(const char *, struct rtentry *, int);
@@ -561,7 +563,9 @@
struct rtentry *rt;
int s;
+#ifdef NET_MPSAFE
retry:
+#endif
s = splsoftnet();
rtbl = rt_gettable(dst->sa_family);
if (rtbl == NULL)
@@ -574,6 +578,7 @@
if (!ISSET(rt->rt_flags, RTF_UP))
goto miss;
+#ifdef NET_MPSAFE
if (ISSET(rt->rt_flags, RTF_UPDATING) &&
/* XXX updater should be always able to acquire */
curlwp != rt_update_global.lwp) {
@@ -596,6 +601,7 @@
RTCACHE_WLOCK();
goto retry;
}
+#endif /* NET_MPSAFE */
rt_ref(rt);
RT_REFCNT_TRACE(rt);
@@ -689,7 +695,9 @@
* Need to avoid a deadlock on rt_wait_refcnt of update
* and a conflict on psref_target_destroy of update.
*/
+#ifdef NET_MPSAFE
rt_update_wait();
+#endif
RT_REFCNT_TRACE(rt);
KASSERTMSG(rt->rt_refcnt >= 0, "refcnt=%d", rt->rt_refcnt);
@@ -755,6 +763,7 @@
}
}
+#ifdef NET_MPSAFE
static void
rt_update_wait(void)
{
@@ -767,6 +776,7 @@
}
mutex_exit(&rt_update_global.lock);
}
+#endif
int
rt_update_prepare(struct rtentry *rt)
@@ -1964,7 +1974,9 @@
{
struct rtentry *rt = NULL;
+#ifdef NET_MPSAFE
retry:
+#endif
rt = ro->_ro_rt;
rtcache_invariants(ro);
@@ -1975,6 +1987,7 @@
RT_RLOCK();
if (rt != NULL && (rt->rt_flags & RTF_UP) != 0 && rt->rt_ifp != NULL) {
+#ifdef NET_MPSAFE
if (ISSET(rt->rt_flags, RTF_UPDATING)) {
if (rt_wait_ok()) {
RT_UNLOCK();
@@ -1987,6 +2000,7 @@
rt = NULL;
}
} else
+#endif
rtcache_ref(rt, ro);
} else
rt = NULL;
diff -r 5045bce22956 -r ee4cbb2658eb sys/net/rtsock.c
--- a/sys/net/rtsock.c Thu Jan 19 06:56:33 2017 +0000
+++ b/sys/net/rtsock.c Thu Jan 19 06:58:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock.c,v 1.199 2016/12/12 03:55:57 ozaki-r Exp $ */
+/* $NetBSD: rtsock.c,v 1.200 2017/01/19 06:58:55 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,13 +61,14 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.199 2016/12/12 03:55:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.200 2017/01/19 06:58:55 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
#include "opt_mpls.h"
#include "opt_compat_netbsd.h"
#include "opt_sctp.h"
+#include "opt_net_mpsafe.h"
#endif
#include <sys/param.h>
@@ -887,11 +888,15 @@
break;
case RTM_CHANGE:
+#ifdef NET_MPSAFE
error = rt_update_prepare(rt);
if (error == 0) {
error = route_output_change(rt, &info, rtm);
rt_update_finish(rt);
}
+#else
+ error = route_output_change(rt, &info, rtm);
+#endif
if (error != 0)
goto flush;
/*FALLTHROUGH*/
Home |
Main Index |
Thread Index |
Old Index