Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by ozaki...
details: https://anonhg.NetBSD.org/src/rev/f66f9530f0c5
branches: netbsd-8
changeset: 434034:f66f9530f0c5
user: snj <snj%NetBSD.org@localhost>
date: Sun Jun 25 06:31:58 2017 +0000
description:
Pull up following revision(s) (requested by ozaki-r in ticket #57):
sys/net/route.c: revision 1.195
Fix locking in rtalloc1 (affected only if NET_MPSAFE)
diffstat:
sys/net/route.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diffs (75 lines):
diff -r 1964edf86ce7 -r f66f9530f0c5 sys/net/route.c
--- a/sys/net/route.c Sun Jun 25 06:29:25 2017 +0000
+++ b/sys/net/route.c Sun Jun 25 06:31:58 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.194 2017/03/24 03:45:02 ozaki-r Exp $ */
+/* $NetBSD: route.c,v 1.194.6.1 2017/06/25 06:31:58 snj 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.194 2017/03/24 03:45:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.194.6.1 2017/06/25 06:31:58 snj Exp $");
#include <sys/param.h>
#ifdef RTFLUSH_DEBUG
@@ -280,7 +280,7 @@
static void rt_ref(struct rtentry *);
static struct rtentry *
- rtalloc1_locked(const struct sockaddr *, int, bool);
+ rtalloc1_locked(const struct sockaddr *, int, bool, bool);
static struct rtentry *
rtcache_validate_locked(struct route *);
static void rtcache_free_locked(struct route *);
@@ -557,7 +557,8 @@
* will be incremented. The caller has to rtfree it by itself.
*/
struct rtentry *
-rtalloc1_locked(const struct sockaddr *dst, int report, bool wait_ok)
+rtalloc1_locked(const struct sockaddr *dst, int report, bool wait_ok,
+ bool wlock)
{
rtbl_t *rtbl;
struct rtentry *rt;
@@ -599,6 +600,10 @@
if (need_lock)
RTCACHE_WLOCK();
+ if (wlock)
+ RT_WLOCK();
+ else
+ RT_RLOCK();
goto retry;
}
#endif /* NET_MPSAFE */
@@ -627,7 +632,7 @@
struct rtentry *rt;
RT_RLOCK();
- rt = rtalloc1_locked(dst, report, true);
+ rt = rtalloc1_locked(dst, report, true, false);
RT_UNLOCK();
return rt;
@@ -1026,7 +1031,7 @@
/* XXX we cannot call rtalloc1 if holding the rt lock */
if (RT_LOCKED())
- rt = rtalloc1_locked(gateway, 0, true);
+ rt = rtalloc1_locked(gateway, 0, true, true);
else
rt = rtalloc1(gateway, 0);
if (rt == NULL)
@@ -1387,7 +1392,7 @@
/* XXX we cannot call rtalloc1 if holding the rt lock */
if (RT_LOCKED())
- gwrt = rtalloc1_locked(gate, 1, false);
+ gwrt = rtalloc1_locked(gate, 1, false, true);
else
gwrt = rtalloc1(gate, 1);
/*
Home |
Main Index |
Thread Index |
Old Index