Now that NET_LOCK() does not take any argument, we can use it everywhere. ok?
Index: net/if_pppx.c =================================================================== RCS file: /cvs/src/sys/net/if_pppx.c,v retrieving revision 1.62 diff -u -p -r1.62 if_pppx.c --- net/if_pppx.c 11 Aug 2017 21:24:19 -0000 1.62 +++ net/if_pppx.c 11 Aug 2017 22:52:53 -0000 @@ -855,9 +855,9 @@ pppx_add_session(struct pppx_dev *pxd, s pipex_timer_start(); /* XXXSMP breaks atomicity */ - rw_exit_write(&netlock); + NET_UNLOCK(); if_attach(ifp); - rw_enter_write(&netlock); + NET_LOCK(); if_addgroup(ifp, "pppx"); if_alloc_sadl(ifp); @@ -970,9 +970,9 @@ pppx_if_destroy(struct pppx_dev *pxd, st pipex_timer_stop(); /* XXXSMP breaks atomicity */ - rw_exit_write(&netlock); + NET_UNLOCK(); if_detach(ifp); - rw_enter_write(&netlock); + NET_LOCK(); rw_enter_write(&pppx_ifs_lk); if (RBT_REMOVE(pppx_ifs, &pppx_ifs, pxi) == NULL) Index: net/if.c =================================================================== RCS file: /cvs/src/sys/net/if.c,v retrieving revision 1.510 diff -u -p -r1.510 if.c --- net/if.c 11 Aug 2017 21:24:19 -0000 1.510 +++ net/if.c 11 Aug 2017 21:47:38 -0000 @@ -1176,9 +1176,9 @@ if_clone_create(const char *name, int rd return (EEXIST); /* XXXSMP breaks atomicity */ - rw_exit_write(&netlock); + NET_UNLOCK(); ret = (*ifc->ifc_create)(ifc, unit); - rw_enter_write(&netlock); + NET_LOCK(); if (ret != 0 || (ifp = ifunit(name)) == NULL) return (ret); @@ -1221,9 +1221,9 @@ if_clone_destroy(const char *name) } /* XXXSMP breaks atomicity */ - rw_exit_write(&netlock); + NET_UNLOCK(); ret = (*ifc->ifc_destroy)(ifp); - rw_enter_write(&netlock); + NET_LOCK(); return (ret); } Index: net/if_pflow.c =================================================================== RCS file: /cvs/src/sys/net/if_pflow.c,v retrieving revision 1.82 diff -u -p -r1.82 if_pflow.c --- net/if_pflow.c 11 Aug 2017 21:24:19 -0000 1.82 +++ net/if_pflow.c 11 Aug 2017 22:53:56 -0000 @@ -527,12 +527,11 @@ pflowioctl(struct ifnet *ifp, u_long cmd return (error); /* XXXSMP breaks atomicity */ - rw_exit_write(&netlock); + NET_UNLOCK(); error = pflow_set(sc, &pflowr); - if (error != 0) { - rw_enter_write(&netlock); + NET_LOCK(); + if (error != 0) return (error); - } if ((ifp->if_flags & IFF_UP) && sc->so != NULL) { ifp->if_flags |= IFF_RUNNING; @@ -542,7 +541,6 @@ pflowioctl(struct ifnet *ifp, u_long cmd } else ifp->if_flags &= ~IFF_RUNNING; - rw_enter_write(&netlock); break; default: Index: uvm/uvm_vnode.c =================================================================== RCS file: /cvs/src/sys/uvm/uvm_vnode.c,v retrieving revision 1.97 diff -u -p -r1.97 uvm_vnode.c --- uvm/uvm_vnode.c 15 May 2017 12:26:00 -0000 1.97 +++ uvm/uvm_vnode.c 11 Aug 2017 21:31:53 -0000 @@ -1183,7 +1183,7 @@ uvn_io(struct uvm_vnode *uvn, vm_page_t * faulted in copyin() or copyout() in the network stack. */ if (netlocked) - rw_exit_write(&netlock); + NET_UNLOCK(); /* NOTE: vnode now locked! */ if (rw == UIO_READ) @@ -1194,7 +1194,7 @@ uvn_io(struct uvm_vnode *uvn, vm_page_t curproc->p_ucred); if (netlocked) - rw_enter_write(&netlock); + NET_LOCK(); if ((uvn->u_flags & UVM_VNODE_VNISLOCKED) == 0) VOP_UNLOCK(vn, curproc);