Home | History | Annotate | Download | only in raidframe
History log of /src/sys/dev/raidframe/rf_disks.c
RevisionDateAuthorComments
 1.95  25-Sep-2023  oster snprintf() should really include a format.
 1.94  17-Sep-2023  oster Implement hot removal of spares and components. From manu@.

Implement a long desired feature of automatically incorporating
a used spare into the array after a reconstruct.

Given the configuration:
Components:
/dev/wd0e: failed
/dev/wd1e: optimal
/dev/wd2e: optimal
Spares:
/dev/wd3e: spare

Running 'raidctl -F /dev/wd0e raid0' will now result in the
following configuration after a successful rebuild:
Components:
/dev/wd3e: optimal
/dev/wd1e: optimal
/dev/wd2e: optimal
No spares.

Thanks to manu@ for the development of the initial set of changes
which allowed the changes to automatically incorporate a used spare
to come to fruition. Thanks also to manu@ for useful discussions
about and additional testing of these changes.
 1.93  10-Aug-2022  mrg branches: 1.93.4;
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+b584943ad1f8ab9d4fe0@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@
 1.92  08-Dec-2019  mlelstv Switch to vn_bdev_open* functions.
 1.91  09-Feb-2019  christos branches: 1.91.4;
- Change the allocation macros to be more like function calls
- Change sizeof(type) -> sizeof(*variable)
- Use macros for the long buffer length allocations
- Remove "bit polishing" memsets() -- do them only once
- Remove unnecessary casts

Thanks to oster@ for finding bugs and testing.
 1.90  08-Feb-2019  christos PR/53956: Havard Eidnes: raidframe fails to create raid set on disks.
The test to check if force was reversed when the code was factored out.
 1.89  13-Jan-2017  christos branches: 1.89.8; 1.89.16;
more faithful to the original (from coypu)
 1.88  13-Jan-2017  christos Don't consider a disk hosed if we did not find a column for it; dedup code.
 1.87  18-Oct-2014  snj branches: 1.87.2; 1.87.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.86  14-Jun-2014  hannken Change dk_lookup() to return an anonymous vnode not associated with
any file system. Change all consumers of dk_lookup() to get the
device from "v_rdev" instead of VOP_GETATTR() as specfs does not
support VOP_GETATTR(). Devices obtained with dk_lookup() will no
longer disappear on forced unmounts.

Fix for PR kern/48849 (root mirror raid fails on shutdown)

Welcome to 6.99.44
 1.85  25-Mar-2014  christos branches: 1.85.2;
kill sprintf
 1.84  15-Sep-2013  martin Avoid unused variable warnings
 1.83  19-Jul-2012  pooka branches: 1.83.2; 1.83.4;
Initialize values to squelch gcc.

from Greg Oster
 1.82  14-Oct-2011  hannken branches: 1.82.2;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.81  03-Aug-2011  oster Remove unused 'struct lwp *' from rf_getdisksize. No functional changes.
 1.80  29-Jul-2011  oster In rf_disks.c make sure ser_values and ser_count arrays are
initialized before use.

Validate the component label before considering a component for use,
and make sure we only consider components that are optimal.

Fixes PR#44251. All atf RAIDframe tests now pass.
 1.79  11-May-2011  mrg convert the main raidPtr mutex to a kmutex, and add a couple of cv's to
cover the old sleep/wakeup points for adding_hot_spare and waitForReconCond.
convert all remaining simple_lock's to kmutexes (they're not used or compiled
right now... even with all options enabled) and remove the support for them.

this leaves just a pair of tsleep()/wakeup() calls using old scheduling APIs.
 1.78  19-Feb-2011  enami Define accessors for number of blocks and partition size in the
component label and use them where appropriate. Disscussed on tech-kern.
 1.77  13-Feb-2011  enami Remove one of trailing whitespace which adds unnecessary difference
against netbsd-5 branch.
 1.76  04-Dec-2010  mrg branches: 1.76.2; 1.76.4;
apply my patch to support non-512K sector disks (at least, upto 16KB
sector disks..) from my tech-kern post:


the following patch let's me access both 512 byte and 4K
sector disks at the same time, as long as they are in
separate raids. the existing rf code assumes/enforces
this part, i just made it support other sets concurrently.

