summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authorThierry Deval <tdeval@cvs.openbsd.org>2003-01-19 14:32:01 +0000
committerThierry Deval <tdeval@cvs.openbsd.org>2003-01-19 14:32:01 +0000
commit4313458ad98a8314c696b5100ea7cccd2b0923b3 (patch)
treee29062b45d1f0009c776864dd3bec06fbfcdb406 /sys/dev/raidframe
parent1f528c791537ae1f66aa5dac58dc2742c01d6c7f (diff)
Temporary fix for PR#3069 (thanks for the report, Alex Cichowski), until
I find time to really follow all cases. At least it works here, and doesn't add new problems, it seems.
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_disks.c8
-rw-r--r--sys/dev/raidframe/rf_engine.c21
-rw-r--r--sys/dev/raidframe/rf_openbsdkintf.c11
3 files changed, 17 insertions, 23 deletions
diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c
index f9ba8433298..c72a1ec7367 100644
--- a/sys/dev/raidframe/rf_disks.c
+++ b/sys/dev/raidframe/rf_disks.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rf_disks.c,v 1.7 2002/12/16 07:01:03 tdeval Exp $ */
+/* $OpenBSD: rf_disks.c,v 1.8 2003/01/19 14:32:00 tdeval Exp $ */
/* $NetBSD: rf_disks.c,v 1.31 2000/06/02 01:17:14 oster Exp $ */
/*
@@ -653,11 +653,7 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *buf, RF_RaidDisk_t *diskPtr,
}
(void) strcpy(diskPtr->devname, p);
-#if 0
proc = raidPtr->engine_thread;
-#else
- proc = curproc;
-#endif
/* Let's start by claiming the component is fine and well... */
diskPtr->status = rf_ds_optimal;
@@ -665,7 +661,7 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *buf, RF_RaidDisk_t *diskPtr,
raidPtr->raid_cinfo[row][col].ci_vp = NULL;
raidPtr->raid_cinfo[row][col].ci_dev = NULL;
- error = raidlookup(diskPtr->devname, proc, &vp);
+ error = raidlookup(diskPtr->devname, curproc, &vp);
if (error) {
printf("raidlookup on device: %s failed !\n", diskPtr->devname);
if (error == ENXIO) {
diff --git a/sys/dev/raidframe/rf_engine.c b/sys/dev/raidframe/rf_engine.c
index 458ab8c00b3..e30e9f9f56f 100644
--- a/sys/dev/raidframe/rf_engine.c
+++ b/sys/dev/raidframe/rf_engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rf_engine.c,v 1.13 2002/12/16 07:01:03 tdeval Exp $ */
+/* $OpenBSD: rf_engine.c,v 1.14 2003/01/19 14:32:00 tdeval Exp $ */
/* $NetBSD: rf_engine.c,v 1.10 2000/08/20 16:51:03 thorpej Exp $ */
/*
@@ -159,7 +159,8 @@ rf_ConfigureEngine(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
* thread.
*/
if (rf_engineDebug) {
- printf("raid%d: Creating engine thread\n", raidPtr->raidid);
+ printf("raid%d: %s engine thread\n", raidPtr->raidid,
+ (initproc)?"Starting":"Creating");
}
if (rf_hook_cookies == NULL) {
rf_hook_cookies =
@@ -179,12 +180,12 @@ rf_ConfigureEngine(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
snprintf(&raidname[0], 16, "raid%d", raidPtr->raidid);
if (RF_CREATE_THREAD(raidPtr->engine_thread,
rf_DAGExecutionThread, raidPtr, &raidname[0])) {
- RF_ERRORMSG("RAIDFRAME: Unable to create engine"
+ RF_ERRORMSG("RAIDFRAME: Unable to start engine"
" thread\n");
return (ENOMEM);
}
if (rf_engineDebug) {
- printf("raid%d: Created engine thread\n",
+ printf("raid%d: Engine thread started\n",
raidPtr->raidid);
}
RF_THREADGROUP_STARTED(&raidPtr->engine_tg);
@@ -306,7 +307,7 @@ rf_FireNode(RF_DagNode_t *node)
switch (node->status) {
case rf_fired:
/* Fire the do function of a node. */
- if (rf_engineDebug) {
+ if (rf_engineDebug>1) {
printf("raid%d: Firing node 0x%lx (%s)\n",
node->dagHdr->raidPtr->raidid,
(unsigned long) node, node->name);
@@ -327,7 +328,7 @@ rf_FireNode(RF_DagNode_t *node)
break;
case rf_recover:
/* Fire the undo function of a node. */
- if (rf_engineDebug) {
+ if (rf_engineDebug>1) {
printf("raid%d: Firing (undo) node 0x%lx (%s)\n",
node->dagHdr->raidPtr->raidid,
(unsigned long) node, node->name);
@@ -798,7 +799,7 @@ rf_DispatchDAG(RF_DagHeader_t *dag, void (*cbFunc) (void *), void *cbArg)
if (rf_ValidateDAG(dag))
RF_PANIC();
}
- if (rf_engineDebug) {
+ if (rf_engineDebug>1) {
printf("raid%d: Entering DispatchDAG\n", raidPtr->raidid);
}
raidPtr->dags_in_flight++; /*
@@ -839,7 +840,7 @@ rf_DAGExecutionThread_pre(RF_ThreadArg_t arg)
raidPtr = (RF_Raid_t *) arg;
if (rf_engineDebug) {
- printf("raid%d: Creating engine thread\n", raidPtr->raidid);
+ printf("raid%d: Starting engine thread\n", raidPtr->raidid);
}
lastpid = RF_ENGINE_PID + raidPtr->raidid - 1;
@@ -851,13 +852,13 @@ rf_DAGExecutionThread_pre(RF_ThreadArg_t arg)
if (RF_CREATE_THREAD(raidPtr->engine_thread, rf_DAGExecutionThread,
raidPtr, &raidname[0])) {
- RF_ERRORMSG("RAIDFRAME: Unable to create engine thread\n");
+ RF_ERRORMSG("RAIDFRAME: Unable to start engine thread\n");
return;
}
lastpid = oldpid;
if (rf_engineDebug) {
- printf("raid%d: Created engine thread\n", raidPtr->raidid);
+ printf("raid%d: Engine thread started\n", raidPtr->raidid);
}
RF_THREADGROUP_STARTED(&raidPtr->engine_tg);
}
diff --git a/sys/dev/raidframe/rf_openbsdkintf.c b/sys/dev/raidframe/rf_openbsdkintf.c
index c8b446653d1..a527f732dbe 100644
--- a/sys/dev/raidframe/rf_openbsdkintf.c
+++ b/sys/dev/raidframe/rf_openbsdkintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rf_openbsdkintf.c,v 1.21 2002/12/16 07:01:04 tdeval Exp $ */
+/* $OpenBSD: rf_openbsdkintf.c,v 1.22 2003/01/19 14:32:00 tdeval Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.109 2001/07/27 03:30:07 oster Exp $ */
/*-
@@ -2222,11 +2222,7 @@ raidmakedisklabel(struct raid_softc *rs)
* You'll find the original of this in ccd.c
*/
int
-raidlookup(
- char *path,
- struct proc *p,
- struct vnode **vpp /* result */
-)
+raidlookup(char *path, struct proc *p, struct vnode **vpp /* result */)
{
struct nameidata nd;
struct vnode *vp;
@@ -2614,7 +2610,8 @@ rf_close_component(RF_Raid_t *raidPtr, struct vnode *vp, int auto_configured)
vrele(vp);
} else {
- VOP_UNLOCK(vp, 0, p);
+ if (VOP_ISLOCKED(vp))
+ VOP_UNLOCK(vp, 0, p);
(void) vn_close(vp, FREAD | FWRITE, p->p_ucred, p);
}
} else {