Source-Changes-HG archive

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

[src/trunk]: src/sys/net Call pserialize_perform and psref_target_destroy onl...



details:   https://anonhg.NetBSD.org/src/rev/c5e64916e224
branches:  trunk
changeset: 350819:c5e64916e224
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Jan 23 02:32:54 2017 +0000

description:
Call pserialize_perform and psref_target_destroy only if NET_MPSAFE

They shouldn't be used with holding softnet_lock.

diffstat:

 sys/net/pfil.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r 337418b064fa -r c5e64916e224 sys/net/pfil.c
--- a/sys/net/pfil.c    Mon Jan 23 02:30:47 2017 +0000
+++ b/sys/net/pfil.c    Mon Jan 23 02:32:54 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.c,v 1.33 2017/01/23 02:30:47 ozaki-r Exp $        */
+/*     $NetBSD: pfil.c,v 1.34 2017/01/23 02:32:54 ozaki-r Exp $        */
 
 /*
  * Copyright (c) 2013 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -28,7 +28,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.33 2017/01/23 02:30:47 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.34 2017/01/23 02:32:54 ozaki-r Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_net_mpsafe.h"
+#endif
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -230,11 +234,15 @@
        /* switch from oldlist to newlist */
        phlistset->active = newlist;
        membar_producer();
+#ifdef NET_MPSAFE
        pserialize_perform(pfil_psz);
+#endif
        mutex_exit(&pfil_mtx);
 
        /* Wait for all readers */
+#ifdef NET_MPSAFE
        psref_target_destroy(&oldlist->psref, pfil_psref_class);
+#endif
 
        return 0;
 }
@@ -330,11 +338,15 @@
                /* switch from oldlist to newlist */
                phlistset->active = newlist;
                membar_producer();
+#ifdef NET_MPSAFE
                pserialize_perform(pfil_psz);
+#endif
                mutex_exit(&pfil_mtx);
 
                /* Wait for all readers */
+#ifdef NET_MPSAFE
                psref_target_destroy(&oldlist->psref, pfil_psref_class);
+#endif
 
                return 0;
        }



Home | Main Index | Thread Index | Old Index