Source-Changes-HG archive

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

[src/trunk]: src/sys/net Do psref_target_destroy after purging packets



details:   https://anonhg.NetBSD.org/src/rev/a0f1f5eb6225
branches:  trunk
changeset: 346030:a0f1f5eb6225
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Jun 20 06:41:30 2016 +0000

description:
Do psref_target_destroy after purging packets

Because purging packets may try to send packets, which requires psref yet.

diffstat:

 sys/net/if.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 021984f91df3 -r a0f1f5eb6225 sys/net/if.c
--- a/sys/net/if.c      Mon Jun 20 06:41:15 2016 +0000
+++ b/sys/net/if.c      Mon Jun 20 06:41:30 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.341 2016/06/16 15:18:33 riastradh Exp $       */
+/*     $NetBSD: if.c,v 1.342 2016/06/20 06:41:30 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.341 2016/06/16 15:18:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.342 2016/06/20 06:41:30 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1054,10 +1054,6 @@
        pserialize_perform(ifnet_psz);
        IFNET_UNLOCK();
 
-       /* Wait for all readers to drain before freeing.  */
-       psref_target_destroy(&ifp->if_psref, ifnet_psref_class);
-       PSLIST_ENTRY_DESTROY(ifp, if_pslist_entry);
-
        mutex_obj_free(ifp->if_ioctl_lock);
        ifp->if_ioctl_lock = NULL;
 
@@ -1226,6 +1222,10 @@
        xc = xc_broadcast(0, (xcfunc_t)nullop, NULL, NULL);
        xc_wait(xc);
 
+       /* Wait for all readers to drain before freeing.  */
+       psref_target_destroy(&ifp->if_psref, ifnet_psref_class);
+       PSLIST_ENTRY_DESTROY(ifp, if_pslist_entry);
+
        if (ifp->if_percpuq != NULL) {
                if_percpuq_destroy(ifp->if_percpuq);
                ifp->if_percpuq = NULL;



Home | Main Index | Thread Index | Old Index