Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/kern Pull up revision 1.175 (requested by perseant ...



details:   https://anonhg.NetBSD.org/src/rev/b5802b029beb
branches:  netbsd-1-6
changeset: 527690:b5802b029beb
user:      tv <tv%NetBSD.org@localhost>
date:      Sun Jun 02 15:29:56 2002 +0000

description:
Pull up revision 1.175 (requested by perseant in ticket #132):
Back out rev 1.174 of vfs_subr.c, because the splbio() wasn't protecting
enough to be useful, and broadening it so that it did would have meant
that operations possibly requiring synchronous disk activity would have
to be done in splbio().  This clearly was not going to work.
Worked around this in the LFS case by having lfs_cluster_callback put an
extra hold on the vnode before calling biodone(), and taking the hold
off without HOLDRELE's problematic list swapping.  lfs_vunref() will take
care of that---in thread context---on the next write if need be.
Also, ensure that the list walking in lfs_{writevnodes,segunlock,gather}
takes into account the possibility that the list may change
underneath it (possibly because it itself deleted an element).
Tested on i386, test-compiled on alpha.

diffstat:

 sys/kern/vfs_subr.c |  36 ++++--------------------------------
 1 files changed, 4 insertions(+), 32 deletions(-)

diffs (213 lines):

diff -r 2c5920b47311 -r b5802b029beb sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Sun Jun 02 15:28:19 2002 +0000
+++ b/sys/kern/vfs_subr.c       Sun Jun 02 15:29:56 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.174 2002/05/20 22:50:57 perseant Exp $  */
+/*     $NetBSD: vfs_subr.c,v 1.174.2.1 2002/06/02 15:29:56 tv Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.174 2002/05/20 22:50:57 perseant Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.174.2.1 2002/06/02 15:29:56 tv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -422,7 +422,6 @@
        static int toggle;
        struct vnode *vp;
        int error = 0, tryalloc;
-       int s;
 
  try_again:
        if (mp) {
@@ -513,9 +512,7 @@
                }
                if (vp->v_usecount)
                        panic("free vnode isn't, vp %p", vp);
-               s = splbio();
                TAILQ_REMOVE(listhd, vp, v_freelist);
-               splx(s);
                /* see comment on why 0xdeadb is set at end of vgone (below) */
                vp->v_freelist.tqe_prev = (struct vnode **)0xdeadb;
                simple_unlock(&vnode_free_list_slock);
@@ -572,8 +569,6 @@
 ungetnewvnode(vp)
        struct vnode *vp;
 {
-       int s;
-
 #ifdef DIAGNOSTIC
        if (vp->v_usecount != 1)
                panic("ungetnewvnode: busy vnode");
@@ -587,12 +582,10 @@
         * Insert at head of LRU list
         */
        simple_lock(&vnode_free_list_slock);
-       s = splbio();
        if (vp->v_holdcnt > 0)
                TAILQ_INSERT_HEAD(&vnode_hold_list, vp, v_freelist);
        else
                TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist);
-       splx(s);
        simple_unlock(&vnode_free_list_slock); 
        simple_unlock(&vp->v_interlock);
 }
@@ -1124,7 +1117,7 @@
        struct vnode *vp;
        int flags;
 {
-       int s, error;
+       int error;
 
        /*
         * If the vnode is in the process of being cleaned out for
@@ -1146,12 +1139,10 @@
        }
        if (vp->v_usecount == 0) {
                simple_lock(&vnode_free_list_slock);
-               s = splbio();
                if (vp->v_holdcnt > 0)
                        TAILQ_REMOVE(&vnode_hold_list, vp, v_freelist);
                else
                        TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
-               splx(s);
                simple_unlock(&vnode_free_list_slock);
        }
        vp->v_usecount++;
@@ -1181,14 +1172,12 @@
                         * insert at tail of LRU list
                         */
                        simple_lock(&vnode_free_list_slock);
-                       s = splbio();
                        if (vp->v_holdcnt > 0)
                                TAILQ_INSERT_TAIL(&vnode_hold_list, vp,
                                    v_freelist);
                        else
                                TAILQ_INSERT_TAIL(&vnode_free_list, vp,
                                    v_freelist);
-                       splx(s);
                        simple_unlock(&vnode_free_list_slock);
                        simple_unlock(&vp->v_interlock);
                }
@@ -1205,7 +1194,6 @@
 vput(vp)
        struct vnode *vp;
 {
-       int s;
        struct proc *p = curproc;       /* XXX */
 
 #ifdef DIAGNOSTIC
@@ -1229,12 +1217,10 @@
         * Insert at tail of LRU list.
         */
        simple_lock(&vnode_free_list_slock);
-       s = splbio();
        if (vp->v_holdcnt > 0)
                TAILQ_INSERT_TAIL(&vnode_hold_list, vp, v_freelist);
        else
                TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
-       splx(s);
        simple_unlock(&vnode_free_list_slock);
        if (vp->v_flag & VEXECMAP) {
                uvmexp.execpages -= vp->v_uobj.uo_npages;
@@ -1253,7 +1239,6 @@
 vrele(vp)
        struct vnode *vp;
 {
-       int s;
        struct proc *p = curproc;       /* XXX */
 
 #ifdef DIAGNOSTIC
@@ -1276,12 +1261,10 @@
         * Insert at tail of LRU list.
         */
        simple_lock(&vnode_free_list_slock);
-       s = splbio();
        if (vp->v_holdcnt > 0)
                TAILQ_INSERT_TAIL(&vnode_hold_list, vp, v_freelist);
        else
                TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
-       splx(s);
        simple_unlock(&vnode_free_list_slock);
        if (vp->v_flag & VEXECMAP) {
                uvmexp.execpages -= vp->v_uobj.uo_npages;
@@ -1300,7 +1283,6 @@
 vhold(vp)
        struct vnode *vp;
 {
-       int s;
 
        /*
         * If it is on the freelist and the hold count is currently
@@ -1319,10 +1301,8 @@
        if ((vp->v_freelist.tqe_prev != (struct vnode **)0xdeadb) &&
            vp->v_holdcnt == 0 && vp->v_usecount == 0) {
                simple_lock(&vnode_free_list_slock);
-               s = splbio();
                TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
                TAILQ_INSERT_TAIL(&vnode_hold_list, vp, v_freelist);
-               splx(s);
                simple_unlock(&vnode_free_list_slock);
        }
        vp->v_holdcnt++;
@@ -1336,7 +1316,6 @@
 holdrele(vp)
        struct vnode *vp;
 {
-       int s;
 
        simple_lock(&vp->v_interlock);
        if (vp->v_holdcnt <= 0)
@@ -1360,10 +1339,8 @@
        if ((vp->v_freelist.tqe_prev != (struct vnode **)0xdeadb) &&
            vp->v_holdcnt == 0 && vp->v_usecount == 0) {
                simple_lock(&vnode_free_list_slock);
-               s = splbio();
                TAILQ_REMOVE(&vnode_hold_list, vp, v_freelist);
                TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
-               splx(s);
                simple_unlock(&vnode_free_list_slock);
        }
        simple_unlock(&vp->v_interlock);
@@ -1491,7 +1468,7 @@
        int flags;
        struct proc *p;
 {
-       int s, active;
+       int active;
 
        LOCK_ASSERT(simple_lock_held(&vp->v_interlock));
 
@@ -1587,9 +1564,7 @@
                        if (vp->v_holdcnt > 0)
                                panic("vclean: not clean, vp %p", vp);
 #endif
-                       s = splbio();
                        TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
-                       splx(s);
                        simple_unlock(&vnode_free_list_slock);
                } else
                        simple_unlock(&vp->v_interlock);
@@ -1657,7 +1632,6 @@
        struct vnode *vp;
        struct proc *p;
 {
-       int s;
        struct vnode *vq;
        struct vnode *vx;
 
@@ -1752,10 +1726,8 @@
                        panic("vgonel: not clean, vp %p", vp);
                if (vp->v_freelist.tqe_prev != (struct vnode **)0xdeadb &&
                    TAILQ_FIRST(&vnode_free_list) != vp) {
-                       s = splbio();
                        TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
                        TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist);
-                       splx(s);
                }
                simple_unlock(&vnode_free_list_slock);
        }



Home | Main Index | Thread Index | Old Index