Module Name:    src
Committed By:   hannken
Date:           Sat Jun 14 07:39:01 UTC 2014

Modified Files:
        src/sys/dev: ccd.c cgd.c dksubr.c
        src/sys/dev/dm: dm.h dm_target_linear.c dm_target_snapshot.c
            dm_target_stripe.c
        src/sys/dev/raidframe: rf_copyback.c rf_disks.c rf_reconstruct.c
        src/sys/sys: param.h

Log Message:
Change dk_lookup() to return an anonymous vnode not associated with
any file system.  Change all consumers of dk_lookup() to get the
device from "v_rdev" instead of VOP_GETATTR() as specfs does not
support VOP_GETATTR().  Devices obtained with dk_lookup() will no
longer disappear on forced unmounts.

Fix for PR kern/48849 (root mirror raid fails on shutdown)

Welcome to 6.99.44


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/ccd.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/cgd.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/dksubr.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/raidframe/rf_copyback.c
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/raidframe/rf_disks.c
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/raidframe/rf_reconstruct.c
cvs rdiff -u -r1.453 -r1.454 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ccd.c
diff -u src/sys/dev/ccd.c:1.148 src/sys/dev/ccd.c:1.149
--- src/sys/dev/ccd.c:1.148	Sun Apr  6 00:56:39 2014
+++ src/sys/dev/ccd.c	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd.c,v 1.148 2014/04/06 00:56:39 joerg Exp $	*/
+/*	$NetBSD: ccd.c,v 1.149 2014/06/14 07:39:00 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.148 2014/04/06 00:56:39 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.149 2014/06/14 07:39:00 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -121,6 +121,8 @@ __KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.14
 #include <dev/ccdvar.h>
 #include <dev/dkvar.h>
 
+#include <miscfs/specfs/specdev.h> /* for v_rdev */
+
 #if defined(CCDDEBUG) && !defined(DEBUG)
 #define DEBUG
 #endif