the main change is moving the parity bitmap to the sector
after the component label sector(s), instead of being
immediately after the label, which meant it was on the same
sector as the label for >1024 byte devices.

i'm a little annoyed at having to add a 2nd call to
getdisksize() to enable auto-configure to work, but i
don't see another way that wasn't much uglier.
 1.75  19-Nov-2010  dholland Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.74  01-Nov-2010  mrg add support for >2TB raid devices.

- add two new members to the component label:
u_int numBlocksHi
u_int partitionSizeHi
and store the top 32 bits of the real number of blocks and
partition size. modify rf_print_component_label(),
rf_does_it_fit(), rf_AutoConfigureDisks() and
rf_ReconstructFailedDiskBasic().

- call disk_blocksize() after disk_attach() [ from mlelstv ]

- shift the block number relative to DEV_BSHIFT in raidstart()
and InitBP() so that accesses work for non 512-byte devices.
[ from mlelstv ]

- update rf_getdisksize() to use the new getdisksize() [ from
mlelstv. this part needs a separate change for netbsd-5. ]


reviewed by: oster, christos and darrenr
 1.73  01-Mar-2010  jld branches: 1.73.2;
When setting up a non-autoconfigured RAID set, fail a component if the
attempt to read its label fails. OKed by oster@.
 1.72  17-Nov-2009  jld branches: 1.72.2;
Finally commit the RAIDframe parity map Summer Of Code project.

Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.

Discussed on tech-kern@ to a general air of approval; exhortations to
commit from mrg@, christos@, and others.

Thanks to Google for their sponsorship, oster@ for mentoring the
project, assorted developers for trying very hard to break it, and
probably more I'm forgetting.
 1.71  03-Apr-2009  sborrill Switch various printfs from %ld and %d to PRIu64, etc. to be more consistent
about types (for instance uint32_t was being printed with %d).
 1.70  28-Apr-2008  martin branches: 1.70.8; 1.70.10; 1.70.14;
Remove clause 3 and 4 from TNF licenses
 1.69  26-Jan-2008  oster branches: 1.69.6; 1.69.8; 1.69.10;
In a land before time, when kernel processes roamed the system, we
needed to keep track of the kernel process that opened a device in
order to close it with the right credentials. Flash forward to today
where curlwp is now quite sufficient.
 1.68  26-Nov-2007  pooka Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.67  18-Jul-2007  ad branches: 1.67.4; 1.67.6; 1.67.12; 1.67.14;
Fix fallout from recent kthread changes.
 1.66  26-Jun-2007  cube branches: 1.66.2;
Change dk_lookup() to accept an additional argument of the type enum uio_seg
that tells whether the given path is in user space or kernel space, so it
can tell NDINIT().

While the raidframe calls were ok, both ccd(4) and cgd(4) were passing
pointers to user space data, which leads to strange error on i386, as
reported by Jukka Salmi on current-users.

The issue has been there since last august, I'm actually a bit surprised
that no one in the meantime has used ccd(4) or cgd(4) on an arch where it
would have simply faulted.
 1.65  13-Mar-2007  christos Fix typo in print statement; from khorben
 1.64  16-Nov-2006  christos branches: 1.64.2; 1.64.4; 1.64.8; 1.64.10; 1.64.12;
__unused removal on arguments; approved by core.
 1.63  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.62  27-Aug-2006  christos branches: 1.62.2; 1.62.4;
- use dk_lookup instead of our home-spun version.
- allow raid to be configured in a wedge
- allow wedges to be configured in a raid
- add autoconfiguration of wedges in a raid
 1.61  21-Jul-2006  ad - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.60  14-May-2006  elad integrate kauth.
 1.59  11-Dec-2005  christos branches: 1.59.4; 1.59.6; 1.59.8; 1.59.10; 1.59.12;
merge ktrace-lwp.
 1.58  29-May-2005  christos branches: 1.58.2;
- avoid variable shadowing
- add a lot of const
- remove parameters from functin declarations
 1.57  27-Feb-2005  perry branches: 1.57.2;
nuke trailing whitespace
 1.56  10-Oct-2004  tron branches: 1.56.4; 1.56.6;
