CVS commit: src/sys/dev/raidframe

2023-10-15 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun Oct 15 18:15:20 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_dagdegwr.c rf_dagffwr.c rf_pq.c rf_pqdeg.c
rf_pqdegdags.c rf_pqdegdags.h

Log Message:
Make RF_INCLUDE_RAID6 build (needs more changes to make it work).

Fix function signatures - recovFunc has a return type of void.
Fix obvious errors/typos from previous "mechanical changes".
MapSector no longer takes a row value.
Cleanup (now unused) row usage.
rf_bxor() doesn't take a bp argument.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/raidframe/rf_dagdegwr.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_dagffwr.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/raidframe/rf_pq.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/raidframe/rf_pqdeg.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_pqdegdags.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/raidframe/rf_pqdegdags.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/raidframe/rf_dagdegwr.c
diff -u src/sys/dev/raidframe/rf_dagdegwr.c:1.36 src/sys/dev/raidframe/rf_dagdegwr.c:1.37
--- src/sys/dev/raidframe/rf_dagdegwr.c:1.36	Fri Jul 23 00:54:45 2021
+++ src/sys/dev/raidframe/rf_dagdegwr.c	Sun Oct 15 18:15:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_dagdegwr.c,v 1.36 2021/07/23 00:54:45 oster Exp $	*/
+/*	$NetBSD: rf_dagdegwr.c,v 1.37 2023/10/15 18:15:19 oster Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.36 2021/07/23 00:54:45 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.37 2023/10/15 18:15:19 oster Exp $");
 
 #include 
 
@@ -382,8 +382,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF
 	/* fill in the Wnq Node */
 	if (nfaults == 2) {
 		{
-			parityPA = RF_MallocAndAdd(sizeof(*parityPA),
-			allocList);
+			parityPDA = RF_MallocAndAdd(sizeof(*parityPDA), allocList);
 			parityPDA->col = asmap->qInfo->col;
 			parityPDA->startSector = ((asmap->qInfo->startSector / sectorsPerSU)
 			* sectorsPerSU) + (failedPDA->startSector % sectorsPerSU);
@@ -566,7 +565,7 @@ rf_CommonCreateSimpleDegradedWriteDAG(RF
   pda_p->numSector = num; \
   pda_p->next = NULL; \
   pda_p->bufPtr = BUF_ALLOC(num)
-#if (RF_INCLUDE_PQ > 0) || (RF_INCLUDE_EVENODD > 0)
+#if (RF_INCLUDE_RAID6 > 0) || (RF_INCLUDE_PQ > 0) || (RF_INCLUDE_EVENODD > 0)
 void
 rf_WriteGenerateFailedAccessASMs(
 RF_Raid_t * raidPtr,

Index: src/sys/dev/raidframe/rf_dagffwr.c
diff -u src/sys/dev/raidframe/rf_dagffwr.c:1.37 src/sys/dev/raidframe/rf_dagffwr.c:1.38
--- src/sys/dev/raidframe/rf_dagffwr.c:1.37	Fri Jul 23 00:54:45 2021
+++ src/sys/dev/raidframe/rf_dagffwr.c	Sun Oct 15 18:15:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_dagffwr.c,v 1.37 2021/07/23 00:54:45 oster Exp $	*/
+/*	$NetBSD: rf_dagffwr.c,v 1.38 2023/10/15 18:15:20 oster Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.37 2021/07/23 00:54:45 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.38 2023/10/15 18:15:20 oster Exp $");
 
 #include 
 
@@ -229,7 +229,7 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t *
 
 #if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0)
 	if (nfaults == 2) {
-		wnqNode = rf_AllocDAGNode();
+		wnqNode = rf_AllocDAGNode(raidPtr);
 	} else {
 		wnqNode = NULL;
 	}
@@ -850,7 +850,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *
 	7, 1, dag_h, qname, allocList);
 tmpqNode->params[0] = tmpreadDataNode->params[0];
 tmpqNode->params[1] = tmpreadDataNode->params[1];
-tmpqNode->params[2] = tmpreadQNode->.params[0];
+tmpqNode->params[2] = tmpreadQNode->params[0];
 tmpqNode->params[3] = tmpreadQNode->params[1];
 tmpqNode->params[4] = tmpwriteDataNode->params[0];
 tmpqNode->params[5] = tmpwriteDataNode->params[1];
@@ -858,7 +858,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *
 /* use old Q buf as target buf */
 tmpqNode->results[0] = tmpreadQNode->params[1].p;
 tmpqNode = tmpqNode->list_next;
-tmpreadQNodes = tmpreadQNodes->list_next;
+tmpreadQNode = tmpreadQNode->list_next;
 			}
 #endif
 			tmpxorNode = tmpxorNode->list_next;
@@ -1078,7 +1078,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t *
 			tmpqNode = qNodes;
 			for (j = 0; j < numParityNodes; j++) {
 tmpreadQNode->succedents[j] = tmpqNode;
-tmpqNode->antecedents[numDataNodes + i] = tmpreadQNodes;
+tmpqNode->antecedents[numDataNodes + i] = tmpreadQNode;
 tmpqNode->antType[numDataNodes + i] = rf_trueData;
 tmpqNode = tmpqNode->list_next;
 			}

Index: src/sys/dev/raidframe/rf_pq.c
diff -u src/sys/dev/raidframe/rf_pq.c:1.17 src/sys/dev/raidframe/rf_pq.c:1.18
--- src/sys/dev/raidframe/rf_pq.c:1.17	Thu Oct 10 03:43:59 2019
+++ src/sys/dev/raidframe/rf_pq.c	Sun Oct 15 18:15:20 2023
@@ -1,4 

CVS commit: src/sys/dev/raidframe

2023-10-15 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun Oct 15 18:15:20 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_dagdegwr.c rf_dagffwr.c rf_pq.c rf_pqdeg.c
rf_pqdegdags.c rf_pqdegdags.h

Log Message:
Make RF_INCLUDE_RAID6 build (needs more changes to make it work).

Fix function signatures - recovFunc has a return type of void.
Fix obvious errors/typos from previous "mechanical changes".
MapSector no longer takes a row value.
Cleanup (now unused) row usage.
rf_bxor() doesn't take a bp argument.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/raidframe/rf_dagdegwr.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_dagffwr.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/raidframe/rf_pq.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/raidframe/rf_pqdeg.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_pqdegdags.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/raidframe/rf_pqdegdags.h

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



CVS commit: src/sys/dev/raidframe

2023-10-09 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Mon Oct  9 22:00:38 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_driver.c

Log Message:
Make the name of the condition more reflective of the name of the condition 
variable.  From Edgar Fuß.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/raidframe/rf_driver.c

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



CVS commit: src/sys/dev/raidframe

2023-10-09 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Mon Oct  9 22:00:38 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_driver.c

Log Message:
Make the name of the condition more reflective of the name of the condition 
variable.  From Edgar Fuß.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/raidframe/rf_driver.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/dev/raidframe/rf_driver.c
diff -u src/sys/dev/raidframe/rf_driver.c:1.142 src/sys/dev/raidframe/rf_driver.c:1.143
--- src/sys/dev/raidframe/rf_driver.c:1.142	Mon Sep 25 21:59:38 2023
+++ src/sys/dev/raidframe/rf_driver.c	Mon Oct  9 22:00:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_driver.c,v 1.142 2023/09/25 21:59:38 oster Exp $	*/
+/*	$NetBSD: rf_driver.c,v 1.143 2023/10/09 22:00:38 oster Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -66,7 +66,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.142 2023/09/25 21:59:38 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.143 2023/10/09 22:00:38 oster Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_diagnostic.h"
@@ -949,7 +949,7 @@ rf_alloc_mutex_cond(RF_Raid_t *raidPtr)
 
 	rf_init_cond2(raidPtr->waitForReconCond, "rfrcnw");
 
-	rf_init_cond2(raidPtr->changing_components_cv, "raidhs");
+	rf_init_cond2(raidPtr->changing_components_cv, "rfcc");
 }
 
 static void



CVS commit: src/sys/dev/raidframe

2023-10-09 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Mon Oct  9 21:55:48 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
spaces->tabs.  Noted by Edgar Fuß


To generate a diff of this commit:
cvs rdiff -u -r1.416 -r1.417 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.416 src/sys/dev/raidframe/rf_netbsdkintf.c:1.417
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.416	Thu Sep 28 15:50:23 2023
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Mon Oct  9 21:55:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.416 2023/09/28 15:50:23 manu Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.417 2023/10/09 21:55:48 oster Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.416 2023/09/28 15:50:23 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.417 2023/10/09 21:55:48 oster Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -3998,10 +3998,10 @@ rf_get_info(RF_Raid_t *raidPtr, RF_Devic
 	}
 	for (i = 0; i < config->nspares; i++) {
 		config->spares[i] = raidPtr->Disks[raidPtr->numCol + i];
-if (config->spares[i].status == rf_ds_rebuilding_spare) {
-/* raidctl(8) expects to see this as a used spare */
-config->spares[i].status = rf_ds_used_spare;
-}
+		if (config->spares[i].status == rf_ds_rebuilding_spare) {
+			/* raidctl(8) expects to see this as a used spare */
+			config->spares[i].status = rf_ds_used_spare;
+		}
 	}
 	return 0;
 }



CVS commit: src/sys/dev/raidframe

2023-10-09 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Mon Oct  9 21:55:48 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
spaces->tabs.  Noted by Edgar Fuß


To generate a diff of this commit:
cvs rdiff -u -r1.416 -r1.417 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2023-09-25 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Mon Sep 25 16:16:50 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_disks.c

Log Message:
snprintf() should really include a format.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/raidframe/rf_disks.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/dev/raidframe/rf_disks.c
diff -u src/sys/dev/raidframe/rf_disks.c:1.94 src/sys/dev/raidframe/rf_disks.c:1.95
--- src/sys/dev/raidframe/rf_disks.c:1.94	Sun Sep 17 20:07:39 2023
+++ src/sys/dev/raidframe/rf_disks.c	Mon Sep 25 16:16:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_disks.c,v 1.94 2023/09/17 20:07:39 oster Exp $	*/
+/*	$NetBSD: rf_disks.c,v 1.95 2023/09/25 16:16:50 oster Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -60,7 +60,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.94 2023/09/17 20:07:39 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.95 2023/09/25 16:16:50 oster Exp $");
 
 #include 
 
@@ -1269,9 +1269,9 @@ rf_swap_components(RF_Raid_t *raidPtr, i
 	RF_ASSERT(raidPtr->accesses_suspended == 0);
 	
 	/* Swap the component names... */
-	snprintf(tmpdevname, sizeof(tmpdevname),raidPtr->Disks[a].devname);
-	snprintf(raidPtr->Disks[a].devname, sizeof(raidPtr->Disks[a].devname), raidPtr->Disks[b].devname);
-	snprintf(raidPtr->Disks[b].devname, sizeof(raidPtr->Disks[b].devname), tmpdevname);
+	snprintf(tmpdevname, sizeof(tmpdevname), "%s", raidPtr->Disks[a].devname);
+	snprintf(raidPtr->Disks[a].devname, sizeof(raidPtr->Disks[a].devname), "%s", raidPtr->Disks[b].devname);
+	snprintf(raidPtr->Disks[b].devname, sizeof(raidPtr->Disks[b].devname), "%s", tmpdevname);
 
 	/* and the vp */
 	tmp_ci_vp = raidPtr->raid_cinfo[a].ci_vp;



CVS commit: src/sys/dev/raidframe

2023-09-25 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Mon Sep 25 16:16:50 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_disks.c

Log Message:
snprintf() should really include a format.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/raidframe/rf_disks.c

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



CVS commit: src/sys/dev/raidframe

2023-09-16 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sat Sep 16 23:38:57 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
A component that is in state rf_ds_reconstructing has failed, and should
not be consulted for DIOCGCACHE.

Fixes an observed panic when rf_get_component_caches() does an IOCTL to
a failed device while reconstruction is in progress.