@@ -292,7 +294,6 @@ ccdinit(struct ccd_softc *cs, char **cpa
 {
 	struct ccdcinfo *ci = NULL;
 	int ix;
-	struct vattr va;
 	struct ccdgeom *ccg = &cs->sc_geom;
 	char *tmppath;
 	int error, path_alloced;
@@ -344,19 +345,7 @@ ccdinit(struct ccd_softc *cs, char **cpa
 		/*
 		 * XXX: Cache the component's dev_t.
 		 */
-		vn_lock(vpp[ix], LK_SHARED | LK_RETRY);
-		error = VOP_GETATTR(vpp[ix], &va, l->l_cred);
-		VOP_UNLOCK(vpp[ix]);
-		if (error != 0) {
-#ifdef DEBUG
-			if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
-				printf("%s: %s: getattr failed %s = %d\n",
-				    cs->sc_xname, ci->ci_path,
-				    "error", error);
-#endif
-			goto out;
-		}
-		ci->ci_dev = va.va_rdev;
+		ci->ci_dev = vpp[ix]->v_rdev;
 
 		/*
 		 * Get partition information for the component.

Index: src/sys/dev/cgd.c
diff -u src/sys/dev/cgd.c:1.87 src/sys/dev/cgd.c:1.88
--- src/sys/dev/cgd.c:1.87	Sun May 25 19:23:49 2014
+++ src/sys/dev/cgd.c	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.87 2014/05/25 19:23:49 bouyer Exp $ */
+/* $NetBSD: cgd.c,v 1.88 2014/06/14 07:39:00 hannken Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.87 2014/05/25 19:23:49 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.88 2014/06/14 07:39:00 hannken Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -55,6 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.87
 #include <dev/dkvar.h>
 #include <dev/cgdvar.h>
 
+#include <miscfs/specfs/specdev.h> /* for v_rdev */
+
 /* Entry Point Functions */
 
 void	cgdattach(int);
@@ -809,7 +811,6 @@ cgdinit(struct cgd_softc *cs, const char
 	struct lwp *l)
 {
 	struct	disk_geom *dg;
-	struct	vattr va;
 	int	ret;
 	char	*tmppath;
 	uint64_t psize;
@@ -826,13 +827,7 @@ cgdinit(struct cgd_softc *cs, const char
 	cs->sc_tpath = malloc(cs->sc_tpathlen, M_DEVBUF, M_WAITOK);
 	memcpy(cs->sc_tpath, tmppath, cs->sc_tpathlen);
 
-	vn_lock(vp, LK_SHARED | LK_RETRY);
-	ret = VOP_GETATTR(vp, &va, l->l_cred);
-	VOP_UNLOCK(vp);
-	if (ret != 0)
-		goto bail;
-
-	cs->sc_tdev = va.va_rdev;
+	cs->sc_tdev = vp->v_rdev;
 
 	if ((ret = getdisksize(vp, &psize, &secsize)) != 0)
 		goto bail;

Index: src/sys/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.50 src/sys/dev/dksubr.c:1.51
--- src/sys/dev/dksubr.c:1.50	Sun May 25 19:23:49 2014
+++ src/sys/dev/dksubr.c	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.50 2014/05/25 19:23:49 bouyer Exp $ */
+/* $NetBSD: dksubr.c,v 1.51 2014/06/14 07:39:00 hannken Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.50 2014/05/25 19:23:49 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.51 2014/06/14 07:39:00 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1
 #include <sys/module.h>
 
 #include <dev/dkvar.h>
+#include <miscfs/specfs/specdev.h> /* for v_rdev */
 
 int	dkdebug = 0;
 
@@ -621,7 +622,6 @@ dk_lookup(struct pathbuf *pb, struct lwp
 {
 	struct nameidata nd;
 	struct vnode *vp;
-	struct vattr va;
 	int     error;
 
 	if (l == NULL)
@@ -635,22 +635,29 @@ dk_lookup(struct pathbuf *pb, struct lwp
 	}
 
 	vp = nd.ni_vp;
-	if ((error = VOP_GETATTR(vp, &va, l->l_cred)) != 0) {
-		DPRINTF((DKDB_FOLLOW|DKDB_INIT),
-		    ("dk_lookup: getattr error = %d\n", error));
+	if (vp->v_type != VBLK) {
+		error = ENOTBLK;
 		goto out;
 	}
 
-	/* XXX: eventually we should handle VREG, too. */
-	if (va.va_type != VBLK) {
-		error = ENOTBLK;
+	/* Reopen as anonymous vnode to protect against forced unmount. */
+	if ((error = bdevvp(vp->v_rdev, vpp)) != 0)
 		goto out;
+	VOP_UNLOCK(vp);
+	if ((error = vn_close(vp, FREAD | FWRITE, l->l_cred)) != 0) {
+		vrele(*vpp);
+		return error;
+	}
+	if ((error = VOP_OPEN(*vpp, FREAD | FWRITE, l->l_cred)) != 0) {
+		vrele(*vpp);
+		return error;
 	}
+	mutex_enter((*vpp)->v_interlock);
+	(*vpp)->v_writecount++;
+	mutex_exit((*vpp)->v_interlock);
 
-	IFDEBUG(DKDB_VNODE, vprint("dk_lookup: vnode info", vp));
+	IFDEBUG(DKDB_VNODE, vprint("dk_lookup: vnode info", *vpp));
 
-	VOP_UNLOCK(vp);
-	*vpp = vp;
 	return 0;
 out:
 	VOP_UNLOCK(vp);

Index: src/sys/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.25 src/sys/dev/dm/dm.h:1.26
--- src/sys/dev/dm/dm.h:1.25	Mon Dec  9 09:35:16 2013
+++ src/sys/dev/dm/dm.h	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm.h,v 1.25 2013/12/09 09:35:16 wiz Exp $      */
+/*        $NetBSD: dm.h,v 1.26 2014/06/14 07:39:00 hannken Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -49,6 +49,8 @@
 #include <sys/disk.h>
 #include <sys/disklabel.h>
 
+#include <miscfs/specfs/specdev.h> /* for v_rdev */
+
 #include <prop/proplib.h>
 
 #define DM_MAX_TYPE_NAME 16

Index: src/sys/dev/dm/dm_target_linear.c
diff -u src/sys/dev/dm/dm_target_linear.c:1.13 src/sys/dev/dm/dm_target_linear.c:1.14
--- src/sys/dev/dm/dm_target_linear.c:1.13	Fri Oct 14 09:23:30 2011
+++ src/sys/dev/dm/dm_target_linear.c	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_linear.c,v 1.13 2011/10/14 09:23:30 hannken Exp $      */
+/*        $NetBSD: dm_target_linear.c,v 1.14 2014/06/14 07:39:00 hannken Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -192,22 +192,14 @@ int
 dm_target_linear_deps(dm_table_entry_t * table_en, prop_array_t prop_array)
 {
 	dm_target_linear_config_t *tlc;
-	struct vattr va;
-
-	int error;
 
 	if (table_en->target_config == NULL)
 		return ENOENT;
 
 	tlc = table_en->target_config;
 
-	vn_lock(tlc->pdev->pdev_vnode, LK_SHARED | LK_RETRY);
-	error = VOP_GETATTR(tlc->pdev->pdev_vnode, &va, curlwp->l_cred);
-	VOP_UNLOCK(tlc->pdev->pdev_vnode);
-	if (error != 0)
-		return error;
-
-	prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev);
+	prop_array_add_uint64(prop_array,
+	    (uint64_t) tlc->pdev->pdev_vnode->v_rdev);
 
 	return 0;
 }

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.15 src/sys/dev/dm/dm_target_snapshot.c:1.16
--- src/sys/dev/dm/dm_target_snapshot.c:1.15	Fri Oct 14 09:23:30 2011
+++ src/sys/dev/dm/dm_target_snapshot.c	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_snapshot.c,v 1.15 2011/10/14 09:23:30 hannken Exp $      */
+/*        $NetBSD: dm_target_snapshot.c,v 1.16 2014/06/14 07:39:00 hannken Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -348,33 +348,18 @@ dm_target_snapshot_deps(dm_table_entry_t
     prop_array_t prop_array)
 {
 	dm_target_snapshot_config_t *tsc;
-	struct vattr va;
-
-	int error;
 
 	if (table_en->target_config == NULL)
 		return 0;
 
 	tsc = table_en->target_config;
 
-	vn_lock(tsc->tsc_snap_dev->pdev_vnode, LK_SHARED | LK_RETRY);
-	error = VOP_GETATTR(tsc->tsc_snap_dev->pdev_vnode, &va, curlwp->l_cred);
-	VOP_UNLOCK(tsc->tsc_snap_dev->pdev_vnode);
-	if (error != 0)
-		return error;
-
-	prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev);
+	prop_array_add_uint64(prop_array,
+	    (uint64_t) tsc->tsc_snap_dev->pdev_vnode->v_rdev);
 
 	if (tsc->tsc_persistent_dev) {
-
-		vn_lock(tsc->tsc_cow_dev->pdev_vnode, LK_SHARED | LK_RETRY);
-		error = VOP_GETATTR(tsc->tsc_cow_dev->pdev_vnode, &va,
-		    curlwp->l_cred);
-		VOP_UNLOCK(tsc->tsc_cow_dev->pdev_vnode);
-		if (error != 0)
-			return error;
-
-		prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev);
+		prop_array_add_uint64(prop_array,
+		    (uint64_t) tsc->tsc_cow_dev->pdev_vnode->v_rdev);
 
 	}
 	return 0;

Index: src/sys/dev/dm/dm_target_stripe.c
diff -u src/sys/dev/dm/dm_target_stripe.c:1.18 src/sys/dev/dm/dm_target_stripe.c:1.19
--- src/sys/dev/dm/dm_target_stripe.c:1.18	Tue Aug  7 16:11:11 2012
+++ src/sys/dev/dm/dm_target_stripe.c	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_stripe.c,v 1.18 2012/08/07 16:11:11 haad Exp $*/
+/*$NetBSD: dm_target_stripe.c,v 1.19 2014/06/14 07:39:00 hannken Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -319,9 +319,6 @@ dm_target_stripe_deps(dm_table_entry_t *
 {
 	dm_target_stripe_config_t *tsc;
 	dm_target_linear_config_t *tlc;
-	struct vattr va;
-
-	int error;
 
 	if (table_en->target_config == NULL)
 		return ENOENT;
@@ -329,13 +326,8 @@ dm_target_stripe_deps(dm_table_entry_t *
 	tsc = table_en->target_config;
 
 	TAILQ_FOREACH(tlc, &tsc->stripe_devs, entries) {
-		vn_lock(tlc->pdev->pdev_vnode, LK_SHARED | LK_RETRY);
-		error = VOP_GETATTR(tlc->pdev->pdev_vnode, &va, curlwp->l_cred);
-		VOP_UNLOCK(tlc->pdev->pdev_vnode);
-		if (error != 0)
-			return error;
-
-		prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev);
+		prop_array_add_uint64(prop_array,
+		    (uint64_t) tlc->pdev->pdev_vnode->v_rdev);
 	}
 
 	return 0;

Index: src/sys/dev/raidframe/rf_copyback.c
diff -u src/sys/dev/raidframe/rf_copyback.c:1.49 src/sys/dev/raidframe/rf_copyback.c:1.50
--- src/sys/dev/raidframe/rf_copyback.c:1.49	Fri Oct 14 09:23:30 2011
+++ src/sys/dev/raidframe/rf_copyback.c	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_copyback.c,v 1.49 2011/10/14 09:23:30 hannken Exp $	*/
+/*	$NetBSD: rf_copyback.c,v 1.50 2014/06/14 07:39:00 hannken Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -38,7 +38,7 @@
  ****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.49 2011/10/14 09:23:30 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.50 2014/06/14 07:39:00 hannken Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -83,6 +83,8 @@ rf_ConfigureCopyback(RF_ShutdownList_t *
 #include <sys/vnode.h>
 #include <sys/namei.h> /* for pathbuf */
 
+#include <miscfs/specfs/specdev.h> /* for v_rdev */
+
 /* do a complete copyback */
 void
 rf_CopybackReconstructedData(RF_Raid_t *raidPtr)
@@ -96,7 +98,6 @@ rf_CopybackReconstructedData(RF_Raid_t *
 
 	struct pathbuf *dev_pb;
 	struct vnode *vp;
-	struct vattr va;
 
 	int ac;
 
@@ -160,20 +161,15 @@ rf_CopybackReconstructedData(RF_Raid_t *
 		/* Ok, so we can at least do a lookup... How about actually
 		 * getting a vp for it? */
 
-		vn_lock(vp, LK_SHARED | LK_RETRY);
-		retcode = VOP_GETATTR(vp, &va, curlwp->l_cred);
-		VOP_UNLOCK(vp);
-		if (retcode != 0)
-			return;
 		retcode = rf_getdisksize(vp, &raidPtr->Disks[fcol]);
 		if (retcode) {
 			return;
 		}
 
 		raidPtr->raid_cinfo[fcol].ci_vp = vp;
-		raidPtr->raid_cinfo[fcol].ci_dev = va.va_rdev;
+		raidPtr->raid_cinfo[fcol].ci_dev = vp->v_rdev;
 
-		raidPtr->Disks[fcol].dev = va.va_rdev;	/* XXX or the above? */
+		raidPtr->Disks[fcol].dev = vp->v_rdev;	/* XXX or the above? */
 
 		/* we allow the user to specify that only a fraction of the
 		 * disks should be used this is just for debug:  it speeds up

Index: src/sys/dev/raidframe/rf_disks.c
diff -u src/sys/dev/raidframe/rf_disks.c:1.85 src/sys/dev/raidframe/rf_disks.c:1.86
--- src/sys/dev/raidframe/rf_disks.c:1.85	Tue Mar 25 16:19:14 2014
+++ src/sys/dev/raidframe/rf_disks.c	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_disks.c,v 1.85 2014/03/25 16:19:14 christos Exp $	*/
+/*	$NetBSD: rf_disks.c,v 1.86 2014/06/14 07:39:00 hannken Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -60,7 +60,7 @@
  ***************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.85 2014/03/25 16:19:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.86 2014/06/14 07:39:00 hannken Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -80,6 +80,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v
 #include <sys/vnode.h>
 #include <sys/namei.h> /* for pathbuf */
 #include <sys/kauth.h>
+#include <miscfs/specfs/specdev.h> /* for v_rdev */
 
 static int rf_AllocDiskStructures(RF_Raid_t *, RF_Config_t *);
 static void rf_print_label_status( RF_Raid_t *, int, char *,
@@ -576,7 +577,6 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, cha
 	char   *p;
 	struct pathbuf *pb;
 	struct vnode *vp;
-	struct vattr va;
 	int     error;
 
 	p = rf_find_non_white(bf);
@@ -631,18 +631,12 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, cha
 		raidPtr->bytesPerSector = diskPtr->blockSize;
 
 	if (diskPtr->status == rf_ds_optimal) {
-		vn_lock(vp, LK_SHARED | LK_RETRY);
-		error = VOP_GETATTR(vp, &va, curlwp->l_cred);
-		VOP_UNLOCK(vp);
-		if (error != 0)
-			return (error);
-
 		raidPtr->raid_cinfo[col].ci_vp = vp;
-		raidPtr->raid_cinfo[col].ci_dev = va.va_rdev;
+		raidPtr->raid_cinfo[col].ci_dev = vp->v_rdev;
 
 		/* This component was not automatically configured */
 		diskPtr->auto_configured = 0;
-		diskPtr->dev = va.va_rdev;
+		diskPtr->dev = vp->v_rdev;
 
 		/* we allow the user to specify that only a fraction of the
 		 * disks should be used this is just for debug:  it speeds up

Index: src/sys/dev/raidframe/rf_reconstruct.c
diff -u src/sys/dev/raidframe/rf_reconstruct.c:1.119 src/sys/dev/raidframe/rf_reconstruct.c:1.120
--- src/sys/dev/raidframe/rf_reconstruct.c:1.119	Wed Mar  6 11:38:15 2013
+++ src/sys/dev/raidframe/rf_reconstruct.c	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconstruct.c,v 1.119 2013/03/06 11:38:15 yamt Exp $	*/
+/*	$NetBSD: rf_reconstruct.c,v 1.120 2014/06/14 07:39:00 hannken Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  ************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.119 2013/03/06 11:38:15 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.120 2014/06/14 07:39:00 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
@@ -47,6 +47,8 @@ __KERNEL_RCSID(0, "$NetBSD: rf_reconstru
 #include <sys/namei.h> /* for pathbuf */
 #include <dev/raidframe/raidframevar.h>
 
+#include <miscfs/specfs/specdev.h> /* for v_rdev */
+
 #include "rf_raid.h"
 #include "rf_reconutil.h"
 #include "rf_revent.h"
@@ -352,7 +354,6 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr
 	unsigned int secsize;
 	struct pathbuf *pb;
 	struct vnode *vp;
-	struct vattr va;
 	int retcode;
 	int ac;
 
@@ -456,18 +457,6 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr
 	/* Ok, so we can at least do a lookup...
 	   How about actually getting a vp for it? */
 
-	vn_lock(vp, LK_SHARED | LK_RETRY);
-	retcode = VOP_GETATTR(vp, &va, curlwp->l_cred);
-	VOP_UNLOCK(vp);
-	if (retcode != 0) {
-		vn_close(vp, FREAD | FWRITE, kauth_cred_get());
-		rf_lock_mutex2(raidPtr->mutex);
-		raidPtr->reconInProgress--;
-		rf_signal_cond2(raidPtr->waitForReconCond);
-		rf_unlock_mutex2(raidPtr->mutex);
-		return(retcode);
-	}
-
 	retcode = getdisksize(vp, &numsec, &secsize);
 	if (retcode) {
 		vn_close(vp, FREAD | FWRITE, kauth_cred_get());
@@ -482,9 +471,9 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr
 	raidPtr->Disks[col].numBlocks = numsec - rf_protectedSectors;
 
 	raidPtr->raid_cinfo[col].ci_vp = vp;
-	raidPtr->raid_cinfo[col].ci_dev = va.va_rdev;
+	raidPtr->raid_cinfo[col].ci_dev = vp->v_rdev;
 
-	raidPtr->Disks[col].dev = va.va_rdev;
+	raidPtr->Disks[col].dev = vp->v_rdev;
 
 	/* we allow the user to specify that only a fraction
 	   of the disks should be used this is just for debug:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.453 src/sys/sys/param.h:1.454
--- src/sys/sys/param.h:1.453	Sat May 24 16:34:03 2014
+++ src/sys/sys/param.h	Sat Jun 14 07:39:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.453 2014/05/24 16:34:03 christos Exp $	*/
+/*	$NetBSD: param.h,v 1.454 2014/06/14 07:39:00 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	699004300	/* NetBSD 6.99.43 */
+#define	__NetBSD_Version__	699004400	/* NetBSD 6.99.44 */
 
 #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
     (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)

Reply via email to