Module Name: src
Committed By: hannken
Date: Fri Aug 12 06:40:10 UTC 2011
Modified Files:
src/sys/fs/union: union_subr.c
Log Message:
When creating a union node representing a device initialize
the spec_node to make vrele() happy.
To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/fs/union/union_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/union/union_subr.c
diff -u src/sys/fs/union/union_subr.c:1.46 src/sys/fs/union/union_subr.c:1.47
--- src/sys/fs/union/union_subr.c:1.46 Wed Aug 10 15:56:01 2011
+++ src/sys/fs/union/union_subr.c Fri Aug 12 06:40:10 2011
@@ -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;