Make this actually compile.
 1.55  10-Oct-2004  mrg when truncating a spare disk, also log what its original size was.
 1.54  26-Aug-2004  oster rf_CheckLabels() needs to die, but for now, we patch it by setting
fatal_error when too_fatal is set, and by setting fatal_error in a
couple other critical cases.
 1.53  22-May-2004  oster Add support for the word "absent" in the "disks" section of
RAID config files. Used as a placeholder for a component that
will eventually be added into the set.
 1.52  22-Apr-2004  itojun sprintf -> snprintf
 1.51  21-Mar-2004  oster branches: 1.51.2;
Fix a nastly little bug that I've been chasing over the past 12 hours.
If raidPtr->numFailures isn't initialized properly, then all sorts of
whacky things can happen, including incorrect DAGs being generated.
(Triggering this problem is a little esoteric, which is why this bug has
been in hiding for so long -- I only saw it after rebooting with a
degraded RAID 5 set that was autoconfigured, rebuilding the failed
componennt, and then failing the component while IO was happening to
the RAID set.)
 1.50  13-Mar-2004  oster raidPtr->num_spare is *NOT* sufficient here. We must allocate
at least an additional RF_MAXSPARE spare units, just in case.
 1.49  30-Dec-2003  oster Some days you wonder if some of the function declaration consistency
