From owner-p4-projects Fri Oct 25 7:47:49 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 88BFD37B404; Fri, 25 Oct 2002 07:47:28 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 346FE37B401 for ; Fri, 25 Oct 2002 07:47:28 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5FCE843E42 for ; Fri, 25 Oct 2002 07:47:27 -0700 (PDT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id g9PEkcmV097436 for ; Fri, 25 Oct 2002 07:46:38 -0700 (PDT) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id g9PEkbV8097432 for perforce@freebsd.org; Fri, 25 Oct 2002 07:46:37 -0700 (PDT) Date: Fri, 25 Oct 2002 07:46:37 -0700 (PDT) Message-Id: <200210251446.g9PEkbV8097432@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 20117 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=20117 Change 20117 by jhb@jhb_laptop on 2002/10/25 07:45:58 IFC @20116. Need phk@'s fix for v_incr_usecount(). Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/trap.c#39 integrate .. //depot/projects/smpng/sys/fs/specfs/spec_vnops.c#18 integrate .. //depot/projects/smpng/sys/geom/geom_subr.c#14 integrate .. //depot/projects/smpng/sys/i386/i386/trap.c#45 integrate .. //depot/projects/smpng/sys/i386/include/float.h#2 integrate .. //depot/projects/smpng/sys/ia64/ia64/trap.c#38 integrate .. //depot/projects/smpng/sys/kern/kern_condvar.c#20 integrate .. //depot/projects/smpng/sys/kern/kern_mutex.c#52 integrate .. //depot/projects/smpng/sys/kern/kern_synch.c#35 integrate .. //depot/projects/smpng/sys/kern/kern_thread.c#10 integrate .. //depot/projects/smpng/sys/kern/vfs_subr.c#36 integrate .. //depot/projects/smpng/sys/kern/vfs_vnops.c#32 integrate .. //depot/projects/smpng/sys/netinet/ip_fw.h#11 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#37 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/trap.c#41 integrate .. //depot/projects/smpng/sys/sys/proc.h#64 integrate .. //depot/projects/smpng/sys/sys/vnode.h#27 integrate .. //depot/projects/smpng/sys/ufs/ffs/ffs_snapshot.c#18 integrate .. //depot/projects/smpng/sys/ufs/ffs/ffs_vfsops.c#33 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/trap.c#39 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/alpha/alpha/trap.c,v 1.101 2002/09/17 07:44:28 peter Exp $ */ +/* $FreeBSD: src/sys/alpha/alpha/trap.c,v 1.102 2002/10/24 23:09:47 julian Exp $ */ /* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */ /* @@ -669,24 +669,8 @@ sticks = td->td_kse->ke_sticks; if (td->td_ucred != p->p_ucred) cred_update_thread(td); - if (p->p_flag & P_KSES) { - /* - * If we are doing a syscall in a KSE environment, - * note where our mailbox is. There is always the - * possibility that we could do this lazily (in sleep()), - * but for now do it every time. - */ - td->td_mailbox = (void *)fuword((caddr_t)td->td_kse->ke_mailbox - + offsetof(struct kse_mailbox, km_curthread)); - if ((td->td_mailbox == NULL) || - (td->td_mailbox == (void *)-1)) { - td->td_mailbox = NULL; /* single thread it.. */ - td->td_flags &= ~TDF_UNBOUND; - } else { - td->td_flags |= TDF_UNBOUND; - } - } - + if (p->p_flag & P_KSES) + thread_user_enter(p, td); #ifdef DIAGNOSTIC alpha_fpstate_check(td); #endif ==== //depot/projects/smpng/sys/fs/specfs/spec_vnops.c#18 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95 - * $FreeBSD: src/sys/fs/specfs/spec_vnops.c,v 1.183 2002/10/22 00:59:48 mckusick Exp $ + * $FreeBSD: src/sys/fs/specfs/spec_vnops.c,v 1.184 2002/10/25 00:20:36 mckusick Exp $ */ #include @@ -421,8 +421,8 @@ struct vnode *vp = ap->a_vp; struct buf *bp; struct buf *nbp; - int s; - int maxretry = 10000; /* large, arbitrarily chosen */ + int s, error = 0; + int maxretry = 100; /* large, arbitrarily chosen */ if (!vn_isdisk(vp, NULL)) return (0); @@ -435,6 +435,7 @@ s = splbio(); TAILQ_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs) { bp->b_flags &= ~B_SCANNED; + bp->b_error = 0; } splx(s); @@ -481,16 +482,25 @@ PRIBIO + 1, "spfsyn", 0); } if (!TAILQ_EMPTY(&vp->v_dirtyblkhd)) { - if (--maxretry != 0) { + /* + * If we are unable to write any of these buffers + * then we fail now rather than trying endlessly + * to write them out. + */ + TAILQ_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs) + if ((error = bp->b_error) == 0) + continue; + if (error == 0 && --maxretry >= 0) { splx(s); goto loop1; } vprint("spec_fsync: giving up on dirty", vp); + error = EAGAIN; } } VI_UNLOCK(vp); splx(s); - return (0); + return (error); } /* ==== //depot/projects/smpng/sys/geom/geom_subr.c#14 (text+ko) ==== @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/geom/geom_subr.c,v 1.20 2002/10/24 19:20:28 phk Exp $ + * $FreeBSD: src/sys/geom/geom_subr.c,v 1.21 2002/10/24 21:32:49 phk Exp $ */ @@ -190,7 +190,7 @@ pp->geom = gp; LIST_INSERT_HEAD(&gp->provider, pp, provider); g_nproviders++; - if (g_nproviders > 1) + if (strcmp(pp->name, "geom.ctl")) g_post_event(EV_NEW_PROVIDER, NULL, NULL, pp, NULL); return (pp); } ==== //depot/projects/smpng/sys/i386/i386/trap.c#45 (text+ko) ==== @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $FreeBSD: src/sys/i386/i386/trap.c,v 1.235 2002/10/09 02:33:35 julian Exp $ + * $FreeBSD: src/sys/i386/i386/trap.c,v 1.236 2002/10/24 23:09:48 julian Exp $ */ /* @@ -963,44 +963,8 @@ td->td_frame = &frame; if (td->td_ucred != p->p_ucred) cred_update_thread(td); - if (p->p_flag & P_KSES) { - /* - * First check that we shouldn't just abort. - * But check if we are the single thread first! - * XXX p_singlethread not locked, but should be safe. - */ - if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) { - PROC_LOCK(p); - mtx_lock_spin(&sched_lock); - thread_exit(); - /* NOTREACHED */ - } - - /* - * If we are doing a syscall in a KSE environment, - * note where our mailbox is. There is always the - * possibility that we could do this lazily (in sleep()), - * but for now do it every time. - */ -#if 0 - td->td_mailbox = (void *)fuword((caddr_t)td->td_kse->ke_mailbox - + offsetof(struct kse_mailbox, km_curthread)); -#else /* if user pointer arithmetic is ok in the kernel */ - td->td_mailbox = - (void *)fuword( - (void *)&td->td_kse->ke_mailbox->km_curthread); -#endif - if ((td->td_mailbox == NULL) || - (td->td_mailbox == (void *)-1)) { - td->td_mailbox = NULL; /* single thread it.. */ - td->td_flags &= ~TDF_UNBOUND; - } else { - if (td->td_standin == NULL) { - td->td_standin = thread_alloc(); - } - td->td_flags |= TDF_UNBOUND; - } - } + if (p->p_flag & P_KSES) + thread_user_enter(p, td); params = (caddr_t)frame.tf_esp + sizeof(int); code = frame.tf_eax; orig_tf_eflags = frame.tf_eflags; ==== //depot/projects/smpng/sys/i386/include/float.h#2 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)float.h 7.1 (Berkeley) 5/8/90 - * $FreeBSD: src/sys/i386/include/float.h,v 1.8 1999/08/28 00:44:11 peter Exp $ + * $FreeBSD: src/sys/i386/include/float.h,v 1.9 2002/10/25 07:02:52 imp Exp $ */ #ifndef _MACHINE_FLOAT_H_ @@ -60,13 +60,14 @@ #define DBL_MAX 1.7976931348623157E+308 #define DBL_MAX_10_EXP 308 -#define LDBL_MANT_DIG DBL_MANT_DIG -#define LDBL_EPSILON DBL_EPSILON -#define LDBL_DIG DBL_DIG -#define LDBL_MIN_EXP DBL_MIN_EXP -#define LDBL_MIN DBL_MIN -#define LDBL_MIN_10_EXP DBL_MIN_10_EXP -#define LDBL_MAX_EXP DBL_MAX_EXP -#define LDBL_MAX DBL_MAX -#define LDBL_MAX_10_EXP DBL_MAX_10_EXP + +#define LDBL_MANT_DIG 64 +#define LDBL_EPSILON 1.0842021724855044340E-19L +#define LDBL_DIG 18 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MIN 3.3621031431120935063E-4932L +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_EXP 16384 +#define LDBL_MAX 1.1897314953572317650E+4932L +#define LDBL_MAX_10_EXP 4932 #endif /* _MACHINE_FLOAT_H_ */ ==== //depot/projects/smpng/sys/ia64/ia64/trap.c#38 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/ia64/ia64/trap.c,v 1.64 2002/10/04 00:18:21 peter Exp $ */ +/* $FreeBSD: src/sys/ia64/ia64/trap.c,v 1.65 2002/10/24 23:09:48 julian Exp $ */ /* From: src/sys/alpha/alpha/trap.c,v 1.33 */ /* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */ @@ -808,24 +808,8 @@ framep->tf_cr_iip += 16; } - if (p->p_flag & P_KSES) { - /* - * If we are doing a syscall in a KSE environment, - * note where our mailbox is. There is always the - * possibility that we could do this lazily (in sleep()), - * but for now do it every time. - */ - td->td_mailbox = (void *)fuword((caddr_t)td->td_kse->ke_mailbox - + offsetof(struct kse_mailbox, km_curthread)); - if ((td->td_mailbox == NULL) || - (td->td_mailbox == (void *)-1)) { - td->td_mailbox = NULL; /* single thread it.. */ - td->td_flags &= ~TDF_UNBOUND; - } else { - td->td_flags |= TDF_UNBOUND; - } - } - + if (p->p_flag & P_KSES) + thread_user_enter(p, td); #ifdef DIAGNOSTIC ia64_fpstate_check(td); #endif ==== //depot/projects/smpng/sys/kern/kern_condvar.c#20 (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/kern/kern_condvar.c,v 1.33 2002/10/09 02:33:36 julian Exp $ + * $FreeBSD: src/sys/kern/kern_condvar.c,v 1.34 2002/10/25 07:11:12 julian Exp $ */ #include "opt_ktrace.h" @@ -82,7 +82,6 @@ #endif static void cv_timedwait_end(void *arg); -static void cv_check_upcall(struct thread *td); /* * Initialize a condition variable. Must be called before use. @@ -112,11 +111,10 @@ */ /* - * Decide if we need to queue an upcall. - * This is copied from msleep(), perhaps this should be a common function. + * Switch context. */ -static void -cv_check_upcall(struct thread *td) +static __inline void +cv_switch(struct thread *td) { /* @@ -127,8 +125,7 @@ * the thread (recursion here might be bad). * Hence the TDF_INMSLEEP flag. */ - if ((td->td_proc->p_flag & P_KSES) && td->td_mailbox && - (td->td_flags & TDF_INMSLEEP) == 0) { + if ((td->td_flags & (TDF_UNBOUND|TDF_INMSLEEP)) == TDF_UNBOUND) { /* * We don't need to upcall now, just queue it. * The upcall will happen when other n-kernel work @@ -139,16 +136,6 @@ thread_schedule_upcall(td, td->td_kse); td->td_flags &= ~TDF_INMSLEEP; } -} - -/* - * Switch context. - */ -static __inline void -cv_switch(struct thread *td) -{ - - cv_check_upcall(td); TD_SET_SLEEPING(td); td->td_proc->p_stats->p_ru.ru_nvcsw++; mi_switch(); ==== //depot/projects/smpng/sys/kern/kern_mutex.c#52 (text+ko) ==== @@ -27,7 +27,7 @@ * * from BSDI $Id: mutex_witness.c,v 1.1.2.20 2000/04/27 03:10:27 cp Exp $ * and BSDI $Id: synch_machdep.c,v 2.3.2.39 2000/04/27 03:10:25 cp Exp $ - * $FreeBSD: src/sys/kern/kern_mutex.c,v 1.115 2002/10/23 10:26:54 des Exp $ + * $FreeBSD: src/sys/kern/kern_mutex.c,v 1.116 2002/10/25 08:40:20 phk Exp $ */ /* @@ -859,6 +859,10 @@ { /* + * XXX: When kernacc() does not require Giant we can reenable this check + */ +#ifdef notyet +/* * XXX - When kernacc() is fixed on the alpha to handle K0_SEG memory properly * we can re-enable the kernacc() checks. */ @@ -873,6 +877,7 @@ VM_PROT_READ | VM_PROT_WRITE)) panic("Can't read and write to mutex %p", m); #endif +#endif } #endif ==== //depot/projects/smpng/sys/kern/kern_synch.c#35 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 - * $FreeBSD: src/sys/kern/kern_synch.c,v 1.204 2002/10/12 05:32:23 jeff Exp $ + * $FreeBSD: src/sys/kern/kern_synch.c,v 1.205 2002/10/25 07:11:12 julian Exp $ */ #include "opt_ddb.h" @@ -155,26 +155,29 @@ * Hence the TDF_INMSLEEP flag. */ if (p->p_flag & P_KSES) { - /* Just don't bother if we are exiting - and not the exiting thread. */ - if ((p->p_flag & P_WEXIT) && catch && p->p_singlethread != td) + /* + * Just don't bother if we are exiting + * and not the exiting thread. + */ + if ((p->p_flag & P_WEXIT) && catch && (p->p_singlethread != td)) return (EINTR); - if (td->td_mailbox && (!(td->td_flags & TDF_INMSLEEP))) { + mtx_lock_spin(&sched_lock); + if ((td->td_flags & (TDF_UNBOUND|TDF_INMSLEEP)) == + TDF_UNBOUND) { /* * Arrange for an upcall to be readied. * it will not actually happen until all * pending in-kernel work for this KSEGRP * has been done. */ - mtx_lock_spin(&sched_lock); /* Don't recurse here! */ td->td_flags |= TDF_INMSLEEP; thread_schedule_upcall(td, td->td_kse); td->td_flags &= ~TDF_INMSLEEP; - mtx_unlock_spin(&sched_lock); } + } else { + mtx_lock_spin(&sched_lock); } - mtx_lock_spin(&sched_lock); if (cold ) { /* * During autoconfiguration, just give interrupts ==== //depot/projects/smpng/sys/kern/kern_thread.c#10 (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/kern/kern_thread.c,v 1.42 2002/10/24 14:43:48 davidxu Exp $ + * $FreeBSD: src/sys/kern/kern_thread.c,v 1.48 2002/10/25 13:12:36 davidxu Exp $ */ #include @@ -369,8 +369,6 @@ return ESRCH; } found: - TAILQ_REMOVE(&kg->kg_iq, ke, ke_kgrlist); - kg->kg_idle_kses--; thread_schedule_upcall(td, ke); mtx_unlock_spin(&sched_lock); td->td_retval[0] = 0; @@ -1039,6 +1037,7 @@ thread_schedule_upcall(struct thread *td, struct kse *ke) { struct thread *td2; + struct ksegrp *kg; int newkse; mtx_assert(&sched_lock, MA_OWNED); @@ -1059,6 +1058,12 @@ } KASSERT((ke->ke_bound == NULL), ("kse already bound")); + if (ke->ke_state == KES_IDLE) { + kg = ke->ke_ksegrp; + TAILQ_REMOVE(&kg->kg_iq, ke, ke_kgrlist); + kg->kg_idle_kses--; + ke->ke_state = KES_UNQUEUED; + } if ((td2 = td->td_standin) != NULL) { td->td_standin = NULL; } else { @@ -1115,6 +1120,7 @@ } else { ke->ke_bound = NULL; ke->ke_thread = td2; + ke->ke_state = KES_THREAD; setrunqueue(td2); } return (td2); /* bogus.. should be a void function */ @@ -1158,6 +1164,54 @@ } /* + * setup done on the thread when it enters the kernel. + * XXXKSE Presently only for syscalls but eventually all kernel entries. + */ +void +thread_user_enter(struct proc *p, struct thread *td) +{ + struct kse *ke; + + /* + * First check that we shouldn't just abort. + * But check if we are the single thread first! + * XXX p_singlethread not locked, but should be safe. + */ + if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) { + PROC_LOCK(p); + mtx_lock_spin(&sched_lock); + thread_exit(); + /* NOTREACHED */ + } + + /* + * If we are doing a syscall in a KSE environment, + * note where our mailbox is. There is always the + * possibility that we could do this lazily (in sleep()), + * but for now do it every time. + */ + ke = td->td_kse; + if (ke->ke_mailbox != NULL) { +#if 0 + td->td_mailbox = (void *)fuword((caddr_t)ke->ke_mailbox + + offsetof(struct kse_mailbox, km_curthread)); +#else /* if user pointer arithmetic is ok in the kernel */ + td->td_mailbox = + (void *)fuword( (void *)&ke->ke_mailbox->km_curthread); +#endif + if ((td->td_mailbox == NULL) || + (td->td_mailbox == (void *)-1)) { + td->td_mailbox = NULL; /* single thread it.. */ + td->td_flags &= ~TDF_UNBOUND; + } else { + if (td->td_standin == NULL) + td->td_standin = thread_alloc(); + td->td_flags |= TDF_UNBOUND; + } + } +} + +/* * The extra work we go through if we are a threaded process when we * return to userland. * @@ -1397,28 +1451,42 @@ p->p_flag &= ~P_SINGLE_EXIT; p->p_flag |= P_STOPPED_SINGLE; p->p_singlethread = td; + /* XXXKSE Which lock protects the below values? */ while ((p->p_numthreads - p->p_suspcount) != 1) { mtx_lock_spin(&sched_lock); FOREACH_THREAD_IN_PROC(p, td2) { if (td2 == td) continue; if (TD_IS_INHIBITED(td2)) { - if (TD_IS_SUSPENDED(td2)) { - if (force_exit == SINGLE_EXIT) { + if (force_exit == SINGLE_EXIT) { + if (TD_IS_SUSPENDED(td2)) { thread_unsuspend_one(td2); - } else { + } + if (TD_ON_SLEEPQ(td2) && + (td2->td_flags & TDF_SINTR)) { + if (td2->td_flags & TDF_CVWAITQ) + cv_abort(td2); + else + abortsleep(td2); + } + } else { + if (TD_IS_SUSPENDED(td2)) continue; - } - } - if (TD_ON_SLEEPQ(td2) && - (td2->td_flags & TDF_SINTR)) { - if (td2->td_flags & TDF_CVWAITQ) - cv_abort(td2); - else - abortsleep(td2); + /* maybe other inhibitted states too? */ + if (TD_IS_SLEEPING(td2) && + (td2->td_flags & TDF_SINTR)) + thread_suspend_one(td2); } } } + /* + * Maybe we suspended some threads.. was it enough? + */ + if ((p->p_numthreads - p->p_suspcount) == 1) { + mtx_unlock_spin(&sched_lock); + break; + } + /* * Wake us up when everyone else has suspended. * In the mean time we suspend as well. @@ -1574,6 +1642,7 @@ * Hack: If we are suspending but are on the sleep queue * then we are in msleep or the cv equivalent. We * want to look like we have two Inhibitors. + * May already be set.. doesn't matter. */ if (TD_ON_SLEEPQ(td)) TD_SET_SLEEPING(td); ==== //depot/projects/smpng/sys/kern/vfs_subr.c#36 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $FreeBSD: src/sys/kern/vfs_subr.c,v 1.416 2002/10/24 19:38:56 phk Exp $ + * $FreeBSD: src/sys/kern/vfs_subr.c,v 1.418 2002/10/25 07:58:25 phk Exp $ */ /* @@ -1958,7 +1958,7 @@ v_incr_usecount(struct vnode *vp, int delta) { vp->v_usecount += delta; - if (vp->v_type == VCHR) { + if (vp->v_type == VCHR && vp->v_rdev != NULL) { mtx_lock(&spechash_mtx); vp->v_rdev->si_usecount += delta; mtx_unlock(&spechash_mtx); @@ -3425,7 +3425,7 @@ struct vnode *syncvp = ap->a_vp; struct mount *mp = syncvp->v_mount; struct thread *td = ap->a_td; - int asyncflag; + int error, asyncflag; /* * We only need to do something if this is a lazy evaluation. @@ -3456,12 +3456,12 @@ asyncflag = mp->mnt_flag & MNT_ASYNC; mp->mnt_flag &= ~MNT_ASYNC; vfs_msync(mp, MNT_NOWAIT); - VFS_SYNC(mp, MNT_LAZY, ap->a_cred, td); + error = VFS_SYNC(mp, MNT_LAZY, ap->a_cred, td); if (asyncflag) mp->mnt_flag |= MNT_ASYNC; vn_finished_write(mp); vfs_unbusy(mp, td); - return (0); + return (error); } /* ==== //depot/projects/smpng/sys/kern/vfs_vnops.c#32 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 - * $FreeBSD: src/sys/kern/vfs_vnops.c,v 1.174 2002/10/19 20:56:44 rwatson Exp $ + * $FreeBSD: src/sys/kern/vfs_vnops.c,v 1.175 2002/10/25 00:20:36 mckusick Exp $ */ #include "opt_mac.h" @@ -1005,19 +1005,24 @@ /* * Request a filesystem to suspend write operations. */ -void +int vfs_write_suspend(mp) struct mount *mp; { struct thread *td = curthread; + int error; if (mp->mnt_kern_flag & MNTK_SUSPEND) - return; + return (0); mp->mnt_kern_flag |= MNTK_SUSPEND; if (mp->mnt_writeopcount > 0) (void) tsleep(&mp->mnt_writeopcount, PUSER - 1, "suspwt", 0); - VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td); + if ((error = VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td)) != 0) { + vfs_write_resume(mp); + return (error); + } mp->mnt_kern_flag |= MNTK_SUSPENDED; + return (0); } /* ==== //depot/projects/smpng/sys/netinet/ip_fw.h#11 (text+ko) ==== @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/netinet/ip_fw.h,v 1.74 2002/08/10 04:37:32 luigi Exp $ + * $FreeBSD: src/sys/netinet/ip_fw.h,v 1.75 2002/10/24 22:32:13 mux Exp $ */ #ifndef _IPFW2_H @@ -276,6 +276,7 @@ struct ip_fw { struct ip_fw *next; /* linked list of rules */ struct ip_fw *next_rule; /* ptr to next [skipto] rule */ + u_int32_t set_disable; /* disabled sets (for userland) */ u_int16_t act_ofs; /* offset of action in 32-bit units */ u_int16_t cmd_len; /* # of 32-bit words in cmd */ u_int16_t rulenum; /* rule number */ @@ -331,6 +332,7 @@ /* to generate keepalives) */ u_int16_t dyn_type; /* rule type */ u_int16_t count; /* refcount */ + u_int16_t rulenum; /* rule number (for userland) */ }; /* ==== //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#37 (text+ko) ==== @@ -37,7 +37,7 @@ * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * from: FreeBSD: src/sys/i386/i386/machdep.c,v 1.477 2001/08/27 - * $FreeBSD: src/sys/sparc64/sparc64/machdep.c,v 1.66 2002/10/22 18:03:15 jake Exp $ + * $FreeBSD: src/sys/sparc64/sparc64/machdep.c,v 1.67 2002/10/25 06:26:34 jake Exp $ */ #include "opt_ddb.h" @@ -313,7 +313,7 @@ thread0.td_kstack = kstack0; thread0.td_pcb = (struct pcb *) (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - frame0.tf_tstate = TSTATE_IE | TSTATE_PEF; + frame0.tf_tstate = TSTATE_IE | TSTATE_PEF | TSTATE_PRIV; thread0.td_frame = &frame0; /* @@ -597,12 +597,12 @@ } pcb = td->td_pcb; + tf = td->td_frame; sp = rounddown(stack, 16); - tf = td->td_frame; bzero(pcb, sizeof(*pcb)); bzero(tf, sizeof(*tf)); tf->tf_out[0] = stack; - tf->tf_out[3] = PS_STRINGS; + tf->tf_out[3] = p->p_sysent->sv_psstrings; tf->tf_out[6] = sp - SPOFF - sizeof(struct frame); tf->tf_tnpc = entry + 4; tf->tf_tpc = entry; ==== //depot/projects/smpng/sys/sparc64/sparc64/trap.c#41 (text+ko) ==== @@ -37,7 +37,7 @@ * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * from: FreeBSD: src/sys/i386/i386/trap.c,v 1.197 2001/07/19 - * $FreeBSD: src/sys/sparc64/sparc64/trap.c,v 1.48 2002/10/22 18:03:15 jake Exp $ + * $FreeBSD: src/sys/sparc64/sparc64/trap.c,v 1.49 2002/10/24 23:09:48 julian Exp $ */ #include "opt_ddb.h" @@ -575,23 +575,8 @@ td->td_frame = tf; if (td->td_ucred != p->p_ucred) cred_update_thread(td); - if (p->p_flag & P_KSES) { - /* - * If we are doing a syscall in a KSE environment, - * note where our mailbox is. There is always the - * possibility that we could do this lazily (in sleep()), - * but for now do it every time. - */ - td->td_mailbox = (void *)fuword((caddr_t)td->td_kse->ke_mailbox - + offsetof(struct kse_mailbox, km_curthread)); - if ((td->td_mailbox == NULL) || - (td->td_mailbox == (void *)-1)) { - td->td_mailbox = NULL; /* single thread it.. */ - td->td_flags &= ~TDF_UNBOUND; - } else { - td->td_flags |= TDF_UNBOUND; - } - } + if (p->p_flag & P_KSES) + thread_user_enter(p, td); code = tf->tf_global[1]; /* ==== //depot/projects/smpng/sys/sys/proc.h#64 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 - * $FreeBSD: src/sys/sys/proc.h,v 1.274 2002/10/24 08:46:34 julian Exp $ + * $FreeBSD: src/sys/sys/proc.h,v 1.275 2002/10/24 23:09:48 julian Exp $ */ #ifndef _SYS_PROC_H_ @@ -930,6 +930,7 @@ void thread_unsuspend(struct proc *p); void thread_unsuspend_one(struct thread *td); int thread_userret(struct thread *td, struct trapframe *frame); +void thread_user_enter(struct proc *p, struct thread *td); void thread_sanity_check(struct thread *td, char *); #endif /* _KERNEL */ ==== //depot/projects/smpng/sys/sys/vnode.h#27 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vnode.h 8.7 (Berkeley) 2/4/94 - * $FreeBSD: src/sys/sys/vnode.h,v 1.215 2002/10/13 04:19:44 jeff Exp $ + * $FreeBSD: src/sys/sys/vnode.h,v 1.216 2002/10/25 00:20:36 mckusick Exp $ */ #ifndef _SYS_VNODE_H_ @@ -681,7 +681,7 @@ struct ucred *cred); void vfs_timestamp(struct timespec *); void vfs_write_resume(struct mount *mp); -void vfs_write_suspend(struct mount *mp); +int vfs_write_suspend(struct mount *mp); int vop_stdbmap(struct vop_bmap_args *); int vop_stdgetwritemount(struct vop_getwritemount_args *); int vop_stdgetpages(struct vop_getpages_args *); ==== //depot/projects/smpng/sys/ufs/ffs/ffs_snapshot.c#18 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_snapshot.c 8.11 (McKusick) 7/23/00 - * $FreeBSD: src/sys/ufs/ffs/ffs_snapshot.c,v 1.47 2002/10/22 01:23:00 mckusick Exp $ + * $FreeBSD: src/sys/ufs/ffs/ffs_snapshot.c,v 1.48 2002/10/25 00:20:37 mckusick Exp $ */ #include @@ -307,7 +307,10 @@ */ for (;;) { vn_finished_write(wrtmp); - vfs_write_suspend(vp->v_mount); + if ((error = vfs_write_suspend(vp->v_mount)) != 0) { + vn_start_write(NULL, &wrtmp, V_WAIT); + goto out; + } if (mp->mnt_kern_flag & MNTK_SUSPENDED) break; vn_start_write(NULL, &wrtmp, V_WAIT); ==== //depot/projects/smpng/sys/ufs/ffs/ffs_vfsops.c#33 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 - * $FreeBSD: src/sys/ufs/ffs/ffs_vfsops.c,v 1.194 2002/10/15 20:00:06 rwatson Exp $ + * $FreeBSD: src/sys/ufs/ffs/ffs_vfsops.c,v 1.195 2002/10/25 00:20:37 mckusick Exp $ */ #include "opt_mac.h" @@ -184,7 +184,11 @@ /* * Flush any dirty data. */ - VFS_SYNC(mp, MNT_WAIT, td->td_proc->p_ucred, td); + if ((error = VFS_SYNC(mp, MNT_WAIT, + td->td_proc->p_ucred, td)) != 0) { + vn_finished_write(mp); + return (error); + } /* * Check for and optionally get rid of files open * for writing. @@ -1156,7 +1160,7 @@ if ((error = softdep_flushworklist(ump->um_mountp, &count, td))) allerror = error; /* Flushed work items may create new vnodes to clean */ - if (count) { + if (allerror == 0 && count) { mtx_lock(&mntvnode_mtx); goto loop; } @@ -1172,7 +1176,7 @@ if ((error = VOP_FSYNC(devvp, cred, waitfor, td)) != 0) allerror = error; VOP_UNLOCK(devvp, 0, td); - if (waitfor == MNT_WAIT) { + if (allerror == 0 && waitfor == MNT_WAIT) { mtx_lock(&mntvnode_mtx); goto loop; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message