Date: Thu, 15 Sep 2005 19:40:59 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 83692 for review Message-ID: <200509151940.j8FJexac009989@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=83692 Change 83692 by jhb@jhb_slimer on 2005/09/15 19:40:43 IFC @83690. Affected files ... .. //depot/projects/smpng/sys/alpha/include/atomic.h#31 integrate .. //depot/projects/smpng/sys/amd64/include/atomic.h#27 integrate .. //depot/projects/smpng/sys/dev/re/if_re.c#26 integrate .. //depot/projects/smpng/sys/dev/sn/if_sn.c#24 integrate .. //depot/projects/smpng/sys/dev/sn/if_snvar.h#7 integrate .. //depot/projects/smpng/sys/fs/nullfs/null_vnops.c#25 integrate .. //depot/projects/smpng/sys/geom/geom_io.c#39 integrate .. //depot/projects/smpng/sys/i386/i386/local_apic.c#33 integrate .. //depot/projects/smpng/sys/i386/include/atomic.h#44 integrate .. //depot/projects/smpng/sys/kern/kern_intr.c#70 integrate .. //depot/projects/smpng/sys/kern/subr_sleepqueue.c#18 integrate .. //depot/projects/smpng/sys/kern/subr_witness.c#138 integrate .. //depot/projects/smpng/sys/powerpc/include/atomic.h#16 integrate .. //depot/projects/smpng/sys/sys/proc.h#149 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/include/atomic.h#31 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/alpha/include/atomic.h,v 1.22 2005/07/15 18:17:57 jhb Exp $ + * $FreeBSD: src/sys/alpha/include/atomic.h,v 1.23 2005/09/15 19:31:22 jhb Exp $ */ #ifndef _MACHINE_ATOMIC_H_ ==== //depot/projects/smpng/sys/amd64/include/atomic.h#27 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/include/atomic.h,v 1.37 2005/08/18 14:36:47 jhb Exp $ + * $FreeBSD: src/sys/amd64/include/atomic.h,v 1.38 2005/09/15 19:31:22 jhb Exp $ */ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ ==== //depot/projects/smpng/sys/dev/re/if_re.c#26 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.51 2005/08/18 18:36:39 sobomax Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.53 2005/09/15 19:07:10 ru Exp $"); /* * RealTek 8139C+/8169/8169S/8110S PCI NIC driver @@ -1234,7 +1234,6 @@ printf("re%d: attach aborted due to hardware diag failure\n", unit); ether_ifdetach(ifp); - if_free(ifp); goto fail; } @@ -1244,7 +1243,6 @@ if (error) { printf("re%d: couldn't set up irq\n", unit); ether_ifdetach(ifp); - if_free(ifp); } fail: @@ -1268,27 +1266,19 @@ struct rl_softc *sc; struct ifnet *ifp; int i; - int attached; sc = device_get_softc(dev); ifp = sc->rl_ifp; KASSERT(mtx_initialized(&sc->rl_mtx), ("re mutex not initialized")); - attached = device_is_attached(dev); /* These should only be active if attach succeeded */ - if (attached) - ether_ifdetach(ifp); - if (ifp == NULL) - if_free(ifp); - - RL_LOCK(sc); + if (device_is_attached(dev)) { + RL_LOCK(sc); #if 0 - sc->suspended = 1; + sc->suspended = 1; #endif - - /* These should only be active if attach succeeded */ - if (attached) { re_stop(sc); + RL_UNLOCK(sc); /* * Force off the IFF_UP flag here, in case someone * still had a BPF descriptor attached to this @@ -1302,6 +1292,7 @@ * anymore. */ ifp->if_flags &= ~IFF_UP; + ether_ifdetach(ifp); } if (sc->rl_miibus) device_delete_child(dev, sc->rl_miibus); @@ -1311,8 +1302,9 @@ * The rest is resource deallocation, so we should already be * stopped here. */ - RL_UNLOCK(sc); + if (ifp != NULL) + if_free(ifp); if (sc->rl_intrhand) bus_teardown_intr(dev, sc->rl_irq, sc->rl_intrhand); if (sc->rl_irq) @@ -2493,8 +2485,7 @@ /* * Mark interface as down since otherwise we will panic if * interrupt comes in later on, which can happen in some - * cases. Another option is to call re_detach() instead of - * re_stop(), like ve(4) does. + * cases. */ sc->rl_ifp->if_flags &= ~IFF_UP; RL_UNLOCK(sc); ==== //depot/projects/smpng/sys/dev/sn/if_sn.c#24 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/sn/if_sn.c,v 1.49 2005/08/15 17:20:34 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/sn/if_sn.c,v 1.50 2005/09/15 19:34:12 ru Exp $"); /* * This is a driver for SMC's 9000 series of Ethernet adapters. @@ -235,7 +235,7 @@ ether_ifdetach(ifp); if_free(ifp); sn_deactivate(dev); - SN_LOCK_DESTORY(sc); + SN_LOCK_DESTROY(sc); return 0; } ==== //depot/projects/smpng/sys/dev/sn/if_snvar.h#7 (text+ko) ==== @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/sn/if_snvar.h,v 1.9 2005/08/15 17:20:34 imp Exp $ + * $FreeBSD: src/sys/dev/sn/if_snvar.h,v 1.10 2005/09/15 19:34:12 ru Exp $ */ #ifndef _IF_SNVAR_H @@ -75,7 +75,7 @@ #define SN_LOCK_INIT(_sc) \ mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \ MTX_NETWORK_LOCK, MTX_DEF) -#define SN_LOCK_DESTORY(_sc) mtx_destroy(&_sc->sc_mtx); +#define SN_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); #define SN_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); #define SN_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); ==== //depot/projects/smpng/sys/fs/nullfs/null_vnops.c#25 (text+ko) ==== @@ -36,7 +36,7 @@ * ...and... * @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project * - * $FreeBSD: src/sys/fs/nullfs/null_vnops.c,v 1.88 2005/09/02 15:49:55 ssouhlal Exp $ + * $FreeBSD: src/sys/fs/nullfs/null_vnops.c,v 1.89 2005/09/15 19:21:26 kan Exp $ */ /* @@ -180,6 +180,7 @@ #include <sys/namei.h> #include <sys/sysctl.h> #include <sys/vnode.h> +#include <sys/kdb.h> #include <fs/nullfs/null.h> @@ -545,6 +546,30 @@ */ vholdl(lvp); error = VOP_LOCK(lvp, flags, td); + + /* + * We might have slept to get the lock and someone might have + * clean our vnode already, switching vnode lock from one in + * lowervp to v_lock in our own vnode structure. Handle this + * case by reacquiring correct lock in requested mode. + */ + if (VTONULL(vp) == NULL && error == 0) { + ap->a_flags &= ~(LK_TYPE_MASK | LK_INTERLOCK); + switch (flags & LK_TYPE_MASK) { + case LK_SHARED: + ap->a_flags |= LK_SHARED; + break; + case LK_UPGRADE: + case LK_EXCLUSIVE: + ap->a_flags |= LK_EXCLUSIVE; + break; + default: + panic("Unsupported lock request %d\n", + ap->a_flags); + } + VOP_LOCK(lvp, LK_RELEASE, td); + error = vop_stdlock(ap); + } vdrop(lvp); } else error = vop_stdlock(ap); @@ -633,14 +658,13 @@ */ VI_LOCK(vp); vp->v_data = NULL; - VI_UNLOCK(vp); + vnlock = vp->v_vnlock; + vp->v_vnlock = &vp->v_lock; + lockmgr(vp->v_vnlock, LK_EXCLUSIVE|LK_INTERLOCK, VI_MTX(vp), curthread); if (lowervp) null_hashrem(xp); vp->v_object = NULL; - vnlock = vp->v_vnlock; - vp->v_vnlock = &vp->v_lock; - lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL, curthread); if (lowervp) { vput(lowervp); } else ==== //depot/projects/smpng/sys/geom/geom_io.c#39 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/geom_io.c,v 1.66 2005/08/29 11:39:24 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/geom_io.c,v 1.67 2005/09/15 19:05:37 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> ==== //depot/projects/smpng/sys/i386/i386/local_apic.c#33 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/local_apic.c,v 1.17 2005/06/24 00:16:57 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/local_apic.c,v 1.18 2005/09/15 19:02:01 jhb Exp $"); #include "opt_hwpmc_hooks.h" ==== //depot/projects/smpng/sys/i386/include/atomic.h#44 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/include/atomic.h,v 1.39 2005/07/15 18:17:58 jhb Exp $ + * $FreeBSD: src/sys/i386/include/atomic.h,v 1.40 2005/09/15 19:31:22 jhb Exp $ */ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ ==== //depot/projects/smpng/sys/kern/kern_intr.c#70 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_intr.c,v 1.124 2005/06/20 19:32:23 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_intr.c,v 1.125 2005/09/15 19:05:37 jhb Exp $"); #include "opt_ddb.h" ==== //depot/projects/smpng/sys/kern/subr_sleepqueue.c#18 (text+ko) ==== @@ -62,7 +62,7 @@ #include "opt_sleepqueue_profiling.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/subr_sleepqueue.c,v 1.18 2005/05/27 15:57:27 davidxu Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/subr_sleepqueue.c,v 1.19 2005/09/15 19:05:37 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> ==== //depot/projects/smpng/sys/kern/subr_witness.c#138 (text+ko) ==== @@ -82,7 +82,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/subr_witness.c,v 1.200 2005/09/11 07:57:06 truckman Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/subr_witness.c,v 1.201 2005/09/15 19:07:14 jhb Exp $"); #include "opt_ddb.h" #include "opt_witness.h" ==== //depot/projects/smpng/sys/powerpc/include/atomic.h#16 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/powerpc/include/atomic.h,v 1.12 2005/07/15 18:17:58 jhb Exp $ + * $FreeBSD: src/sys/powerpc/include/atomic.h,v 1.13 2005/09/15 19:31:22 jhb Exp $ */ #ifndef _MACHINE_ATOMIC_H_ ==== //depot/projects/smpng/sys/sys/proc.h#149 (text+ko) ==== @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 - * $FreeBSD: src/sys/sys/proc.h,v 1.433 2005/08/10 07:10:02 obrien Exp $ + * $FreeBSD: src/sys/sys/proc.h,v 1.434 2005/09/15 19:05:37 jhb Exp $ */ #ifndef _SYS_PROC_H_
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509151940.j8FJexac009989>