was just an accident in the first place. Cleanup function decls and
a few comments. [ok.. so I wasn't going to fix this many.. but once
you're on a roll....]
 1.48  30-Dec-2003  oster Fix slight bogon from row removal. 'r' would have been 0 here, not 1,
which means r*raidPtr->numCol would have always been 0, not raidPtr->numCol.
 1.47  29-Dec-2003  oster - first kick at a major reworking of RAIDframe's memory allocation code:
- all freelists converted to pools
- initialization of structure members in certain cases where
code was relying on specific allocation and usage properties
to keep structures in a "known state" (that doesn't work with
pools!).
- make most pool_get() be "PR_WAITOK" until they can be analyzed
further, and/or have proper error handling added.
- all RF_Mallocs zero the space returned, so there is no difference
between RF_Calloc and RF_Malloc. In fact, all the RF_Calloc()'s
do is tend to do is get things horribly confused.
Make RF_Malloc() the "general memory allocator", with
RF_MallocAndAdd() the "general memory allocator with
allocation list".
- some of these RF_Malloc's et al. are destined to disappear.
- remove rf_rdp_freelist entirely (it's not used anywhere!)
- remove: #include "rf_freelist.h"
- to the files that were relying on the above, add: #include "rf_general.h"
- add: #include "rf_debugMem.h" to rf_shutdown.h to make it happy
about the loss of: #include "rf_freelist.h".

This shrinks an i386 GENERIC kernel by approx 5K. RAIDframe now
weighs in at about 162K on i386.
 1.46  29-Dec-2003  oster [Having received a definite lack of strenuous objection, a small amount
of strenuous agreement, and some general agreement, this commit is
going ahead because it's now starting to block some other changes I
wish to make.]

Remove most of the support for the concept of "rows" from RAIDframe.
While the "row" interface has been exported to the world, RAIDframe
internals have really only supported a single row, even though they
have feigned support of multiple rows.

Nothing changes in configuration land -- config files still need to
specify a single row, etc. All auto-config structures remain fully
forward/backwards compatible.

The only visible difference to the average user should be a
reduction in the size of a GENERIC kernel (i386) by 4.5K. For those
of us trolling through RAIDframe kernel code, a lot of the driver
configuration code has become a LOT easier to read.
 1.45  21-Oct-2003  fvdl Correct NULL abuse.
 1.44  29-Jun-2003  fvdl branches: 1.44.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.43  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.42  13-Apr-2003  oster Remember to close the component if we decide it's not suitable for use
as a hot spare. Closes PR#20989 by David Brownlee.
 1.41  21-Mar-2003  dsl Use 'void *' instead of 'caddr_t' in prototypes of VOP_IOCTL, VOP_FCNTL
and VOP_ADVLOCK, delete casts from callers (and some to copyin/out).
 1.40  22-Oct-2002  oster Better protect hot-spare adding, and make it LOCKDEBUG friendly.
 1.39  23-Sep-2002  oster Neither force nor retcode are used. *poof* Thanks to Simon B.
 1.38  15-Nov-2001  lukem branches: 1.38.10;
don't need <sys/types.h> when including <sys/param.h>
 1.37  13-Nov-2001  lukem add RCSIDs
 1.36  05-Oct-2001  oster More #if 0's bite the dust.
 1.35  04-Oct-2001  oster Step 2 of the disentanglement. We now look to <dev/raidframe/*> for
the stuff that used to live in rf_types.h, rf_raidframe.h, rf_layout.h,
rf_netbsd.h, rf_raid.h, rf_decluster,h, and a few other places.
Believe it or not, when this is all done, things will be cleaner.

No functional changes to RAIDframe.
 1.34  05-Dec-2000  oster branches: 1.34.2; 1.34.4; 1.34.6;
Fix a couple of warnings about uninitialized variables. Thanks go to
Frank van der Linden for pointing these out.
 1.33  21-Sep-2000  oster Correct a few calls to VOP_CLOSE().
 1.32  08-Sep-2000  oster Make sure we are passing a locked vp to VOP_CLOSE.
 1.31  02-Jun-2000  oster branches: 1.31.2;
Use 'componentN' rather than leaving blanks for non-existant disks
in the 'raidctl -s' output.
 1.30  29-May-2000  oster Don't let the autodetection code get tripped up by negative mod-counters.
 1.29  28-May-2000  oster In the event that an up-to-date component cannot be located for a specific
position, see if there is a failed component still hanging around that
we can use instead (but still mark it as failed). This leads to more
reasonable behaviour (and fewer surprises!) when autoconfiguring and
failed (or previously failed) components are still on the system.
 1.28  28-May-2000  oster We need to be slightly more clever during auto-configuration, to make
sure that we a) don't ignore components with correct mod-counters, and
b) do ignore components with bogus mod-counters.
 1.27  31-Mar-2000  oster branches: 1.27.2;
Minor cleanup of unneeded verbosity.
 1.26  27-Mar-2000  oster cleanup function prototypes.
 1.25  26-Mar-2000  oster Add bits for eventual support of deleteing components and moving
hot-spares into the main set.
 1.24  25-Mar-2000  oster Nuke a function prototype that shouldn't be here.
 1.23  07-Mar-2000  oster Move rf_UnconfigureVnodes to rf_netbsdkintf.c where it will be more at home.
Add prototype to rf_kintf.h, and nuke old prototypes from rf_disks.c and
rf_driver.c .
 1.22  03-Mar-2000  oster Use the common disk allocation code, rather doing things the old way.
 1.21  03-Mar-2000  oster Minor formatting cleanup.
 1.20  25-Feb-2000  oster - ignore components whose mod_counter values are too low.
- noting the mod_counter for autoconfigured sets would be a win too.
 1.19  24-Feb-2000  oster - record the pointer to the DiskQueueSW so we can use that when
we hot-add a spare.
- use the above info when adding a spare.
 1.18  24-Feb-2000  oster Now that we have the information available, use the general maxOutstanding
value for the RAID set, rather than looking at Queue[0][0] (which may not
exist).
 1.17  24-Feb-2000  oster - make sure we note the parity status in the autoconfig case.
- also, make sure we grab the serial number from the component labels
when we autoconfig.
 1.16  23-Feb-2000  oster Make a note of autoconfigured components.
 1.15  13-Feb-2000  oster Get recent changes into the tree:
- make component_label variables more consistent (==> clabel)
- re-work incorrect component configuration code
- re-work disk configuration code
- cleanup initial configuration of raidPtr info
- add auto-detection of components and RAID sets (Disabled, for now)
- allow / on RAID sets (Disabled, for now)
- rename "config_disk_queue" to "rf_ConfigureDiskQueue" and properly prototype
in rf_diskqueue.h
- protect some headers with #if _KERNEL (XXX this needs to be fixed properly)
and cleanup header formatting.
- expand the component labels (yes, they should be backward/forward compatible)
- other bits and pieces (some function names are still bogus, and will get
changed soon)
 1.14  09-Jan-2000  oster - move a bunch of function prototypes to rf_kintf.h
- general cleanup of a number of prototypes that were scattered around.
 1.13  14-Aug-1999  oster branches: 1.13.2;
Remove a 'struct proc *'-passing abomination that's been bugging me
for quite some time.
 1.12  13-Aug-1999  oster rf_sys.h does not need to be #included in any of these files, and, actually,
is no longer needed at all.
 1.11  10-Aug-1999  oster When reporting the status of a component during configuration,
provide more intuitive information about whether a component is clean
or not.
 1.10  04-Jun-1999  oster When adding a hot spare, remember to lock down the main raidPtr
structure before mucking with its contents.
 1.9  04-Jun-1999  oster Don't count two problems with a single component as two
component failures! Also: remember to configure the disk queues for
the spares -- failure to do that is Bad(tm).
Huge Thanks to Martin Laubach for helping track this down.
 1.8  18-Mar-1999  oster branches: 1.8.2; 1.8.4; 1.8.6;
Correct a component label problem where a RAID 1 set with a
failed component would not configure properly in certain situations.
 1.7  02-Mar-1999  oster Update for recent changes including component label support, clean
bits, rebuilding components in-place, adding hot spares, shutdownhooks, etc.
 1.6  24-Feb-1999  oster Minor cleanups and code rearranging. Now knows a little about component
labels and how to deal with hot-adding spare components. Still work in
progress -- component labels and hot-adding are not enabled (yet).
 1.5  05-Feb-1999  oster Phase 2 of the RAIDframe cleanup. The source is now closer to KNF
and is much easier to read. No functionality changes.
 1.4  26-Jan-1999  oster rf_ccmn.h no longer needed. Nuke it's inclusion from rf_disks.c.
 1.3  26-Jan-1999  oster RAIDframe cleanup, phase 1. Nuke simulator support, user-land driver,
out-dated comments, and other unneeded stuff. This helps prepare
for cleaning up the rest of the code, and adding new functionality.

No functional changes to the kernel code in this commit.
 1.2  03-Dec-1998  oster If a configuration fails due to a non-existant spare, remember to release
any previously allocated components before bailing. Credit to Manuel Bouyer
for noticing this.
 1.1  13-Nov-1998  oster RAIDframe, version 1.1, from the Parallel Data Laboratory at
Carnegie Mellon University. Full RAID implementation, including
levels 0, 1, 4, 5, 6, parity logging, and a few other goodies.
Ported to NetBSD by Greg Oster.
 1.8.6.1  30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.8.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.8.2.1  23-Jun-1999  perry pullup 1.8->1.9 (oster)
 1.13.2.2  08-Dec-2000  bouyer Sync with HEAD.
 1.13.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.27.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.31.2.2  17-Oct-2000  tv Pullup 1.33 [oster]:
Correct a few calls to VOP_CLOSE().
 1.31.2.1  08-Sep-2000  oster Pullup 1.31->1.32 of rf_disks.c
Pullup 1.95->1.96 of rf_netbsdkintf.c
Approved by: thorpej

Make sure we are passing a locked vp to VOP_CLOSE.
 1.34.6.2  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.34.6.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.34.4.2  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.34.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.34.2.5  11-Nov-2002  nathanw Catch up to -current
 1.34.2.4  18-Oct-2002  nathanw Catch up to -current.
 1.34.2.3  08-Jan-2002  nathanw Catch up to -current.
 1.34.2.2  14-Nov-2001  nathanw Catch up to -current.
 1.34.2.1  22-Oct-2001  nathanw Catch up to -current.
 1.38.10.2  31-Aug-2004  jmc Pullup rev 1.54 (requested by oster in ticket #1740)

rf_CheckLabels() needs to die, but for now, we patch it by setting
fatal_error when too_fatal is set, and by setting fatal_error in a
couple other critical cases.
 1.38.10.1  20-Oct-2003  cyber Pull up revision 1.42 (requested by oster in ticket #1531):
Remember to close the component if we decide it's not suitable for use
as a hot spare. Closes PR#20989 by David Brownlee.
 1.44.2.8  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.44.2.7  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.44.2.6  19-Oct-2004  skrll Sync with HEAD
 1.44.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.44.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.44.2.3  03-Sep-2004  skrll Sync with HEAD
 1.44.2.2  03-Aug-2004  skrll Sync with HEAD
 1.44.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.51.2.2  30-Aug-2004  tron Pull up revision 1.54 (requested by oster in ticket #797):
rf_CheckLabels() needs to die, but for now, we patch it by setting
fatal_error when too_fatal is set, and by setting fatal_error in a
couple other critical cases.
 1.51.2.1  23-May-2004  tron Pull up revision 1.53 (requested by oster in ticket #377):
Add support for the word "absent" in the "disks" section of
RAID config files. Used as a placeholder for a component that
will eventually be added into the set.
 1.56.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.56.4.1  29-Apr-2005  kent sync with -current
 1.57.2.1  17-Jun-2005  tron Pull up revision 1.58 (requested by oster in ticket #472):
- avoid variable shadowing
- add a lot of const
- remove parameters from function declarations
 1.58.2.5  04-Feb-2008  yamt sync with head.
 1.58.2.4  07-Dec-2007  yamt sync with head
 1.58.2.3  03-Sep-2007  yamt sync with head.
 1.58.2.2  30-Dec-2006  yamt sync with head.
 1.58.2.1  21-Jun-2006  yamt sync with head.
 1.59.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.59.10.2  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.59.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.59.8.3  03-Sep-2006  yamt sync with head.
 1.59.8.2  11-Aug-2006  yamt sync with head
 1.59.8.1  24-May-2006  yamt sync with head.
 1.59.6.1  01-Jun-2006  kardel Sync with head.
 1.59.4.1  09-Sep-2006  rpaulo sync with head
 1.62.4.2  10-Dec-2006  yamt sync with head.
 1.62.4.1  22-Oct-2006  yamt sync with head
 1.62.2.1  18-Nov-2006  ad Sync with head.
 1.64.12.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.64.10.1  11-Jul-2007  mjf Sync with head.
 1.64.8.3  20-Aug-2007  ad Sync with HEAD.
 1.64.8.2  15-Jul-2007  ad Sync with head.
 1.64.8.1  13-Mar-2007  ad Sync with head.
 1.64.4.1  24-Mar-2007  yamt sync with head.
 1.64.2.1  01-Jul-2007  bouyer Pull up following revision(s) (requested by cube in ticket #748):
sys/dev/dksubr.c: revision 1.29
sys/dev/ccd.c: revision 1.120
sys/dev/raidframe/rf_disks.c: revision 1.66
sys/dev/raidframe/rf_reconstruct.c: revision 1.96
sys/dev/cgd.c: revision 1.45
sys/dev/dkvar.h: revision 1.11
sys/dev/raidframe/rf_copyback.c: revision 1.38
Change dk_lookup() to accept an additional argument of the type enum uio_seg
that tells whether the given path is in user space or kernel space, so it
can tell NDINIT().
While the raidframe calls were ok, both ccd(4) and cgd(4) were passing
pointers to user space data, which leads to strange error on i386, as
reported by Jukka Salmi on current-users.
 1.66.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.67.14.2  18-Jul-2007  ad Fix fallout from recent kthread changes.
 1.67.14.1  18-Jul-2007  ad file rf_disks.c was added on branch matt-mips64 on 2007-07-18 19:04:59 +0000
 1.67.12.2  18-Feb-2008  mjf Sync with HEAD.
 1.67.12.1  08-Dec-2007  mjf Sync with HEAD.
 1.67.6.2  23-Mar-2008  matt sync with HEAD
 1.67.6.1  09-Jan-2008  matt sync with HEAD
 1.67.4.1  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.69.10.3  11-Mar-2010  yamt sync with head
 1.69.10.2  04-May-2009  yamt sync with head.
 1.69.10.1  16-May-2008  yamt sync with head.
 1.69.8.1  18-May-2008  yamt sync with head.
 1.69.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.70.14.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.70.10.5  13-Jun-2012  sborrill Pull up the following revisions(s) (requested by mrg in ticket #1774):
sbin/raidctl/raidctl.c: revision 1.52
sys/dev/raidframe/raidframevar.h: revision 1.15
sys/dev/raidframe/rf_copyback.c: revision 1.45
sys/dev/raidframe/rf_disks.c: revision 1.78
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.282,1.284
sys/dev/raidframe/rf_reconstruct.c: revision 1.111

Fix garbage values in partitionSizeHi with RAID array > 2TB. Stops the check against
rf_component_label_partitionsize() failing and stopping auto-configure.
 1.70.10.4  07-Jan-2011  riz Pull up following revision(s) (requested by mrg in ticket #1522):
sys/dev/raidframe/rf_disks.c: revision 1.76
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.276
apply my patch to support non-512K sector disks (at least, upto 16KB
sector disks..) from my tech-kern post:
the following patch let's me access both 512 byte and 4K
sector disks at the same time, as long as they are in
separate raids. the existing rf code assumes/enforces
this part, i just made it support other sets concurrently.
the main change is moving the parity bitmap to the sector
after the component label sector(s), instead of being
immediately after the label, which meant it was on the same
sector as the label for >1024 byte devices.
i'm a little annoyed at having to add a 2nd call to
getdisksize() to enable auto-configure to work, but i
don't see another way that wasn't much uglier.
 1.70.10.3  21-Nov-2010  riz Pull up following revision(s) (requested by mrg in ticket #1468):
sys/dev/raidframe/rf_disks.c: revision 1.74
sys/dev/raidframe/raidframevar.h: revision 1.14
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.275
sys/dev/raidframe/rf_copyback.c: revision 1.43
sys/dev/raidframe/rf_reconstruct.c: revision 1.109
add support for >2TB raid devices.
- - add two new members to the component label:
u_int numBlocksHi
u_int partitionSizeHi
and store the top 32 bits of the real number of blocks and
partition size. modify rf_print_component_label(),
rf_does_it_fit(), rf_AutoConfigureDisks() and
rf_ReconstructFailedDiskBasic().
- - call disk_blocksize() after disk_attach() [ from mlelstv ]
- - shift the block number relative to DEV_BSHIFT in raidstart()
and InitBP() so that accesses work for non 512-byte devices.
[ from mlelstv ]
- - update rf_getdisksize() to use the new getdisksize() [ from
mlelstv. this part needs a separate change for netbsd-5. ]
reviewed by: oster, christos and darrenr
 1.70.10.2  10-Dec-2009  snj Pull up following revision(s) (requested by tron in ticket #1187):
sbin/raidctl/raidctl.8: revisions 1.57-1.59 via patch
sbin/raidctl/raidctl.c: revision 1.42 via patch
sys/dev/raidframe/files.raidframe: revision 1.8 via patch
sys/dev/raidframe/rf_copyback.c: revision 1.42 via patch
sys/dev/raidframe/rf_disks.c: revision 1.72 via patch
sys/dev/raidframe/rf_driver.c: revision 1.122 via patch
sys/dev/raidframe/rf_engine.c: revision 1.40 via patch
sys/dev/raidframe/rf_kintf.h: revision 1.21 via patch
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.269 via patch
sys/dev/raidframe/rf_paritymap.c: revisions 1.1-1.3 via patch
sys/dev/raidframe/rf_paritymap.h: revision 1.1 via patch
sys/dev/raidframe/rf_parityscan.c: revision 1.33 via patch
sys/dev/raidframe/rf_parityscan.h: revision 1.8 via patch
sys/dev/raidframe/rf_raid.h: revision 1.38 via patch
sys/dev/raidframe/rf_reconstruct.c: revision 1.108 via patch
sys/dev/raidframe/rf_states.c: revision 1.44 via patch
sys/dev/raidframe/raidframeio.h: revision 1.6 via patch
sys/dev/raidframe/raidframevar.h: revision 1.13 via patch
Pull up the RAIDframe parity map Summer Of Code project.
Drastically reduces the amount of time spent rewriting parity after an
unclean shutdown by keeping better track of which regions might have had
outstanding writes. Enabled by default; can be disabled on a per-set
basis, or tuned, with the new raidctl(8) commands.
 1.70.10.1  04-Apr-2009  snj branches: 1.70.10.1.4;
Pull up following revision(s) (requested by sborrill in ticket #652):
sys/dev/raidframe/rf_disks.c: revision 1.71
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.260
Switch various printfs from %ld and %d to PRIu64, etc. to be more consistent
about types (for instance uint32_t was being printed with %d).
 1.70.10.1.4.1  21-Apr-2010  matt sync to netbsd-5
 1.70.8.1  28-Apr-2009  skrll Sync with HEAD.
 1.72.2.2  06-Nov-2010  uebayasi Sync with HEAD.
 1.72.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.73.2.2  31-May-2011  rmind sync with head
 1.73.2.1  05-Mar-2011  rmind sync with head
 1.76.4.2  05-Mar-2011  bouyer Sync with HEAD
 1.76.4.1  17-Feb-2011  bouyer Sync with HEAD
 1.76.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.82.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.82.2.1  30-Oct-2012  yamt sync with head
 1.83.4.1  18-May-2014  rmind sync with head
 1.83.2.3  03-Dec-2017  jdolecek update from HEAD
 1.83.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.83.2.1  10-Feb-2013  tls Add an accessor -- ufs_maxphys() -- to check the maximum transfer size
for a given UFS mountpoint, and move the code from mount that finds
the underlying disk and resets the mountpoint max transfer size into a
utility function, ufs_update_maxphys().

Add a global serial number that counts disk property changes to which
filesystems are meant to accomodate themselves. Make ufs_maxphys()
check it. This is a sort of flag-polling interface that avoids callbacks
into the filesystem code, but will require freezing filesystems and
draining in-flight transactions before a decrease in size that is
mandatory (like attaching a disk with a smaller maximum transfer size
as a spare in a RAIDframe set), rather than "advisory", like finding
out set geometry from a RAID controller long after boot and deciding
a smaller transfer size would be optimal, can be signalled. Still, the
"advisory" case is the common one so this is progress.

Make a bit of an example of RAIDframe by making it bump this new
serial number when disks are added to the subsystem. I will attack
one of the hardware RAID drivers (probably arcmsr) next.
 1.85.2.1  10-Aug-2014  tls Rebase.
 1.87.4.1  20-Mar-2017  pgoyette Sync with HEAD
 1.87.2.1  05-Feb-2017  skrll Sync with HEAD
 1.89.16.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.89.16.1  10-Jun-2019  christos Sync with HEAD
 1.89.8.1  08-Feb-2019  martin Pull up following revision(s) (requested by christos in ticket #1183):

sys/dev/raidframe/rf_disks.c: revision 1.90

PR/53956: Havard Eidnes: raidframe fails to create raid set on disks.
The test to check if force was reversed when the code was factored out.
 1.91.4.1  12-Aug-2022  martin Pull up following revision(s) (requested by mrg in ticket #1500):

sys/dev/raidframe/rf_driver.c: revision 1.140 (patch)
sys/dev/raidframe/rf_disks.c: revision 1.93 (patch)
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.408 (patch)

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.


ok oster@ riastradh@
 1.93.4.2  04-May-2024  martin Additionally pull up to fix the llvm build after #674:

sys/dev/raidframe/rf_disks.c 1.95

snprintf() should really include a format.
 1.93.4.1  28-Apr-2024  martin Pull up following revision(s) (requested by oster in ticket #674):

sys/dev/raidframe/rf_raid.h: revision 1.52
sbin/raidctl/raidctl.8: revision 1.80
sys/dev/raidframe/rf_driver.c: revision 1.141
sys/dev/raidframe/rf_disks.c: revision 1.94
sys/dev/raidframe/rf_diskqueue.c: revision 1.64
sys/dev/raidframe/rf_diskqueue.h: revision 1.30
sys/dev/raidframe/rf_disks.h: revision 1.15
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.414
sys/dev/raidframe/rf_reconstruct.c: revision 1.129
sys/dev/raidframe/raidframeio.h: revision 1.12
sbin/raidctl/raidctl.c: revision 1.79

Implement hot removal of spares and components. From manu@.

Implement a long desired feature of automatically incorporating
a used spare into the array after a reconstruct.

Given the configuration:

Components:
/dev/wd0e: failed
/dev/wd1e: optimal
/dev/wd2e: optimal
Spares:
/dev/wd3e: spare

Running 'raidctl -F /dev/wd0e raid0' will now result in the
following configuration after a successful rebuild:

Components:
/dev/wd3e: optimal
/dev/wd1e: optimal
/dev/wd2e: optimal
No spares.

Thanks to manu@ for the development of the initial set of changes
which allowed the changes to automatically incorporate a used spare
to come to fruition. Thanks also to manu@ for useful discussions
about and additional testing of these changes.

RSS XML Feed