XXX pullup netbsd-10
XXX pullup netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.412 -r1.413 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.412 src/sys/dev/raidframe/rf_netbsdkintf.c:1.413
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.412	Thu Jun 15 09:15:54 2023
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Sep 16 23:38:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.412 2023/06/15 09:15:54 hannken Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.413 2023/09/16 23:38:57 oster Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.412 2023/06/15 09:15:54 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.413 2023/09/16 23:38:57 oster Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -3771,8 +3771,7 @@ rf_get_component_caches(RF_Raid_t *raidP
 		 * Check any non-dead disk, even when currently being
 		 * reconstructed.
 		 */
-		if (!RF_DEAD_DISK(raidPtr->Disks[c].status)
-		|| raidPtr->Disks[c].status == rf_ds_reconstructing) {
+		if (!RF_DEAD_DISK(raidPtr->Disks[c].status)) {
 			error = VOP_IOCTL(raidPtr->raid_cinfo[c].ci_vp,
 			DIOCGCACHE, , FREAD, NOCRED);
 			if (error) {



CVS commit: src/sys/dev/raidframe

2023-09-16 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sat Sep 16 23:38:57 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
A component that is in state rf_ds_reconstructing has failed, and should
not be consulted for DIOCGCACHE.

Fixes an observed panic when rf_get_component_caches() does an IOCTL to
a failed device while reconstruction is in progress.

XXX pullup netbsd-10
XXX pullup netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.412 -r1.413 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2023-09-08 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Fri Sep  8 22:55:32 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_reconstruct.c

Log Message:
Revision 1.104 actually fixed the issues that were preventing
us from freeing the ReconControl structures.  So free them
and thus also prevent a panic on shutdown due to items not
being correctly returned to the pool.

Thanks to manu@ for report of the panic, and for initial testing
of the changes.

XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/raidframe/rf_reconstruct.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/dev/raidframe/rf_reconstruct.c
diff -u src/sys/dev/raidframe/rf_reconstruct.c:1.127 src/sys/dev/raidframe/rf_reconstruct.c:1.128
--- src/sys/dev/raidframe/rf_reconstruct.c:1.127	Tue Jul 27 03:01:48 2021
+++ src/sys/dev/raidframe/rf_reconstruct.c	Fri Sep  8 22:55:32 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconstruct.c,v 1.127 2021/07/27 03:01:48 oster Exp $	*/
+/*	$NetBSD: rf_reconstruct.c,v 1.128 2023/09/08 22:55:32 oster Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  /
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.127 2021/07/27 03:01:48 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.128 2023/09/08 22:55:32 oster Exp $");
 
 #include 
 #include 
@@ -897,24 +897,11 @@ rf_ContinueReconstructFailedDisk(RF_Raid
 
 		rf_DrainReconEventQueue(reconDesc);
 
-		/* XXX  As much as we'd like to free the recon control structure
-		   and the reconDesc, we have no way of knowing if/when those will
-		   be touched by IO that has yet to occur.  It is rather poor to be
-		   basically causing a 'memory leak' here, but there doesn't seem to be
-		   a cleaner alternative at this time.  Perhaps when the reconstruct code
-		   gets a makeover this problem will go away.
-		*/
-#if 0
 		rf_FreeReconControl(raidPtr);
-#endif
-
 #if RF_ACC_TRACE > 0
 		RF_Free(raidPtr->recon_tracerecs, raidPtr->numCol * sizeof(RF_AccTraceEntry_t));
 #endif
-		/* XXX see comment above */
-#if 0
 		FreeReconDesc(reconDesc);
-#endif
 
 		return (1);
 	}



CVS commit: src/sys/dev/raidframe

2023-09-08 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Fri Sep  8 22:55:32 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_reconstruct.c

Log Message:
Revision 1.104 actually fixed the issues that were preventing
us from freeing the ReconControl structures.  So free them
and thus also prevent a panic on shutdown due to items not
being correctly returned to the pool.

Thanks to manu@ for report of the panic, and for initial testing
of the changes.

XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/raidframe/rf_reconstruct.c

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



CVS commit: src/sys/dev/raidframe

2023-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 30 11:02:15 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
raidframe: Nix unused parameter to raidwrite_component_area.

All calls use the same value.  Prune dead branches using it.


To generate a diff of this commit:
cvs rdiff -u -r1.410 -r1.411 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.410 src/sys/dev/raidframe/rf_netbsdkintf.c:1.411
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.410	Sun Aug 28 00:37:41 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Thu Mar 30 11:02:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.410 2022/08/28 00:37:41 oster Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.411 2023/03/30 11:02:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.410 2022/08/28 00:37:41 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.411 2023/03/30 11:02:15 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -189,7 +189,7 @@ static int raid_detach(device_t, int);
 static int raidread_component_area(dev_t, struct vnode *, void *, size_t,
 daddr_t, daddr_t);
 static int raidwrite_component_area(dev_t, struct vnode *, void *, size_t,
-daddr_t, daddr_t, int);
+daddr_t, daddr_t);
 
 static int raidwrite_component_label(unsigned,
 dev_t, struct vnode *, RF_ComponentLabel_t *);
@@ -2450,7 +2450,7 @@ raidwrite_component_label(unsigned secsi
 	error = raidwrite_component_area(dev, b_vp, clabel_write,
 	sizeof(RF_ComponentLabel_t),
 	rf_component_info_offset(),
-	rf_component_info_size(secsize), 0);
+	rf_component_info_size(secsize));
 
 	return error;
 }
@@ -2458,7 +2458,7 @@ raidwrite_component_label(unsigned secsi
 /* ARGSUSED */
 static int
 raidwrite_component_area(dev_t dev, struct vnode *b_vp, void *data,
-size_t msize, daddr_t offset, daddr_t dsize, int asyncp)
+size_t msize, daddr_t offset, daddr_t dsize)
 {
 	struct buf *bp;
 	int error;
@@ -2470,15 +2470,13 @@ raidwrite_component_area(dev_t dev, stru
 	/* get our ducks in a row for the write */
 	bp->b_blkno = offset / DEV_BSIZE;
 	bp->b_bcount = dsize;
-	bp->b_flags |= B_WRITE | (asyncp ? B_ASYNC : 0);
+	bp->b_flags |= B_WRITE;
  	bp->b_resid = dsize;
 
 	memset(bp->b_data, 0, dsize);
 	memcpy(bp->b_data, data, msize);
 
 	bdev_strategy(bp);
-	if (asyncp)
-		return 0;
 	error = biowait(bp);
 	brelse(bp, 0);
 	if (error) {
@@ -2504,7 +2502,7 @@ rf_paritymap_kern_write(RF_Raid_t *raidP
 		raidPtr->raid_cinfo[c].ci_vp, map,
 		RF_PARITYMAP_NBYTE,
 		rf_parity_map_offset(raidPtr),
-		rf_parity_map_size(raidPtr), 0);
+		rf_parity_map_size(raidPtr));
 	}
 }
 



CVS commit: src/sys/dev/raidframe

2023-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 30 11:02:15 UTC 2023

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
raidframe: Nix unused parameter to raidwrite_component_area.

All calls use the same value.  Prune dead branches using it.


To generate a diff of this commit:
cvs rdiff -u -r1.410 -r1.411 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2022-08-27 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun Aug 28 00:37:41 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Simplify the check for what ioctls can be done in raidioctl() without
the device being initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.409 -r1.410 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.409 src/sys/dev/raidframe/rf_netbsdkintf.c:1.410
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.409	Sun Aug 28 00:26:04 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sun Aug 28 00:37:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.409 2022/08/28 00:26:04 oster Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.410 2022/08/28 00:37:41 oster Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.409 2022/08/28 00:26:04 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.410 2022/08/28 00:37:41 oster Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -1095,46 +1095,6 @@ raid_detach_unlocked(struct raid_softc *
 	return 0;
 }
 
-static bool
-rf_must_be_initialized(const struct raid_softc *rs, u_long cmd)
-{
-	switch (cmd) {
-	case RAIDFRAME_ADD_HOT_SPARE:
-	case RAIDFRAME_CHECK_COPYBACK_STATUS:
-	case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT:
-	case RAIDFRAME_CHECK_PARITY:
-	case RAIDFRAME_CHECK_PARITYREWRITE_STATUS:
-	case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT:
-	case RAIDFRAME_CHECK_RECON_STATUS:
-	case RAIDFRAME_CHECK_RECON_STATUS_EXT:
-	case RAIDFRAME_COPYBACK:
-	case RAIDFRAME_DELETE_COMPONENT:
-	case RAIDFRAME_FAIL_DISK:
-	case RAIDFRAME_GET_ACCTOTALS:
-	case RAIDFRAME_GET_COMPONENT_LABEL:
-	case RAIDFRAME_GET_INFO:
-	case RAIDFRAME_GET_SIZE:
-	case RAIDFRAME_INCORPORATE_HOT_SPARE:
-	case RAIDFRAME_INIT_LABELS:
-	case RAIDFRAME_KEEP_ACCTOTALS:
-	case RAIDFRAME_PARITYMAP_GET_DISABLE:
-	case RAIDFRAME_PARITYMAP_SET_DISABLE:
-	case RAIDFRAME_PARITYMAP_SET_PARAMS:
-	case RAIDFRAME_PARITYMAP_STATUS:
-	case RAIDFRAME_REBUILD_IN_PLACE:
-	case RAIDFRAME_REMOVE_HOT_SPARE:
-	case RAIDFRAME_RESET_ACCTOTALS:
-	case RAIDFRAME_REWRITEPARITY:
-	case RAIDFRAME_SET_AUTOCONFIG:
-	case RAIDFRAME_SET_COMPONENT_LABEL:
-	case RAIDFRAME_SET_LAST_UNIT:
-	case RAIDFRAME_SET_ROOT:
-	case RAIDFRAME_SHUTDOWN:
-		return (rs->sc_flags & RAIDF_INITED) == 0;
-	}
-	return false;
-}
-
 int
 rf_fail_disk(RF_Raid_t *raidPtr, struct rf_recon_req *rr)
 {
@@ -1514,9 +1474,15 @@ raidioctl(dev_t dev, u_long cmd, void *d
 	db1_printf(("raidioctl: %d %d %d %lu\n", (int) dev,
 	(int) DISKPART(dev), (int) unit, cmd));
 
-	/* Must be initialized for these... */
-	if (rf_must_be_initialized(rs, cmd))
-		return ENXIO;
+	/* Only CONFIGURE and RESCAN can be done without the RAID being initialized. */
+	switch (cmd) {
+	case RAIDFRAME_CONFIGURE:
+	case RAIDFRAME_RESCAN:
+		break;
+	default:
+		if (!rf_inited(rs))
+			return ENXIO;
+	}
 
 	switch (cmd) {
 		/* configure the system */



CVS commit: src/sys/dev/raidframe

2022-08-27 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun Aug 28 00:37:41 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Simplify the check for what ioctls can be done in raidioctl() without
the device being initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.409 -r1.410 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2022-08-27 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun Aug 28 00:26:04 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
RAIDframe must be initialized for the RAIDFRAME_SET_LAST_UNIT
and RAIDFRAME_SHUTDOWN ioctls.

XXX Pullup-9

Reported-by: syzbot+1c20fcbe34d72cd7f...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.408 -r1.409 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.408 src/sys/dev/raidframe/rf_netbsdkintf.c:1.409
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.408	Wed Aug 10 01:16:38 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sun Aug 28 00:26:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.408 2022/08/10 01:16:38 mrg Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.409 2022/08/28 00:26:04 oster Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.408 2022/08/10 01:16:38 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.409 2022/08/28 00:26:04 oster Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -1127,7 +1127,9 @@ rf_must_be_initialized(const struct raid
 	case RAIDFRAME_REWRITEPARITY:
 	case RAIDFRAME_SET_AUTOCONFIG:
 	case RAIDFRAME_SET_COMPONENT_LABEL:
+	case RAIDFRAME_SET_LAST_UNIT:
 	case RAIDFRAME_SET_ROOT:
+	case RAIDFRAME_SHUTDOWN:
 		return (rs->sc_flags & RAIDF_INITED) == 0;
 	}
 	return false;



CVS commit: src/sys/dev/raidframe

2022-08-27 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun Aug 28 00:26:04 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
RAIDframe must be initialized for the RAIDFRAME_SET_LAST_UNIT
and RAIDFRAME_SHUTDOWN ioctls.

XXX Pullup-9

Reported-by: syzbot+1c20fcbe34d72cd7f...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.408 -r1.409 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2022-08-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Aug 10 01:16:39 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_disks.c rf_driver.c rf_netbsdkintf.c

Log Message:
raidframe: reject invalid values for numCol and numSpares

numCol and numSpares are "int" so they can be "-1" internally,
which means negative values need to be rejected, as well as
values higher than RF_MAXCOL/RF_MAXSPARES.

explicitly nul-terminate all strings coming from userland.

some minor CSE that avoids signed arith.

this fixes issues in the RAIDFRAME_ADD_HOT_SPARE,
RAIDFRAME_CONFIGURE, RAIDFRAME_DELETE_COMPONENT,
RAIDFRAME_INCORPORATE_HOT_SPARE, and RAIDFRAME_REBUILD_IN_PLACE
ioctl commands.

Reported-by: syzbot+b584943ad1f8ab9d4...@syzkaller.appspotmail.com

https://syzkaller.appspot.com/bug?id=61e07e418261f8eec8a37a9226725fe31820edd0
https://syzkaller.appspot.com/bug?id=ca0c997b40de81c0f0b44790217731f142003149
https://syzkaller.appspot.com/bug?id=6fc452d228453494655a85264591dd9054cc0b08
https://syzkaller.appspot.com/bug?id=873f0271682713a27adc9a49dd7109c70b35fda3

XXX: pullup-8, pullup-9.

ok oster@ riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/raidframe/rf_disks.c
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.407 -r1.408 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_disks.c
diff -u src/sys/dev/raidframe/rf_disks.c:1.92 src/sys/dev/raidframe/rf_disks.c:1.93
--- src/sys/dev/raidframe/rf_disks.c:1.92	Sun Dec  8 12:14:40 2019
+++ src/sys/dev/raidframe/rf_disks.c	Wed Aug 10 01:16:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_disks.c,v 1.92 2019/12/08 12:14:40 mlelstv Exp $	*/
+/*	$NetBSD: rf_disks.c,v 1.93 2022/08/10 01:16:38 mrg Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -60,7 +60,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.92 2019/12/08 12:14:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.93 2022/08/10 01:16:38 mrg Exp $");
 
 #include 
 
@@ -318,11 +318,12 @@ static int
 rf_AllocDiskStructures(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr)
 {
 	int ret;
+	size_t entries = raidPtr->numCol + RF_MAXSPARE;
 
 	/* We allocate RF_MAXSPARE on the first row so that we
 	   have room to do hot-swapping of spares */
-	raidPtr->Disks = RF_MallocAndAdd((raidPtr->numCol + RF_MAXSPARE) *
-	sizeof(*raidPtr->Disks), raidPtr->cleanupList);
+	raidPtr->Disks = RF_MallocAndAdd(
+	entries * sizeof(*raidPtr->Disks), raidPtr->cleanupList);
 	if (raidPtr->Disks == NULL) {
 		ret = ENOMEM;
 		goto fail;
@@ -330,9 +331,7 @@ rf_AllocDiskStructures(RF_Raid_t *raidPt
 
 	/* get space for device specific stuff.. */
 	raidPtr->raid_cinfo = RF_MallocAndAdd(
-	(raidPtr->numCol + RF_MAXSPARE) * sizeof(*raidPtr->raid_cinfo),
-	raidPtr->cleanupList);
-
+	entries * sizeof(*raidPtr->raid_cinfo), raidPtr->cleanupList);
 	if (raidPtr->raid_cinfo == NULL) {
 		ret = ENOMEM;
 		goto fail;
@@ -607,7 +606,7 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, cha
 	error = vn_bdev_openpath(pb, , curlwp);
 	pathbuf_destroy(pb);
 	if (error) {
-		printf("open device: %s failed!\n", diskPtr->devname);
+		printf("open device: '%s' failed: %d\n", diskPtr->devname, error);
 		if (error == ENXIO) {
 			/* the component isn't there... must be dead :-( */
 			diskPtr->status = rf_ds_failed;

Index: src/sys/dev/raidframe/rf_driver.c
diff -u src/sys/dev/raidframe/rf_driver.c:1.139 src/sys/dev/raidframe/rf_driver.c:1.140
--- src/sys/dev/raidframe/rf_driver.c:1.139	Fri Jul 23 02:35:14 2021
+++ src/sys/dev/raidframe/rf_driver.c	Wed Aug 10 01:16:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_driver.c,v 1.139 2021/07/23 02:35:14 oster Exp $	*/
+/*	$NetBSD: rf_driver.c,v 1.140 2022/08/10 01:16:38 mrg Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -66,7 +66,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.139 2021/07/23 02:35:14 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.140 2022/08/10 01:16:38 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_diagnostic.h"
@@ -341,6 +341,11 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Conf
 			  (void (*) (void *)) rf_FreeAllocList,
 			  raidPtr->cleanupList);
 
+	KASSERT(cfgPtr->numCol < RF_MAXCOL);
+	KASSERT(cfgPtr->numCol >= 0);
+	KASSERT(cfgPtr->numSpare < RF_MAXSPARE);
+	KASSERT(cfgPtr->numSpare >= 0);
+
 	raidPtr->numCol = cfgPtr->numCol;
 	raidPtr->numSpare = cfgPtr->numSpare;
 

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.407 src/sys/dev/raidframe/rf_netbsdkintf.c:1.408
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.407	Sat Apr 16 16:40:54 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Aug 10 01:16:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: 

CVS commit: src/sys/dev/raidframe

2022-08-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Aug 10 01:16:39 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_disks.c rf_driver.c rf_netbsdkintf.c

Log Message:
raidframe: reject invalid values for numCol and numSpares

numCol and numSpares are "int" so they can be "-1" internally,
which means negative values need to be rejected, as well as
values higher than RF_MAXCOL/RF_MAXSPARES.

explicitly nul-terminate all strings coming from userland.

some minor CSE that avoids signed arith.

this fixes issues in the RAIDFRAME_ADD_HOT_SPARE,
RAIDFRAME_CONFIGURE, RAIDFRAME_DELETE_COMPONENT,
RAIDFRAME_INCORPORATE_HOT_SPARE, and RAIDFRAME_REBUILD_IN_PLACE
ioctl commands.

Reported-by: syzbot+b584943ad1f8ab9d4...@syzkaller.appspotmail.com

https://syzkaller.appspot.com/bug?id=61e07e418261f8eec8a37a9226725fe31820edd0
https://syzkaller.appspot.com/bug?id=ca0c997b40de81c0f0b44790217731f142003149
https://syzkaller.appspot.com/bug?id=6fc452d228453494655a85264591dd9054cc0b08
https://syzkaller.appspot.com/bug?id=873f0271682713a27adc9a49dd7109c70b35fda3

XXX: pullup-8, pullup-9.

ok oster@ riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/raidframe/rf_disks.c
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.407 -r1.408 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2022-06-27 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Tue Jun 28 03:13:27 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_compat80.c

Log Message:
RAIDframe must be initialized for the RAIDFRAME_FAIL_DISK80 ioctl.

Reported-by: syzbot+048387fcc9a1a3682...@syzkaller.appspotmail.com
Reported-by: syzbot+037d1813186571cb2...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_compat80.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/dev/raidframe/rf_compat80.c
diff -u src/sys/dev/raidframe/rf_compat80.c:1.16 src/sys/dev/raidframe/rf_compat80.c:1.17
--- src/sys/dev/raidframe/rf_compat80.c:1.16	Sat Dec 11 19:24:21 2021
+++ src/sys/dev/raidframe/rf_compat80.c	Tue Jun 28 03:13:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_compat80.c,v 1.16 2021/12/11 19:24:21 mrg Exp $	*/
+/*	$NetBSD: rf_compat80.c,v 1.17 2022/06/28 03:13:27 oster Exp $	*/
 
 /*
  * Copyright (c) 2017 Matthew R. Green
@@ -315,11 +315,11 @@ raidframe_ioctl_80(struct raid_softc *rs
 	case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT80:
 	case RAIDFRAME_GET_INFO80:
 	case RAIDFRAME_GET_COMPONENT_LABEL80:
+	case RAIDFRAME_FAIL_DISK80:
 		if (!rf_inited(rs))
 			return ENXIO;
 		break;
 	case RAIDFRAME_CONFIGURE80:
-	case RAIDFRAME_FAIL_DISK80:
 		break;
 	default:
 		return EPASSTHROUGH;



CVS commit: src/sys/dev/raidframe

2022-06-27 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Tue Jun 28 03:13:27 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_compat80.c

Log Message:
RAIDframe must be initialized for the RAIDFRAME_FAIL_DISK80 ioctl.

Reported-by: syzbot+048387fcc9a1a3682...@syzkaller.appspotmail.com
Reported-by: syzbot+037d1813186571cb2...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_compat80.c

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



Re: CVS commit: src/sys/dev/raidframe

2022-04-16 Thread J. Hannken-Illjes
> On 16. Apr 2022, at 18:40, Andrius Varanavicius  wrote:
> 
> Module Name:  src
> Committed By: andvar
> Date: Sat Apr 16 16:40:54 UTC 2022
> 
> Modified Files:
>   src/sys/dev/raidframe: rf_netbsdkintf.c
> 
> Log Message:
> Fix mistake in error branch locking caused by previous changes.
> vput(vp) also unlocks vp, thus unlocking happens twice in error flow
> causing kernel to panic with failed assertion lktype != LK_NONE
> in vfs_vnode.c#778. Thanks riastradh with finding the issue.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.406 -r1.407 src/sys/dev/raidframe/rf_netbsdkintf.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.

Thanks, replacing vput() with vrele() would have been even better ...

--
J. Hannken-Illjes - hann...@mailbox.org


signature.asc
Description: Message signed with OpenPGP


CVS commit: src/sys/dev/raidframe

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 16:40:54 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Fix mistake in error branch locking caused by previous changes.
vput(vp) also unlocks vp, thus unlocking happens twice in error flow
causing kernel to panic with failed assertion lktype != LK_NONE
in vfs_vnode.c#778. Thanks riastradh with finding the issue.


To generate a diff of this commit:
cvs rdiff -u -r1.406 -r1.407 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.406 src/sys/dev/raidframe/rf_netbsdkintf.c:1.407
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.406	Sat Apr 16 07:57:33 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Apr 16 16:40:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.407 2022/04/16 16:40:54 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.407 2022/04/16 16:40:54 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -2951,7 +2951,6 @@ rf_find_raid_components(void)
 
 			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED);
-			VOP_UNLOCK(vp);
 
 			if (error) {
 /* "Who cares."  Continue looking
@@ -2960,6 +2959,7 @@ rf_find_raid_components(void)
 continue;
 			}
 
+			VOP_UNLOCK(vp);
 			error = getdisksize(vp, , );
 			if (error) {
 /*



CVS commit: src/sys/dev/raidframe

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 16:40:54 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Fix mistake in error branch locking caused by previous changes.
vput(vp) also unlocks vp, thus unlocking happens twice in error flow
causing kernel to panic with failed assertion lktype != LK_NONE
in vfs_vnode.c#778. Thanks riastradh with finding the issue.


To generate a diff of this commit:
cvs rdiff -u -r1.406 -r1.407 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:57:33 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.405 -r1.406 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.405 src/sys/dev/raidframe/rf_netbsdkintf.c:1.406
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.405	Mon Mar 28 13:07:14 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Apr 16 07:57:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -2951,6 +2951,7 @@ rf_find_raid_components(void)
 
 			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED);
+			VOP_UNLOCK(vp);
 
 			if (error) {
 /* "Who cares."  Continue looking
@@ -2970,6 +2971,7 @@ rf_find_raid_components(void)
 	printf("RAIDframe: can't get disk size"
 	" for dev %s (%d)\n",
 	device_xname(dv), error);
+vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 vput(vp);
 continue;
@@ -2981,18 +2983,19 @@ rf_find_raid_components(void)
 if (error) {
 	printf("RAIDframe: can't get wedge info for "
 	"dev %s (%d)\n", device_xname(dv), error);
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 	vput(vp);
 	continue;
 }
 
 if (strcmp(dkw.dkw_ptype, DKW_PTYPE_RAIDFRAME) != 0) {
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 	vput(vp);
 	continue;
 }
 
-VOP_UNLOCK(vp);
 ac_list = rf_get_component(ac_list, dev, vp,
 device_xname(dv), dkw.dkw_size, numsecs, secsize);
 rf_part_found = 1; /*There is a raid component on this disk*/
@@ -3013,6 +3016,7 @@ rf_find_raid_components(void)
 
 			/* don't need this any more.  We'll allocate it again
 			   a little later if we really do... */
+			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 			vput(vp);
 



CVS commit: src/sys/dev/raidframe

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:57:33 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.405 -r1.406 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2022-03-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Mar 28 13:07:14 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Restore another historic RCS Id.


To generate a diff of this commit:
cvs rdiff -u -r1.404 -r1.405 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.404 src/sys/dev/raidframe/rf_netbsdkintf.c:1.405
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.404	Mon Mar 28 12:33:21 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Mon Mar 28 13:07:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.404 2022/03/28 12:33:21 riastradh Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * from: Utah $Hdr$
+ * from: Utah $Hdr: cd.c 1.6 90/11/28$
  *
  *  @(#)cd.c8.2 (Berkeley) 11/16/93
  */
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.404 2022/03/28 12:33:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"



CVS commit: src/sys/dev/raidframe

2022-03-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Mar 28 13:07:14 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Restore another historic RCS Id.


To generate a diff of this commit:
cvs rdiff -u -r1.404 -r1.405 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2022-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar 11 01:59:33 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
convert non-config-handled "DEBUG_ROOT" to aprint_debug().

now it's possible to get boot-time info about raidframe root
device selection with simple "boot -x".


To generate a diff of this commit:
cvs rdiff -u -r1.402 -r1.403 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.402 src/sys/dev/raidframe/rf_netbsdkintf.c:1.403
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.402	Wed Mar  9 10:04:06 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Fri Mar 11 01:59:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.402 2022/03/09 10:04:06 mrg Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.403 2022/03/11 01:59:33 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.402 2022/03/09 10:04:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.403 2022/03/11 01:59:33 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -158,12 +158,6 @@ int rf_kdebug_level = 0;
 #define db1_printf(a) { }
 #endif/* DEBUG */
 
-#ifdef DEBUG_ROOT
-#define DPRINTF(a, ...) printf(a, __VA_ARGS__)
-#else
-#define DPRINTF(a, ...)
-#endif
-
 #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0)
 static rf_declare_mutex2(rf_sparet_wait_mutex);
 static rf_declare_cond2(rf_sparet_wait_cv);
@@ -588,7 +582,7 @@ rf_buildroothack(RF_ConfigSet_t *config_
 	   then we don't touch booted_device or boothowto... */
 
 	if (rootspec != NULL) {
-		DPRINTF("%s: rootspec %s\n", __func__, rootspec);
+		aprint_debug("%s: rootspec %s\n", __func__, rootspec);
 		return;
 	}
 
@@ -614,7 +608,7 @@ rf_buildroothack(RF_ConfigSet_t *config_
 			snprintf(cname, sizeof(cname), "%s%c",
 			device_xname(dksc->sc_dev), 'a');
 			candidate_root = dkwedge_find_by_wname(cname);
-			DPRINTF("%s: candidate wedge root=%s\n", __func__,
+			aprint_debug("%s: candidate wedge root=%s\n", __func__,
 			cname);
 			if (candidate_root == NULL) {
 /*
@@ -627,12 +621,12 @@ rf_buildroothack(RF_ConfigSet_t *config_
 candidate_root = dkwedge_find_by_parent(
 device_xname(dksc->sc_dev), );
 			}
-			DPRINTF("%s: candidate wedge root=%p\n", __func__,
+			aprint_debug("%s: candidate wedge root=%p\n", __func__,
 			candidate_root);
 		} else
 			candidate_root = dksc->sc_dev;
-		DPRINTF("%s: candidate root=%p booted_device=%p "
-			"root_partition=%d contains_boot=%d\n",
+		aprint_debug("%s: candidate root=%p booted_device=%p "
+			 "root_partition=%d contains_boot=%d\n",
 		__func__, candidate_root, booted_device,
 		rsc->sc_r.root_partition,
 		rf_containsboot(>sc_r, booted_device));
@@ -645,11 +639,11 @@ rf_buildroothack(RF_ConfigSet_t *config_
 			booted_device = candidate_root;
 			booted_method = "raidframe/single";
 			booted_partition = 0;	/* XXX assume 'a' */
-			DPRINTF("%s: set booted_device=%s(%p)\n", __func__,
+			aprint_debug("%s: set booted_device=%s(%p)\n", __func__,
 			device_xname(booted_device), booted_device);
 		}
 	} else if (num_root > 1) {
-		DPRINTF("%s: many roots=%d, %p\n", __func__, num_root,
+		aprint_debug("%s: many roots=%d, %p\n", __func__, num_root,
 		booted_device);
 
 		/*



CVS commit: src/sys/dev/raidframe

2022-03-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar 11 01:59:33 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
convert non-config-handled "DEBUG_ROOT" to aprint_debug().

now it's possible to get boot-time info about raidframe root
device selection with simple "boot -x".


To generate a diff of this commit:
cvs rdiff -u -r1.402 -r1.403 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2022-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar  9 10:04:06 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
merge two debug lines in auto-root selection.


To generate a diff of this commit:
cvs rdiff -u -r1.401 -r1.402 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.401 src/sys/dev/raidframe/rf_netbsdkintf.c:1.402
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.401	Thu Sep  9 23:26:37 2021
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Mar  9 10:04:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.401 2021/09/09 23:26:37 riastradh Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.402 2022/03/09 10:04:06 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.401 2021/09/09 23:26:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.402 2022/03/09 10:04:06 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -631,11 +631,11 @@ rf_buildroothack(RF_ConfigSet_t *config_
 			candidate_root);
 		} else
 			candidate_root = dksc->sc_dev;
-		DPRINTF("%s: candidate root=%p\n", __func__, candidate_root);
-		DPRINTF("%s: booted_device=%p root_partition=%d "
-			"contains_boot=%d",
-		__func__, booted_device, rsc->sc_r.root_partition,
-			   rf_containsboot(>sc_r, booted_device));
+		DPRINTF("%s: candidate root=%p booted_device=%p "
+			"root_partition=%d contains_boot=%d\n",
+		__func__, candidate_root, booted_device,
+		rsc->sc_r.root_partition,
+		rf_containsboot(>sc_r, booted_device));
 		/* XXX the check for booted_device == NULL can probably be
 		 * dropped, now that rf_containsboot handles that case.
 		 */



CVS commit: src/sys/dev/raidframe

2022-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar  9 10:04:06 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
merge two debug lines in auto-root selection.


To generate a diff of this commit:
cvs rdiff -u -r1.401 -r1.402 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2021-12-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 14 00:46:43 UTC 2021

Modified Files:
src/sys/dev/raidframe: rf_diskqueue.c

Log Message:
call buf_destroy() after buf_init().  hopefully fixes the lockdebug
problem shown here:

   http://mail-index.netbsd.org/tech-kern/2021/12/10/msg027851.html

but seems unlikely to fix the original problem.

tested on i386/anita.  ok oster@

XXX: pullup-9 (netbsd-8 uses old APIs.)


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/raidframe/rf_diskqueue.c

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



CVS commit: src/sys/dev/raidframe

2021-12-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec 14 00:46:43 UTC 2021

Modified Files:
src/sys/dev/raidframe: rf_diskqueue.c

Log Message:
call buf_destroy() after buf_init().  hopefully fixes the lockdebug
problem shown here:

   http://mail-index.netbsd.org/tech-kern/2021/12/10/msg027851.html

but seems unlikely to fix the original problem.

tested on i386/anita.  ok oster@

XXX: pullup-9 (netbsd-8 uses old APIs.)


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/raidframe/rf_diskqueue.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/dev/raidframe/rf_diskqueue.c
diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.62 src/sys/dev/raidframe/rf_diskqueue.c:1.63
--- src/sys/dev/raidframe/rf_diskqueue.c:1.62	Tue Jul 27 03:01:48 2021
+++ src/sys/dev/raidframe/rf_diskqueue.c	Tue Dec 14 00:46:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_diskqueue.c,v 1.62 2021/07/27 03:01:48 oster Exp $	*/
+/*	$NetBSD: rf_diskqueue.c,v 1.63 2021/12/14 00:46:43 mrg Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -66,7 +66,7 @@
  /
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.62 2021/07/27 03:01:48 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.63 2021/12/14 00:46:43 mrg Exp $");
 
 #include 
 
@@ -416,6 +416,9 @@ rf_CreateDiskQueueData(RF_IoType_t typ, 
 void
 rf_FreeDiskQueueData(RF_DiskQueueData_t *p)
 {
+
+	buf_destroy(p->bp);
+
 	pool_put(>raidPtr->pools.bufio, p->bp);
 	pool_put(>raidPtr->pools.dqd, p);
 }



CVS commit: src/sys/dev/raidframe

2021-08-28 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sat Aug 28 16:00:52 UTC 2021

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
If there is a FS_RAID partition on a disk, then we shouldn't look at
the raw partition.  In particular, we now need to account for the case
where an existing FS_RAID partition is now open because it is in use.
If that is the case, we don't look at the raw partition.

Addresses PR kern/56369.


To generate a diff of this commit:
cvs rdiff -u -r1.399 -r1.400 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.399 src/sys/dev/raidframe/rf_netbsdkintf.c:1.400
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.399	Sat Aug  7 16:19:15 2021
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Aug 28 16:00:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.399 2021/08/07 16:19:15 thorpej Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.400 2021/08/28 16:00:52 oster Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.399 2021/08/07 16:19:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.400 2021/08/28 16:00:52 oster Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -3040,7 +3040,19 @@ rf_find_raid_components(void)
 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 error = VOP_OPEN(vp, FREAD, NOCRED);
 if (error) {
-	/* Whatever... */
+	/* Not quite a 'whatever'.  In
+	 * this situation we know 
+	 * there is a FS_RAID
+	 * partition, but we can't
+	 * open it.  The most likely
+	 * reason is that the
+	 * partition is already in
+	 * use by another RAID set.
+	 * So note that we've already
+	 * found a partition on this
+	 * disk so we don't attempt
+	 * to use the raw disk later. */
+	rf_part_found = 1;
 	vput(vp);
 	continue;
 }



CVS commit: src/sys/dev/raidframe

2021-08-28 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sat Aug 28 16:00:52 UTC 2021

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
If there is a FS_RAID partition on a disk, then we shouldn't look at
the raw partition.  In particular, we now need to account for the case
where an existing FS_RAID partition is now open because it is in use.
If that is the case, we don't look at the raw partition.

Addresses PR kern/56369.


To generate a diff of this commit:
cvs rdiff -u -r1.399 -r1.400 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2019-10-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 30 16:00:13 UTC 2019

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Gcc -Os on landisk is not smart enough to follow the conditional
initialization and warns, unconditionaly initialize dksc at declaration
with a XXX gcc comment.


To generate a diff of this commit:
cvs rdiff -u -r1.377 -r1.378 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2019-10-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 30 16:00:13 UTC 2019

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Gcc -Os on landisk is not smart enough to follow the conditional
initialization and warns, unconditionaly initialize dksc at declaration
with a XXX gcc comment.


To generate a diff of this commit:
cvs rdiff -u -r1.377 -r1.378 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.377 src/sys/dev/raidframe/rf_netbsdkintf.c:1.378
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.377	Wed Oct 30 07:59:44 2019
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Oct 30 16:00:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.377 2019/10/30 07:59:44 maxv Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.378 2019/10/30 16:00:13 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.377 2019/10/30 07:59:44 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.378 2019/10/30 16:00:13 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -487,7 +487,7 @@ rf_buildroothack(RF_ConfigSet_t *config_
 	RF_ConfigSet_t *next_cset;
 	int num_root;
 	struct raid_softc *sc, *rsc;
-	struct dk_softc *dksc;
+	struct dk_softc *dksc = NULL;	/* XXX gcc -Os: may be used uninit. */
 
 	sc = rsc = NULL;
 	num_root = 0;



CVS commit: src/sys/dev/raidframe

2019-10-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Oct 30 07:59:45 UTC 2019

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Get >sc_dksc only when we know 'rsc' is not NULL. This was actually
harmless because we didn't use the pointer then.

Reported-by: syzbot+77097fae0e3aad6de...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.376 -r1.377 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2019-10-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Oct 30 07:59:45 UTC 2019

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Get >sc_dksc only when we know 'rsc' is not NULL. This was actually
harmless because we didn't use the pointer then.

Reported-by: syzbot+77097fae0e3aad6de...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.376 -r1.377 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.376 src/sys/dev/raidframe/rf_netbsdkintf.c:1.377
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.376	Fri Mar  1 11:06:56 2019
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Oct 30 07:59:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.376 2019/03/01 11:06:56 pgoyette Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.377 2019/10/30 07:59:44 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.376 2019/03/01 11:06:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.377 2019/10/30 07:59:44 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -518,7 +518,6 @@ rf_buildroothack(RF_ConfigSet_t *config_
 		rf_cleanup_config_set(cset);
 		cset = next_cset;
 	}
-	dksc = >sc_dksc;
 
 	/* if the user has specified what the root device should be
 	   then we don't touch booted_device or boothowto... */
@@ -543,6 +542,7 @@ rf_buildroothack(RF_ConfigSet_t *config_
 	 */
 	if (num_root == 1) {
 		device_t candidate_root;
+		dksc = >sc_dksc;
 		if (dksc->sc_dkdev.dk_nwedges != 0) {
 			char cname[sizeof(cset->ac->devname)];
 			/* XXX: assume partition 'a' first */



CVS commit: src/sys/dev/raidframe

2019-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 10 03:44:00 UTC 2019

Modified Files:
src/sys/dev/raidframe: raidframevar.h rf_callback.c rf_callback.h
rf_copyback.c rf_dag.h rf_dagdegrd.c rf_dagdegrd.h rf_dagdegwr.c
rf_dagdegwr.h rf_dagffrd.c rf_dagffwr.c rf_dagffwr.h rf_dagfuncs.c
rf_dagfuncs.h rf_dagutils.c rf_dagutils.h rf_desc.h rf_diskqueue.c
rf_diskqueue.h rf_driver.c rf_engine.c rf_engine.h
rf_evenodd_dagfuncs.c rf_evenodd_dagfuncs.h rf_evenodd_dags.c
rf_netbsd.h rf_paritylog.c rf_paritylog.h rf_paritylogDiskMgr.c
rf_paritylogDiskMgr.h rf_parityloggingdags.c rf_parityloggingdags.h
rf_parityscan.c rf_parityscan.h rf_pq.c rf_pq.h rf_psstatus.c
rf_psstatus.h rf_raid.h rf_raid1.c rf_reconbuffer.c
rf_reconstruct.c rf_reconstruct.h rf_states.c rf_states.h
rf_stripelocks.h

Log Message:
fix the function pointer and callback mess:
- callback functions return 0 and their result is not checked; make them void.
- there are two types of callbacks and they used to overload their parameters
  and the callback structure; separate them into "function" and "value"
  callbacks.
- make the wait function signature consistent.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/raidframevar.h \
src/sys/dev/raidframe/rf_dagffrd.c src/sys/dev/raidframe/rf_dagutils.h \
src/sys/dev/raidframe/rf_desc.h
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/raidframe/rf_callback.c \
src/sys/dev/raidframe/rf_evenodd_dagfuncs.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/raidframe/rf_callback.h \
src/sys/dev/raidframe/rf_dagdegwr.h src/sys/dev/raidframe/rf_engine.h \
src/sys/dev/raidframe/rf_parityloggingdags.h
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/raidframe/rf_copyback.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/raidframe/rf_dag.h \
src/sys/dev/raidframe/rf_paritylog.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/raidframe/rf_dagdegrd.c \
src/sys/dev/raidframe/rf_dagfuncs.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/raidframe/rf_dagdegrd.h \
src/sys/dev/raidframe/rf_parityscan.h \
src/sys/dev/raidframe/rf_stripelocks.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_dagdegwr.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/raidframe/rf_dagffwr.c \
src/sys/dev/raidframe/rf_parityscan.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/raidframe/rf_dagffwr.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/raidframe/rf_dagfuncs.h
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/raidframe/rf_dagutils.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/raidframe/rf_diskqueue.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/raidframe/rf_diskqueue.h
cvs rdiff -u -r1.135 -r1.136 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/raidframe/rf_engine.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/raidframe/rf_evenodd_dagfuncs.h \
src/sys/dev/raidframe/rf_pq.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/raidframe/rf_evenodd_dags.c \
src/sys/dev/raidframe/rf_paritylogDiskMgr.h \
src/sys/dev/raidframe/rf_states.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/raidframe/rf_netbsd.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/raidframe/rf_paritylog.h
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/raidframe/rf_paritylogDiskMgr.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/raidframe/rf_parityloggingdags.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_pq.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/raidframe/rf_psstatus.c \
src/sys/dev/raidframe/rf_raid1.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/raidframe/rf_psstatus.h
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/raidframe/rf_raid.h
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/raidframe/rf_reconbuffer.c
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/raidframe/rf_reconstruct.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_reconstruct.h
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/raidframe/rf_states.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/dev/raidframe/raidframevar.h
diff -u src/sys/dev/raidframe/raidframevar.h:1.20 src/sys/dev/raidframe/raidframevar.h:1.21
--- src/sys/dev/raidframe/raidframevar.h:1.20	Wed Sep 25 21:36:10 2019
+++ src/sys/dev/raidframe/raidframevar.h	Wed Oct  9 23:43:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: raidframevar.h,v 1.20 2019/09/26 01:36:10 christos Exp $ */
+/*	$NetBSD: raidframevar.h,v 1.21 2019/10/10 03:43:59 christos Exp $ */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -210,7 +210,8 @@ typedef RF_uint32 RF_RaidAccessFlags_t;
 typedef struct RF_AccessStripeMap_s RF_AccessStripeMap_t;
 typedef struct RF_AccessStripeMapHeader_s RF_AccessStripeMapHeader_t;
 typedef struct RF_AllocListElem_s RF_AllocListElem_t;
-typedef struct RF_CallbackDesc_s RF_CallbackDesc_t;
+typedef struct RF_CallbackFuncDesc_s RF_CallbackFuncDesc_t;
+typedef struct RF_CallbackValueDesc_s RF_CallbackValueDesc_t;
 typedef 

CVS commit: src/sys/dev/raidframe

2019-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 10 03:44:00 UTC 2019

Modified Files:
src/sys/dev/raidframe: raidframevar.h rf_callback.c rf_callback.h
rf_copyback.c rf_dag.h rf_dagdegrd.c rf_dagdegrd.h rf_dagdegwr.c
rf_dagdegwr.h rf_dagffrd.c rf_dagffwr.c rf_dagffwr.h rf_dagfuncs.c
rf_dagfuncs.h rf_dagutils.c rf_dagutils.h rf_desc.h rf_diskqueue.c
rf_diskqueue.h rf_driver.c rf_engine.c rf_engine.h
rf_evenodd_dagfuncs.c rf_evenodd_dagfuncs.h rf_evenodd_dags.c
rf_netbsd.h rf_paritylog.c rf_paritylog.h rf_paritylogDiskMgr.c
rf_paritylogDiskMgr.h rf_parityloggingdags.c rf_parityloggingdags.h
rf_parityscan.c rf_parityscan.h rf_pq.c rf_pq.h rf_psstatus.c
rf_psstatus.h rf_raid.h rf_raid1.c rf_reconbuffer.c
rf_reconstruct.c rf_reconstruct.h rf_states.c rf_states.h
rf_stripelocks.h

Log Message:
fix the function pointer and callback mess:
- callback functions return 0 and their result is not checked; make them void.
- there are two types of callbacks and they used to overload their parameters
  and the callback structure; separate them into "function" and "value"
  callbacks.
- make the wait function signature consistent.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/raidframevar.h \
src/sys/dev/raidframe/rf_dagffrd.c src/sys/dev/raidframe/rf_dagutils.h \
src/sys/dev/raidframe/rf_desc.h
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/raidframe/rf_callback.c \
src/sys/dev/raidframe/rf_evenodd_dagfuncs.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/raidframe/rf_callback.h \
src/sys/dev/raidframe/rf_dagdegwr.h src/sys/dev/raidframe/rf_engine.h \
src/sys/dev/raidframe/rf_parityloggingdags.h
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/raidframe/rf_copyback.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/raidframe/rf_dag.h \
src/sys/dev/raidframe/rf_paritylog.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/raidframe/rf_dagdegrd.c \
src/sys/dev/raidframe/rf_dagfuncs.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/raidframe/rf_dagdegrd.h \
src/sys/dev/raidframe/rf_parityscan.h \
src/sys/dev/raidframe/rf_stripelocks.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_dagdegwr.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/raidframe/rf_dagffwr.c \
src/sys/dev/raidframe/rf_parityscan.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/raidframe/rf_dagffwr.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/raidframe/rf_dagfuncs.h
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/raidframe/rf_dagutils.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/raidframe/rf_diskqueue.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/raidframe/rf_diskqueue.h
cvs rdiff -u -r1.135 -r1.136 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/raidframe/rf_engine.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/raidframe/rf_evenodd_dagfuncs.h \
src/sys/dev/raidframe/rf_pq.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/raidframe/rf_evenodd_dags.c \
src/sys/dev/raidframe/rf_paritylogDiskMgr.h \
src/sys/dev/raidframe/rf_states.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/raidframe/rf_netbsd.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/raidframe/rf_paritylog.h
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/raidframe/rf_paritylogDiskMgr.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/raidframe/rf_parityloggingdags.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_pq.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/raidframe/rf_psstatus.c \
src/sys/dev/raidframe/rf_raid1.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/raidframe/rf_psstatus.h
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/raidframe/rf_raid.h
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/raidframe/rf_reconbuffer.c
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/raidframe/rf_reconstruct.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_reconstruct.h
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/raidframe/rf_states.c

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



CVS commit: src/sys/dev/raidframe

2019-09-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 26 01:36:11 UTC 2019

Modified Files:
src/sys/dev/raidframe: raidframevar.h rf_compat50.c

Log Message:
make nspares unsigned; it is assigned from numSpares which is unsigned.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/raidframe/raidframevar.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/raidframe/rf_compat50.c

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



CVS commit: src/sys/dev/raidframe

2019-09-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 26 01:36:11 UTC 2019

Modified Files:
src/sys/dev/raidframe: raidframevar.h rf_compat50.c

Log Message:
make nspares unsigned; it is assigned from numSpares which is unsigned.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/raidframe/raidframevar.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/raidframe/rf_compat50.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/dev/raidframe/raidframevar.h
diff -u src/sys/dev/raidframe/raidframevar.h:1.19 src/sys/dev/raidframe/raidframevar.h:1.20
--- src/sys/dev/raidframe/raidframevar.h:1.19	Thu Apr 19 17:50:09 2018
+++ src/sys/dev/raidframe/raidframevar.h	Wed Sep 25 21:36:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: raidframevar.h,v 1.19 2018/04/19 21:50:09 christos Exp $ */
+/*	$NetBSD: raidframevar.h,v 1.20 2019/09/26 01:36:10 christos Exp $ */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -519,7 +519,7 @@ typedef struct RF_DeviceConfig_s {
 	u_int   maxqdepth;
 	int ndevs;
 	RF_RaidDisk_t devs[RF_MAX_DISKS];
-	int nspares;
+	u_intnspares;
 	RF_RaidDisk_t spares[RF_MAX_DISKS];
 }   RF_DeviceConfig_t;
 

Index: src/sys/dev/raidframe/rf_compat50.c
diff -u src/sys/dev/raidframe/rf_compat50.c:1.10 src/sys/dev/raidframe/rf_compat50.c:1.11
--- src/sys/dev/raidframe/rf_compat50.c:1.10	Fri Mar  1 06:06:56 2019
+++ src/sys/dev/raidframe/rf_compat50.c	Wed Sep 25 21:36:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_compat50.c,v 1.10 2019/03/01 11:06:56 pgoyette Exp $	*/
+/*	$NetBSD: rf_compat50.c,v 1.11 2019/09/26 01:36:10 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -86,7 +86,7 @@ typedef struct RF_DeviceConfig50_s {
 	u_int			maxqdepth;
 	int			ndevs;
 	RF_RaidDisk50_t		devs[RF_MAX_DISKS];
-	int			nspares;
+	u_int			nspares;
 	RF_RaidDisk50_t		spares[RF_MAX_DISKS];
 } RF_DeviceConfig50_t;
 



Re: CVS commit: src/sys/dev/raidframe

2019-02-05 Thread Christos Zoulas
In article ,
Paul Goyette   wrote:
>> Module Name:src
>> Committed By:   mrg
>> Date:   Tue Feb  5 09:28:00 UTC 2019
>>
>> Modified Files:
>> src/sys/dev/raidframe: rf_netbsdkintf.c
>>
>> Log Message:
>> fix the previous:
>>
>> rf_netbsd32 is only relevant on _LP64 as all the structures are
>> the same for arm32 oabi/eabi compat.
>>
>> only do it for _LP64 *and* COMAPT_NETBSD32.
>
>This doesn't really do the job...
>
>Consider a kernel with raid(4) built-in, but _not_ built with 
>COMPAT_NETBSD32.  The raid code will not have any calls to the compat 
>hooks.  So even if you subsequently modload the compat_netbsd32 module 
>there won't be any way to call the compat code.
>
>The main raidframe driver code needs to be built _without_ depending on 
>COMPAT_NETBSD32 being defined at all.

There is also the consideration of compat_32 for all the _80 ioctls...

christos



CVS commit: src/sys/dev/raidframe

2019-02-05 Thread Paul Goyette

Module Name:src
Committed By:   mrg
Date:   Tue Feb  5 09:28:00 UTC 2019

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
fix the previous:

rf_netbsd32 is only relevant on _LP64 as all the structures are
the same for arm32 oabi/eabi compat.

only do it for _LP64 *and* COMAPT_NETBSD32.


This doesn't really do the job...

Consider a kernel with raid(4) built-in, but _not_ built with 
COMPAT_NETBSD32.  The raid code will not have any calls to the compat 
hooks.  So even if you subsequently modload the compat_netbsd32 module 
there won't be any way to call the compat code.


The main raidframe driver code needs to be built _without_ depending on 
COMPAT_NETBSD32 being defined at all.



+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+--+--++


Re: CVS commit: src/sys/dev/raidframe

2017-01-13 Thread coypu
It's still a behaviour change..

On Thu, Jan 12, 2017 at 11:22:16PM -0500, Christos Zoulas wrote:
> +static void
> +rf_handle_hosed(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, int hosed_column)
> +{
> + if (raidPtr->Disks[hosed_column].status == rf_ds_failed)
> + return;

equivalent to
if (raidPtr->Disks[hosed_column].status != rf_ds_failed) { do stuff }
in the second check, but this is first one:

>  
> - printf("Hosed component: %s\n",
> ->devnames[0][hosed_column][0]);
> - if (!force) {
> - /* we'll fail this component, as if there are
> -other major errors, we arn't forcing things
> -and we'll abort the config anyways */
> - raidPtr->Disks[hosed_column].status
> - = rf_ds_failed;
> - raidPtr->numFailures++;
> - raidPtr->status = rf_rs_degraded;
> - }
> + if (hosed_column != -1)
> + rf_handle_hosed(raidPtr, cfgPtr, hosed_column);
> 

It always increments numfailures, even if this column has
failed in the distant past.


Re: CVS commit: src/sys/dev/raidframe

2017-01-13 Thread coypu
On Thu, Jan 12, 2017 at 11:22:16PM -0500, Christos Zoulas wrote:
> +rf_handle_hosed(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, int hosed_column)
> +{
:
> + if (raidPtr->Disks[hosed_column].status == rf_ds_failed)
> + return;

equivalent to
if (raidPtr->Disks[hosed_column].status != rf_ds_failed) {
do stuff

This is not in the first part:
> - printf("Hosed component: %s\n",
> ->devnames[0][hosed_column][0]);
> - if (!force) {
> - /* we'll fail this component, as if there are
> -other major errors, we arn't forcing things
> -and we'll abort the config anyways */
> - raidPtr->Disks[hosed_column].status
> - = rf_ds_failed;
> - raidPtr->numFailures++;
> - raidPtr->status = rf_rs_degraded;
> - }
> + if (hosed_column != -1)
> + rf_handle_hosed(raidPtr, cfgPtr, hosed_column);

It is only in the second part:
> - printf("Hosed component: %s\n",
> ->devnames[0][hosed_column][0]);
> - if (!force) {
> - /* we'll fail this component, as if there are
> -other major errors, we arn't forcing things
> -and we'll abort the config anyways */
> - if (raidPtr->Disks[hosed_column].status != 
> rf_ds_failed) {
> - raidPtr->Disks[hosed_column].status
> - = rf_ds_failed;
> - raidPtr->numFailures++;
> - raidPtr->status = rf_rs_degraded;
> - }
> - }
> + if (hosed_column != -1)
> + rf_handle_hosed(raidPtr, cfgPtr, hosed_column);

I didn't want to commit it because it introduces a functional
change. Now if the status was failed from long before, we will
not increment numFailures, so numFailures > 1 is probably not
possible.


Re: CVS commit: src/sys/dev/raidframe

2016-12-10 Thread coypu
err, this does introduce a functional change... oops
it's if panicstr != NULL, but that's not the argument.


Re: CVS commit: src/sys/dev/raidframe

2015-12-26 Thread Robert Elz
Date:Sat, 26 Dec 2015 12:59:01 +
From:"Paul Goyette" 
Message-ID:  <20151226125901.230e1f...@cvs.netbsd.org>

  |  if it does, all we really lose is auto-configuration of raid-sets.

Auto-config of raid is what makes many of my systems function, if that
fails, the system should panic, not just bindly charge ahead.

kre



Re: CVS commit: src/sys/dev/raidframe

2015-12-26 Thread Paul Goyette

Module Name:src
Committed By:   pgoyette
Date:   Sat Dec 26 00:58:45 UTC 2015

Modified Files:
src/sys/dev/raidframe: rf_driver.c rf_driver.h rf_netbsdkintf.c

Log Message:
Modularize the raidframe driver, including rework of the unit attach
code to permit detaching (and possible module unloading).  Also,
convert tsleep()/wakeup() locking to use cv_wait_sig()/cv_broadcast().

Tested in non-modular, modular-builtin, and modular-loaded-at-runtime
environments.


Hmmm, looks like I need to do some more testing, this time in a rump 
environment.  The most recent automated test run shows six new failed 
tests related to raidframe.


I'm looking into it...



+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+--+--++


Re: CVS commit: src/sys/dev/raidframe

2015-12-26 Thread Paul Goyette

On Sun, 27 Dec 2015, Robert Elz wrote:


   Date:Sat, 26 Dec 2015 12:59:01 +
   From:"Paul Goyette" 
   Message-ID:  <20151226125901.230e1f...@cvs.netbsd.org>

 |  if it does, all we really lose is auto-configuration of raid-sets.

Auto-config of raid is what makes many of my systems function, if that
fails, the system should panic, not just bindly charge ahead.


The failure of config_finalize_register() was already only a WARNING. 
This commit just restores the original semantics.


Additionally, the only failure that i can find for ...register() is the 
return of EEXIST if the finalizer is already registered.  This really 
can't happen any more, since rev 1.238 of kern/subr_autoconf.c




+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+--+--++


Re: CVS commit: src/sys/dev/raidframe

2014-04-03 Thread Christos Zoulas
On Apr 2, 10:33am, g...@ir.bbn.com (Greg Troxel) wrote:
-- Subject: Re: CVS commit: src/sys/dev/raidframe

| It seems there are 3 behaviors for root
| 
|   1) don't change the root device (old behavior with -A yes)

That does autoconfig for raid and does not deal with root at all.

|   2) if root is on a component, change root to the raid, otherwise don't
|   change.

This behavior did not exist before my commit. It is now only turned on with
-A root. 

|   3) force the root device to be the raid (old behavior with -A root)

This does not exist anymore. You can currently:

1. boot -a
2. make a kernel that has root on raidx

Or:
1. add the ability to pass the root name through the bootblocks/userconf
2. add a raidctl -A forceroot and obey that.

| It seems to me that the behavior 1 (not in case 2) isn't useful, and
| that we could make behavior 2 the default behavior, with 3 with -A yes.

Yes, I think you are right. There could be an issue with having wd0a being
the real root and then a raid component on wd0e... In that case do we want
to make wd0e the root device because it is on the same drive?

| Is there any reason why someone would not want to use the raid for root
| when a) the system booted from a component and b) it's marked
| autoconfigurable?  If anything, I think there should be a way to disable
| autoconfiguration.

See above... There is a way to disable autoconfiguration, but there is
currently no easy way to get the old behavior? What do you think we should
do?

christos


Re: CVS commit: src/sys/dev/raidframe

2014-04-03 Thread Greg Troxel

I think the most important thing is that people who have a system that
boots now (and aren't doing anything super sick) should continue to have
that system boot after they just replace the kernel.  And we should
discuss how to do this before the change is committed :-)

 On Apr 2, 10:33am, g...@ir.bbn.com (Greg Troxel) wrote:
 -- Subject: Re: CVS commit: src/sys/dev/raidframe

 | It seems there are 3 behaviors for root
 | 
 |   1) don't change the root device (old behavior with -A yes)

 That does autoconfig for raid and does not deal with root at all.

Right, but it is a way that some systems might be set up now.

 |   2) if root is on a component, change root to the raid, otherwise don't
 |   change.

 This behavior did not exist before my commit. It is now only turned on with
 -A root. 

 |   3) force the root device to be the raid (old behavior with -A root)

 This does not exist anymore. You can currently:

 1. boot -a
 2. make a kernel that has root on raidx

so this is the real concern, that the straightforward update will make
systems unbootable.

 Or:
 1. add the ability to pass the root name through the bootblocks/userconf
 2. add a raidctl -A forceroot and obey that.

 | It seems to me that the behavior 1 (not in case 2) isn't useful, and
 | that we could make behavior 2 the default behavior, with 3 with -A yes.

 Yes, I think you are right. There could be an issue with having wd0a being
 the real root and then a raid component on wd0e... In that case do we want
 to make wd0e the root device because it is on the same drive?

I don't think so.  The case that matters for automatically making the
raid root is when one has a RAID1 and the bootblocks boot off of half of
it.   So I think the narrow if the boot device is a component of an
autoconfigured raid, switch the boot device to that raid really is what
we want to do.

 | Is there any reason why someone would not want to use the raid for root
 | when a) the system booted from a component and b) it's marked
 | autoconfigurable?  If anything, I think there should be a way to disable
 | autoconfiguration.

 See above... There is a way to disable autoconfiguration, but there is
 currently no easy way to get the old behavior? What do you think we should
 do?

I guess the idea that you boot from half a raid and then you use root on
that half - doesn't make sense.  That breaks the raid set.  I think
people either set things up as (typical examples) one of the following
ways:

  boot a kernel from wd0a, which is nonraid, and have a RAID1 on
  wd0e/wd1e marked -A root.  Here, wd0a is merely as a rescue partition
  and a way to load the kernel.  This is what you used to have to do
  before RAID1 boot support, which means I think you still do have to do
  it on some platforms.

  have wd0a/wd1a be a RAID1.  Boot from wd0a (or wd1a) with boot blocks
  that skip over the raid header, and then -A root is used to make that
  the root device.

So the first way needs -A root to keep its current semantics.   The 2nd
way works with -A root, but I think it's fine to make it work with
merely -A yes.


pgpagpzE8AyBe.pgp
Description: PGP signature


re: CVS commit: src/sys/dev/raidframe

2014-04-03 Thread Christos Zoulas
On Apr 3,  7:57am, m...@eterna.com.au (matthew green) wrote:
-- Subject: re: CVS commit: src/sys/dev/raidframe

| kernel configuration changes are not solutions, so 2 and 3 are out.  
| 
| if we do 4, we should instead add an option to mark something as a
| 'soft root', and leave the current semantics alone.  the machines i
| have that are now not going to reboot properly are both used
| remotely, so changing semantics about how they work seems like a
| bad idea.  i'm pretty sure i'm not the only one who does this.
| i think i like this the best.

Sure, we can add -A softroot. Do we want to rename the current option
to -A hardroot? If that's the consensus, I can go ahead.

christos


re: CVS commit: src/sys/dev/raidframe

2014-04-03 Thread Christos Zoulas
On Apr 3,  8:10am, m...@eterna.com.au (matthew green) wrote:
-- Subject: re: CVS commit: src/sys/dev/raidframe

| 
|   4. we can add an option to mark the raid as force root.
|  
|  if we do 4, we should instead add an option to mark something as a
|  'soft root', and leave the current semantics alone.  the machines i
|  have that are now not going to reboot properly are both used
|  remotely, so changing semantics about how they work seems like a
|  bad idea.  i'm pretty sure i'm not the only one who does this.
|  i think i like this the best.
| 
| oh, actually.  we already (can) have soft root.  by marking
| something as auto-configure, and booting from it.
| 
| what we want to change from what the past has been is to enable
| the auto-configured raids to be used as root when booted from,
| without them being marked -A root.  we should still keep the
| current -A root semantics, and then people can stop using -A
| root when they don't need to force it, and just use -A yes.

This has the problem of having a raid component on the same boot disk
with the real root partition.

christos


Re: CVS commit: src/sys/dev/raidframe

2014-04-03 Thread Greg Troxel

chris...@zoulas.com (Christos Zoulas) writes:

 On Apr 3,  7:57am, m...@eterna.com.au (matthew green) wrote:
 -- Subject: re: CVS commit: src/sys/dev/raidframe

 | kernel configuration changes are not solutions, so 2 and 3 are out.  
 | 
 | if we do 4, we should instead add an option to mark something as a
 | 'soft root', and leave the current semantics alone.  the machines i
 | have that are now not going to reboot properly are both used
 | remotely, so changing semantics about how they work seems like a
 | bad idea.  i'm pretty sure i'm not the only one who does this.
 | i think i like this the best.

 Sure, we can add -A softroot. Do we want to rename the current option
 to -A hardroot? If that's the consensus, I can go ahead.

Why don't you just leave the current one alone, and not change the name?
The names only mean what the docs say, and -A root says and make this
root, period in the docs, which is not unsurprising for -A root.
Having -A softroot or -A condroot to mean make this root if the
existing root is a component sounds good.  This way the only people
that will see new behavior are those that configure -A softroot, and I
think that's a good goal.


pgpdgzG97Nfh6.pgp
Description: PGP signature


re: CVS commit: src/sys/dev/raidframe

2014-04-02 Thread Christos Zoulas
On Apr 2,  2:10pm, m...@eterna.com.au (matthew green) wrote:
-- Subject: re: CVS commit: src/sys/dev/raidframe

| 
|  Module Name:src
|  Committed By:   christos
|  Date:   Wed Apr  2 02:17:01 UTC 2014
|  
|  Modified Files:
|  src/sys/dev/raidframe: rf_netbsdkintf.c
|  
|  Log Message:
|  If we are autoconfiguring root, then only change the booted_device if
|  we booted from one of the components of the root raid set. This allows
|  us to boot from other media, without forcing the found raid to always
|  be root. Allow the old behavior with RAIDFRAME_FORCE_ROOT.
|  XXX: cpu_rootconf() is called twice now, which prints the booted device
|  message twice. Perhaps we can remember that cpu_rootconf has been called
|  and avoid calling it twice to avoid that.
| 
| i like this.. i think.
| 
| i wonder if this will break my system that boot from a different
| device to the raid root device.

I think it will.

| eg, ultra10 whose prom can't talk to my sata disk, and boots from
| a cf/ide fob with just ofwboot and netbsd (and attaches as wd0),
| and mountroots from the raidframe on wd1+wd2.

Well, there are different options here:
1. is there a way to pass the root from ofwboot to netbsd?
2. since netbsd knows it boots normally from raid, you can put a 
root on raidx statement in your kernel.
3. you can compile the kernel with RAIDCTL_FORCE_ROOT
4. we can add an option to mark the raid as force root.

christos


Re: CVS commit: src/sys/dev/raidframe

2014-04-02 Thread Martin Husemann
On Wed, Apr 02, 2014 at 06:37:21AM -0400, Christos Zoulas wrote:
 Well, there are different options here:
 1. is there a way to pass the root from ofwboot to netbsd?
 2. since netbsd knows it boots normally from raid, you can put a 
   root on raidx statement in your kernel.
 3. you can compile the kernel with RAIDCTL_FORCE_ROOT
 4. we can add an option to mark the raid as force root.

See also PR 44774.

Another option is to make the new behaviour optional and select it
via boot.cfg (and populate the install media boot.cfg with it defined).

Martin


Re: CVS commit: src/sys/dev/raidframe

2014-04-02 Thread Christos Zoulas
On Apr 2, 12:51pm, mar...@duskware.de (Martin Husemann) wrote:
-- Subject: Re: CVS commit: src/sys/dev/raidframe

| On Wed, Apr 02, 2014 at 06:37:21AM -0400, Christos Zoulas wrote:
|  Well, there are different options here:
|  1. is there a way to pass the root from ofwboot to netbsd?
|  2. since netbsd knows it boots normally from raid, you can put a 
|  root on raidx statement in your kernel.
|  3. you can compile the kernel with RAIDCTL_FORCE_ROOT
|  4. we can add an option to mark the raid as force root.
| 
| See also PR 44774.
| 
| Another option is to make the new behaviour optional and select it
| via boot.cfg (and populate the install media boot.cfg with it defined).

I would prefer to have a rootdev= boot.cfg option instead to force things
if needed, similar to consdev=.

christos


Re: CVS commit: src/sys/dev/raidframe

2014-04-02 Thread Greg Troxel

I seemed to have missed the discussion for this change.

It seems there are 3 behaviors for root

  1) don't change the root device (old behavior with -A yes)

  2) if root is on a component, change root to the raid, otherwise don't
  change.

  3) force the root device to be the raid (old behavior with -A root)

It seems to me that the behavior 1 (not in case 2) isn't useful, and
that we could make behavior 2 the default behavior, with 3 with -A yes.

Is there any reason why someone would not want to use the raid for root
when a) the system booted from a component and b) it's marked
autoconfigurable?  If anything, I think there should be a way to disable
autoconfiguration.


pgpH2Q2GRCSi_.pgp
Description: PGP signature


Re: CVS commit: src/sys/dev/raidframe

2014-04-02 Thread David Laight
On Wed, Apr 02, 2014 at 06:37:21AM -0400, Christos Zoulas wrote:
 On Apr 2,  2:10pm, m...@eterna.com.au (matthew green) wrote:
 | i like this.. i think.
 | 
 | i wonder if this will break my system that boot from a different
 | device to the raid root device.
 
 I think it will.
 
 | eg, ultra10 whose prom can't talk to my sata disk, and boots from
 | a cf/ide fob with just ofwboot and netbsd (and attaches as wd0),
 | and mountroots from the raidframe on wd1+wd2.
 
 Well, there are different options here:
 1. is there a way to pass the root from ofwboot to netbsd?

There should be - I'd have though that loading the kernel
from other than the root parition was needed for some non-raid
configurations - eg large disks.

David

-- 
David Laight: da...@l8s.co.uk


re: CVS commit: src/sys/dev/raidframe

2014-04-02 Thread matthew green

 |  Log Message:
 |  If we are autoconfiguring root, then only change the booted_device if
 |  we booted from one of the components of the root raid set. This allows
 |  us to boot from other media, without forcing the found raid to always
 |  be root. Allow the old behavior with RAIDFRAME_FORCE_ROOT.
 |  XXX: cpu_rootconf() is called twice now, which prints the booted device
 |  message twice. Perhaps we can remember that cpu_rootconf has been called
 |  and avoid calling it twice to avoid that.
 | 
 | i like this.. i think.
 | 
 | i wonder if this will break my system that boot from a different
 | device to the raid root device.
 
 I think it will.
 
 | eg, ultra10 whose prom can't talk to my sata disk, and boots from
 | a cf/ide fob with just ofwboot and netbsd (and attaches as wd0),
 | and mountroots from the raidframe on wd1+wd2.
 
 Well, there are different options here:
 1. is there a way to pass the root from ofwboot to netbsd?
 2. since netbsd knows it boots normally from raid, you can put a 
   root on raidx statement in your kernel.
 3. you can compile the kernel with RAIDCTL_FORCE_ROOT
 4. we can add an option to mark the raid as force root.

kernel configuration changes are not solutions, so 2 and 3 are out.  

if we do 4, we should instead add an option to mark something as a
'soft root', and leave the current semantics alone.  the machines i
have that are now not going to reboot properly are both used
remotely, so changing semantics about how they work seems like a
bad idea.  i'm pretty sure i'm not the only one who does this.
i think i like this the best.

ofwboot doesn't know about the real root -- it can't talk to those
disks at all, because it can't talk to the sata controller they're
attached to, so i'm not sure how to do 1.


.mrg.


re: CVS commit: src/sys/dev/raidframe

2014-04-02 Thread matthew green

  4. we can add an option to mark the raid as force root.
 
 if we do 4, we should instead add an option to mark something as a
 'soft root', and leave the current semantics alone.  the machines i
 have that are now not going to reboot properly are both used
 remotely, so changing semantics about how they work seems like a
 bad idea.  i'm pretty sure i'm not the only one who does this.
 i think i like this the best.

oh, actually.  we already (can) have soft root.  by marking
something as auto-configure, and booting from it.

what we want to change from what the past has been is to enable
the auto-configured raids to be used as root when booted from,
without them being marked -A root.  we should still keep the
current -A root semantics, and then people can stop using -A
root when they don't need to force it, and just use -A yes.


.mrg.


Re: CVS commit: src/sys/dev/raidframe

2014-04-02 Thread Greg Oster
On Thu, 03 Apr 2014 08:10:01 +1100
matthew green m...@eterna.com.au wrote:

 
   4. we can add an option to mark the raid as force root.
  
  if we do 4, we should instead add an option to mark something as a
  'soft root', and leave the current semantics alone.  the machines i
  have that are now not going to reboot properly are both used
  remotely, so changing semantics about how they work seems like a
  bad idea.  i'm pretty sure i'm not the only one who does this.
  i think i like this the best.
 
 oh, actually.  we already (can) have soft root.  by marking
 something as auto-configure, and booting from it.
 
 what we want to change from what the past has been is to enable
 the auto-configured raids to be used as root when booted from,
 without them being marked -A root.  we should still keep the
 current -A root semantics, and then people can stop using -A
 root when they don't need to force it, and just use -A yes.

FWIW: I like this idea the best.  It also doesn't break any existing
installations.

Later...

Greg Oster


re: CVS commit: src/sys/dev/raidframe

2014-04-01 Thread matthew green

 Module Name:  src
 Committed By: christos
 Date: Wed Apr  2 02:17:01 UTC 2014
 
 Modified Files:
   src/sys/dev/raidframe: rf_netbsdkintf.c
 
 Log Message:
 If we are autoconfiguring root, then only change the booted_device if
 we booted from one of the components of the root raid set. This allows
 us to boot from other media, without forcing the found raid to always
 be root. Allow the old behavior with RAIDFRAME_FORCE_ROOT.
 XXX: cpu_rootconf() is called twice now, which prints the booted device
 message twice. Perhaps we can remember that cpu_rootconf has been called
 and avoid calling it twice to avoid that.

i like this.. i think.

i wonder if this will break my system that boot from a different
device to the raid root device.

eg, ultra10 whose prom can't talk to my sata disk, and boots from
a cf/ide fob with just ofwboot and netbsd (and attaches as wd0),
and mountroots from the raidframe on wd1+wd2.


.mrg.


CVS commit: src/sys/dev/raidframe

2010-03-03 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Wed Mar  3 14:23:27 UTC 2010

Modified Files:
src/sys/dev/raidframe: rf_paritymap.c

Log Message:
Don't attempt to read or write component label stuff from/to 'dead disks'.
Update used spares with the correct parity map bits too.

Addresses PR#42904 by Louis Guillaume.  Fix confirmed by submitter.
Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/raidframe/rf_paritymap.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/dev/raidframe/rf_paritymap.c
diff -u src/sys/dev/raidframe/rf_paritymap.c:1.3 src/sys/dev/raidframe/rf_paritymap.c:1.4
--- src/sys/dev/raidframe/rf_paritymap.c:1.3	Thu Nov 26 07:35:39 2009
+++ src/sys/dev/raidframe/rf_paritymap.c	Wed Mar  3 14:23:27 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritymap.c,v 1.3 2009/11/26 07:35:39 pooka Exp $ */
+/* $NetBSD: rf_paritymap.c,v 1.4 2010/03/03 14:23:27 oster Exp $ */
 
 /*-
  * Copyright (c) 2009 Jed Davis.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rf_paritymap.c,v 1.3 2009/11/26 07:35:39 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rf_paritymap.c,v 1.4 2010/03/03 14:23:27 oster Exp $);
 
 #include sys/param.h
 #include sys/callout.h
@@ -359,12 +359,31 @@
 	if (todisk) {
 		raidPtr = pm-raid;
 		for (col = 0; col  raidPtr-numCol; col++) {
+			if (RF_DEAD_DISK(raidPtr-Disks[col].status))
+continue;
+
 			clabel = raidget_component_label(raidPtr, col);
 			clabel-parity_map_ntick = cooldown;
 			clabel-parity_map_tickms = tickms;
 			clabel-parity_map_regions = regions;
+			
+			/* Don't touch the disk if it's been spared */
+			if (clabel-status == rf_ds_spared)
+continue;
+
 			raidflush_component_label(raidPtr, col);
 		}
+
+		/* handle the spares too... */
+		for (col = 0; col  raidPtr-numSpare; col++) {
+			if (raidPtr-Disks[raidPtr-numCol+col].status == rf_ds_used_spare) {
+clabel = raidget_component_label(raidPtr, raidPtr-numCol+col);
+clabel-parity_map_ntick = cooldown;
+clabel-parity_map_tickms = tickms;
+clabel-parity_map_regions = regions;
+raidflush_component_label(raidPtr, raidPtr-numCol+col);
+			}
+		}
 	}
 	return 0;
 }
@@ -603,6 +622,8 @@
 	 */
 	if (!force) {
 		for (col = 0; col  raidPtr-numCol; col++) {
+			if (RF_DEAD_DISK(raidPtr-Disks[col].status))
+continue;
 			clabel = raidget_component_label(raidPtr, col);
 			flags = clabel-parity_map_flags;
 			/* Check for use by non-parity-map kernel. */
@@ -670,6 +691,8 @@
 
 	/* Alter labels in-core to reflect the current view of things. */
 	for (col = 0; col  raidPtr-numCol; col++) {
+		if (RF_DEAD_DISK(raidPtr-Disks[col].status))
+			continue;
 		clabel = raidget_component_label(raidPtr, col);
 
 		if (pm_use)
@@ -683,12 +706,13 @@
 		clabel-parity_map_regions = g_regions;
 		raidflush_component_label(raidPtr, col);
 	}
+	/* Note that we're just in 'attach' here, and there won't
+	   be any spare disks at this point. */
 }
 
 /*
  * For initializing the parity-map fields of a component label, both on
- * initial creation and on reconstruct/copyback/etc.
- */
+ * initial creation and on reconstruct/copyback/etc.  */
 void
 rf_paritymap_init_label(struct rf_paritymap *pm, RF_ComponentLabel_t *clabel)
 {
@@ -724,10 +748,19 @@
 
 	dis = 0;
 	for (col = 0; col  raidPtr-numCol; col++) {
+		if (RF_DEAD_DISK(raidPtr-Disks[col].status))
+			continue;
 		clabel = raidget_component_label(raidPtr, col);
 		if (clabel-parity_map_flags  RF_PMLABEL_DISABLE)
 			dis = 1;
 	}
+for (col = 0; col  raidPtr-numSpare; col++) {
+		if (raidPtr-Disks[raidPtr-numCol+col].status != rf_ds_used_spare)
+continue;
+clabel = raidget_component_label(raidPtr, raidPtr-numCol+col);
+if (clabel-parity_map_flags  RF_PMLABEL_DISABLE)
+dis = 1;
+}
 
 	return dis;
 }
@@ -740,6 +773,8 @@
 	RF_RowCol_t col;
 
 	for (col = 0; col  raidPtr-numCol; col++) {
+		if (RF_DEAD_DISK(raidPtr-Disks[col].status))
+			continue;
 		clabel = raidget_component_label(raidPtr, col);
 		if (dis)
 			clabel-parity_map_flags |= RF_PMLABEL_DISABLE;
@@ -747,4 +782,17 @@
 			clabel-parity_map_flags = ~RF_PMLABEL_DISABLE;
 		raidflush_component_label(raidPtr, col);
 	}
+
+	/* update any used spares as well */
+	for (col = 0; col  raidPtr-numSpare; col++) {
+		if (raidPtr-Disks[raidPtr-numCol+col].status != rf_ds_used_spare)
+			continue;
+
+		clabel = raidget_component_label(raidPtr, raidPtr-numCol+col);
+		if (dis)
+			clabel-parity_map_flags |= RF_PMLABEL_DISABLE;
+		else
+			clabel-parity_map_flags = ~RF_PMLABEL_DISABLE;
+		raidflush_component_label(raidPtr, raidPtr-numCol+col);
+	}
 }



CVS commit: src/sys/dev/raidframe

2010-03-03 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Wed Mar  3 14:23:27 UTC 2010

Modified Files:
src/sys/dev/raidframe: rf_paritymap.c

Log Message:
Don't attempt to read or write component label stuff from/to 'dead disks'.
Update used spares with the correct parity map bits too.

Addresses PR#42904 by Louis Guillaume.  Fix confirmed by submitter.
Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/raidframe/rf_paritymap.c

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



CVS commit: src/sys/dev/raidframe

2010-03-01 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Mon Mar  1 14:51:58 UTC 2010

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Don't merge a good parity map with random stuff in the event that the
first component is missing.  (Since the merging just OR's the maps,
this isn't that big of a deal, as it will just over-estimate the
amount of checking that needs to be done.)


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.271 src/sys/dev/raidframe/rf_netbsdkintf.c:1.272
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.271	Tue Dec  1 01:03:54 2009
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Mon Mar  1 14:51:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.271 2009/12/01 01:03:54 dyoung Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.272 2010/03/01 14:51:58 oster Exp $	*/
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -139,7 +139,7 @@
  ***/
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rf_netbsdkintf.c,v 1.271 2009/12/01 01:03:54 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: rf_netbsdkintf.c,v 1.272 2010/03/01 14:51:58 oster Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -2610,8 +2610,9 @@
 rf_paritymap_kern_read(RF_Raid_t *raidPtr, struct rf_paritymap_ondisk *map)
 {
 	struct rf_paritymap_ondisk tmp;
-	int c;
+	int c,first;
 
+	first=1;
 	for (c = 0; c  raidPtr-numCol; c++) {
 		/* Skip dead disks. */
 		if (RF_DEAD_DISK(raidPtr-Disks[c].status))
@@ -2620,8 +2621,9 @@
 		raidPtr-raid_cinfo[c].ci_vp, tmp,
 		RF_PARITYMAP_NBYTE,
 		RF_PARITY_MAP_OFFSET, RF_PARITY_MAP_SIZE);
-		if (c == 0) {
+		if (first) {
 			memcpy(map, tmp, sizeof(*map));
+			first = 0;
 		} else {
 			rf_paritymap_merge(map, tmp);
 		}



CVS commit: src/sys/dev/raidframe

2010-03-01 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Mon Mar  1 14:51:58 UTC 2010

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Don't merge a good parity map with random stuff in the event that the
first component is missing.  (Since the merging just OR's the maps,
this isn't that big of a deal, as it will just over-estimate the
amount of checking that needs to be done.)


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/sys/dev/raidframe/rf_netbsdkintf.c

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



CVS commit: src/sys/dev/raidframe

2010-03-01 Thread Jed Davis
Module Name:src
Committed By:   jld
Date:   Mon Mar  1 21:10:27 UTC 2010

Modified Files:
src/sys/dev/raidframe: rf_disks.c

Log Message:
When setting up a non-autoconfigured RAID set, fail a component if the
attempt to read its label fails.  OKed by os...@.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/raidframe/rf_disks.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/dev/raidframe/rf_disks.c
diff -u src/sys/dev/raidframe/rf_disks.c:1.72 src/sys/dev/raidframe/rf_disks.c:1.73
--- src/sys/dev/raidframe/rf_disks.c:1.72	Tue Nov 17 18:54:26 2009
+++ src/sys/dev/raidframe/rf_disks.c	Mon Mar  1 21:10:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_disks.c,v 1.72 2009/11/17 18:54:26 jld Exp $	*/
+/*	$NetBSD: rf_disks.c,v 1.73 2010/03/01 21:10:26 jld 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.72 2009/11/17 18:54:26 jld Exp $);
+__KERNEL_RCSID(0, $NetBSD: rf_disks.c,v 1.73 2010/03/01 21:10:26 jld Exp $);
 
 #include dev/raidframe/raidframevar.h
 
@@ -132,7 +132,9 @@
 			goto fail;
 
 		if (disks[c].status == rf_ds_optimal) {
-			raidfetch_component_label(raidPtr, c);
+			ret = raidfetch_component_label(raidPtr, c);
+			if (ret)
+goto fail;
 		}
 
 		if (disks[c].status != rf_ds_optimal) {



CVS commit: src/sys/dev/raidframe

2010-03-01 Thread Jed Davis
Module Name:src
Committed By:   jld
Date:   Mon Mar  1 21:10:27 UTC 2010

Modified Files:
src/sys/dev/raidframe: rf_disks.c

Log Message:
When setting up a non-autoconfigured RAID set, fail a component if the
attempt to read its label fails.  OKed by os...@.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/raidframe/rf_disks.c

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



re: CVS commit: src/sys/dev/raidframe

2009-11-05 Thread matthew green

   Module Name: src
   Committed By:dyoung
   Date:Thu Nov  5 17:52:32 UTC 2009
   
   Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c
   
   Log Message:
   Use deviter(9) instead of accessing alldevs directly.  Compile-tested,
   only.


this worries me.  compile-tested only on our raid code base
seems like a recipe for data loss.


.mrg.