Go to file
oster 87e6ffb752 As noted by Thierry Deval in a posting to misc/at/openbsd.org,
rf_DecrAccessesCountState wasn't in the correct spot in
RF_AccessState_e.  Following up on that has resulted in one other
correction.  Changing orderings of these states is tricky, and
shouldn't be attempted without some thorough analysis.  For the
changes committed, the following analysis is offerred:

1) RAIDframe uses a little state machine to take care of building,
executing, and processing the DAGs used to direct IO.

2) The rf_DecrAccessesCountState state is handled by the function
rf_State_DecrAccessCount().  The purpose of this state is to
decrement the number of "accesses-in-flight".

3) rf_Cleanup_State is handled by rf_State_Cleanup().  Its job is to
do general cleanup of DAG arrays and any stripe locks.

4) DefaultStates[] in rf_layout.c indicates that the right spot
for rf_DecrAccessesCountState is just before rf_Cleanup_State.
Analysis of code for both states indicates that the order doesn't
matter too much, although rf_State_DecrAccessCount() should probably
take place *after* rf_State_Cleanup() to be more correct.

5) Comments in rf_State_ProcessDAG() indicates that the next state
should be rf_Cleanup_State.  However: it attempts to get there by using

 desc->state++;

which actually takes it to just rf_DecrAccessesCountState! This turned
out to be OK before, since rf_Cleanup_State would follow right after,
and all would be taken careof (albeit in arguably the "less correct"
order).

6) With the current ordering, if we head directly to rf_Cleanup_State
(as we do, for example, if multiple components fail in a RAID 5 set),
then we'll actually miss going trough rf_DecrAccessesCountState), and
could end up never being able to reach quiescence!  Perhaps not too
big of a deal, given that the RAID set is pretty much toast by that
point at which such a drastic state change happens, but might as well
have this correct.

The changes made are:
1) Since having rf_State_DecrAccessCount() come after
rf_State_Cleanup() is just fine, change rf_layout.c to reflect that
rf_DecrAccessesCountState comes after rf_Cleanup_State (i.e. they swap
positions in the state list).  This means that going to
rf_Cleanup_State after bailing on a failed DAG access will do all the
right things -- the state will get cleaned up, and then the access
counts will get decremented properly.  The comment in
rf_State_ProcessDAG() is now actually correct -- the next state *will*
be rf_Cleanup_State.

2) Move rf_DecrAccessesCountState in RF_AccessState_e to just after
rf_CleanupState.  This puts RF_AccessState_e in sync with
DefaultStates[].  Fortunately, these states are rarely referred to by
name, and so this change ends up being mostly cosmetic -- it really
only fixes cleanup behaviour for the recent "Failed to create a DAG"
changes.
2004-01-04 06:37:16 +00:00
bin Remove unused code left over from temporary printescaped functionality. 2004-01-04 03:34:00 +00:00
contrib/sys Synchronize with FreeBSD: 2003-12-16 06:48:08 +00:00
crypto Fix the checkflist for builds without Kerberos 4 (MKKERBEROS4=no) 2003-12-11 09:46:26 +00:00
dist Don't bother complaining about "no IPv6 interfaces" or "no IPv4 interfaces" 2003-12-20 17:38:19 +00:00
distrib Support MKCRYPTO=no 2004-01-04 00:54:18 +00:00
doc I'm responsible for sysctl now 2004-01-03 05:55:42 +00:00
etc use !="no" instead of =="yes" 2004-01-03 13:58:26 +00:00
games Move AUTHORS section directly before BUGS section. 2004-01-03 13:32:23 +00:00
gnu Consistently check ${TOOLCHAIN_MISSING} against "no". 2004-01-03 14:04:27 +00:00
include - libc.so.12.109 and libpthread.so.0.4 2004-01-02 18:56:39 +00:00
lib Fix a cast for little endian archs 2004-01-03 23:50:47 +00:00
libexec fix debug output. 2003-12-17 09:13:41 +00:00
regress support MKCRYPTO=no (des.h is not present) 2004-01-04 00:25:52 +00:00
rescue systrace needs libevent now. 2003-11-29 05:47:51 +00:00
sbin Standardize flags display in usage. 2004-01-04 00:13:00 +00:00
share Add two acronyms suggested by Pavel Machek <pavel@ucw.cz>. 2004-01-04 02:16:39 +00:00
sys As noted by Thierry Deval in a posting to misc/at/openbsd.org, 2004-01-04 06:37:16 +00:00
tools Consistently check ${TOOLCHAIN_MISSING} against "no". 2004-01-03 14:04:27 +00:00
usr.bin Bump Dd for previous. 2004-01-04 02:24:32 +00:00
usr.sbin In the "quick depends pre-scan", first print all bad matching depends, 2004-01-04 01:47:35 +00:00
x11 Added Xserver/Xserver/Xhpc and Xserver/hw/netbsd/hpc directories for 2004-01-03 02:05:49 +00:00
BUILDING Note tools/compat/README as the place to get notes from non-native cross builds 2003-12-29 07:10:24 +00:00
Makefile only build do-lib-libdes if ${MKCRYPTO}!=no 2004-01-04 00:27:15 +00:00
Makefile.inc don't set KERNSRCDIR here; pull in <bsd.kernobj.mk> if you need it 2002-04-10 14:53:43 +00:00
UPDATING Fix typo. 2003-12-31 16:20:54 +00:00
build.sh tweak usage message. 2003-11-14 12:38:12 +00:00