summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
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
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')
-rw-r--r--sys/dev/raidframe/rf_copyback.c16
-rw-r--r--sys/dev/raidframe/rf_disks.c16
-rw-r--r--sys/dev/raidframe/rf_reconstruct.c23
3 files changed, 17 insertions, 38 deletions
diff --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c
index 656d5fb1e78..8c5d5175041 100644
--- a/sys/dev/raidframe/rf_copyback.c
+++ b/sys/dev/raidframe/rf_copyback.c
@@ -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 **listp)
#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 *raidPtr)
struct pathbuf *dev_pb;
struct vnode *vp;
- struct vattr va;
int ac;
@@ -160,20 +161,15 @@ rf_CopybackReconstructedData(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)
- 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
diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c
index d16440c96a4..8769d4ad116 100644
--- a/sys/dev/raidframe/rf_disks.c
+++ b/sys/dev/raidframe/rf_disks.c
@@ -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 1.85 2014/03/25 16:19:14 christos Exp $
#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, char *bf, RF_RaidDisk_t *diskPtr,
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, char *bf, RF_RaidDisk_t *diskPtr,
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
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: