Source-Changes-HG archive

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

[src/trunk]: src/sys Define VLAYER and make layered fs's set this flag when c...



details:   https://anonhg.NetBSD.org/src/rev/4058d3de14a9
branches:  trunk
changeset: 474686:4058d3de14a9
user:      wrstuden <wrstuden%NetBSD.org@localhost>
date:      Thu Jul 15 21:30:31 1999 +0000

description:
Define VLAYER and make layered fs's set this flag when creating their vnodes.

getnewvnode now checks this bit, and it if's set makes sure a vnode's not
locked before removing it from the free list.

Closes PR 7954 by Alan Barrett <apb%iafrica.com@localhost>.

diffstat:

 sys/kern/vfs_subr.c           |  13 ++++++++++---
 sys/miscfs/genfs/layer_subr.c |   3 ++-
 sys/miscfs/union/union_subr.c |   4 ++--
 sys/sys/vnode.h               |   3 ++-
 4 files changed, 16 insertions(+), 7 deletions(-)

diffs (79 lines):

diff -r 556c59ad530d -r 4058d3de14a9 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Thu Jul 15 19:09:40 1999 +0000
+++ b/sys/kern/vfs_subr.c       Thu Jul 15 21:30:31 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.104 1999/07/08 01:06:01 wrstuden Exp $  */
+/*     $NetBSD: vfs_subr.c,v 1.105 1999/07/15 21:30:31 wrstuden Exp $  */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -432,8 +432,15 @@
        } else {
                for (vp = vnode_free_list.tqh_first;
                                vp != NULLVP; vp = vp->v_freelist.tqe_next) {
-                       if (simple_lock_try(&vp->v_interlock))
-                               break;
+                       if (simple_lock_try(&vp->v_interlock)) {
+                               if ((vp->v_flag & VLAYER) == 0) {
+                                       break;
+                               }
+                               if (VOP_ISLOCKED(vp) == 0)
+                                       break;
+                               else
+                                       simple_unlock(&vp->v_interlock);
+                       }
                }
                /*
                 * Unless this is a bad time of the month, at most
diff -r 556c59ad530d -r 4058d3de14a9 sys/miscfs/genfs/layer_subr.c
--- a/sys/miscfs/genfs/layer_subr.c     Thu Jul 15 19:09:40 1999 +0000
+++ b/sys/miscfs/genfs/layer_subr.c     Thu Jul 15 21:30:31 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: layer_subr.c,v 1.2 1999/07/12 16:37:03 wrstuden Exp $  */
+/*     $NetBSD: layer_subr.c,v 1.3 1999/07/15 21:30:32 wrstuden Exp $  */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -184,6 +184,7 @@
                        &vp)) != 0)
                return (error);
        vp->v_type = lowervp->v_type;
+       vp->v_flag |= VLAYER;
 
        MALLOC(xp, struct layer_node *, lmp->layerm_size, M_TEMP, M_WAITOK);
        if (vp->v_type == VBLK || vp->v_type == VCHR) {
diff -r 556c59ad530d -r 4058d3de14a9 sys/miscfs/union/union_subr.c
--- a/sys/miscfs/union/union_subr.c     Thu Jul 15 19:09:40 1999 +0000
+++ b/sys/miscfs/union/union_subr.c     Thu Jul 15 21:30:31 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_subr.c,v 1.33 1999/07/08 01:26:29 wrstuden Exp $ */
+/*     $NetBSD: union_subr.c,v 1.34 1999/07/15 21:30:32 wrstuden Exp $ */
 
 /*
  * Copyright (c) 1994 Jan-Simon Pendry
@@ -312,7 +312,7 @@
        }
 
        /* detect the root vnode (and aliases) */
-       vflag = 0;
+       vflag = VLAYER;
        if ((uppervp == um->um_uppervp) &&
            ((lowervp == NULLVP) || lowervp == um->um_lowervp)) {
                if (lowervp == NULLVP) {
diff -r 556c59ad530d -r 4058d3de14a9 sys/sys/vnode.h
--- a/sys/sys/vnode.h   Thu Jul 15 19:09:40 1999 +0000
+++ b/sys/sys/vnode.h   Thu Jul 15 21:30:31 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnode.h,v 1.61 1999/07/07 23:30:03 wrstuden Exp $      */
+/*     $NetBSD: vnode.h,v 1.62 1999/07/15 21:30:32 wrstuden Exp $      */
 
 /*
  * Copyright (c) 1989, 1993
@@ -149,6 +149,7 @@
 #define        VBWAIT          0x0400  /* waiting for output to complete */
 #define        VALIASED        0x0800  /* vnode has an alias */
 #define        VDIROP          0x1000  /* LFS: vnode is involved in a directory op */
+#define VLAYER         0x2000  /* vnode is on a layer filesystem */
 
 /*
  * Vnode attributes.  A field value of VNOVAL represents a field whose value



Home | Main Index | Thread Index | Old Index