Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/union When creating a union node representing a devic...



details:   https://anonhg.NetBSD.org/src/rev/6b8e6df45a29
branches:  trunk
changeset: 768225:6b8e6df45a29
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Aug 12 06:40:10 2011 +0000

description:
When creating a union node representing a device initialize
the spec_node to make vrele() happy.

diffstat:

 sys/fs/union/union_subr.c |  19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diffs (56 lines):

diff -r e226fc59c5dd -r 6b8e6df45a29 sys/fs/union/union_subr.c
--- a/sys/fs/union/union_subr.c Fri Aug 12 06:38:35 2011 +0000
+++ b/sys/fs/union/union_subr.c Fri Aug 12 06:40:10 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_subr.c,v 1.46 2011/08/10 15:56:01 hannken Exp $  */
+/*     $NetBSD: union_subr.c,v 1.47 2011/08/12 06:40:10 hannken Exp $  */
 
 /*
  * Copyright (c) 1994
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.46 2011/08/10 15:56:01 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.47 2011/08/12 06:40:10 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,6 +93,7 @@
 #include <uvm/uvm_extern.h>
 
 #include <fs/union/union.h>
+#include <miscfs/specfs/specdev.h>
 
 /* must be power of two, otherwise change UNION_HASH() */
 #define NHASH 32
@@ -342,6 +343,7 @@
        struct vnode *vp, *xlowervp = NULLVP;
        struct union_mount *um = MOUNTTOUNIONMOUNT(mp);
        voff_t uppersz, lowersz;
+       dev_t rdev;
        int hash = 0;
        int vflag, iflag;
        int try;
@@ -556,10 +558,19 @@
 
        (*vpp)->v_vflag |= vflag;
        (*vpp)->v_iflag |= iflag;
-       if (uppervp)
+       rdev = NODEV;
+       if (uppervp) {
                (*vpp)->v_type = uppervp->v_type;
-       else
+               if (uppervp->v_type == VCHR || uppervp->v_type == VBLK)
+                       rdev = uppervp->v_rdev;
+       } else {
                (*vpp)->v_type = lowervp->v_type;
+               if (lowervp->v_type == VCHR || lowervp->v_type == VBLK)
+                       rdev = lowervp->v_rdev;
+       }
+       if (rdev != NODEV)
+               spec_node_init(*vpp, rdev);
+
        un = VTOUNION(*vpp);
        un->un_vnode = *vpp;
        un->un_uppervp = uppervp;



Home | Main Index | Thread Index | Old Index