summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe/rf_reconstruct.c
diff options
context:
space:
mode:
authorhannken <hannken@NetBSD.org>2014-06-14 07:39:00 +0000
committerhannken <hannken@NetBSD.org>2014-06-14 07:39:00 +0000
commit972c4e43674c8f7855eb1ff4ccb9c2ec3be05bc0 (patch)
treee2c9bfd67c6e90a9ceb05b5d48bc465955949342 /sys/dev/raidframe/rf_reconstruct.c
parent88f50c82d078baa660c1e8b3792370f7b177ce03 (diff)
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
Diffstat (limited to 'sys/dev/raidframe/rf_reconstruct.c')
-rw-r--r--sys/dev/raidframe/rf_reconstruct.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c
index 572e1e1bcb9..17a507e9489 100644
--- a/sys/dev/raidframe/rf_reconstruct.c
+++ b/sys/dev/raidframe/rf_reconstruct.c
@@ -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_reconstruct.c,v 1.119 2013/03/06 11:38:15 yamt Ex
#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, RF_RowCol_t col)
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, RF_RowCol_t col)
/* 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, RF_RowCol_t col)
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: