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.