summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe/rf_reconstruct.c
AgeCommit message (Collapse)Author
2014-11-14Fix a long-standing bug related to rebooting while aoster
reconstruct-to-spare is underway but not yet complete. The issue was that a component was being marked as a used_spare when the rebuild started, not when the rebuild was actually finished. Marking it as a used_spare meant that the component label on the spare was being updated such that after a reboot the component would be considered up-to-date, regardless of whether the rebuild actually completed! This fix includes: 1) Add an additional state "rf_ds_rebuilding_spare" which is used to denote that a spare is currently being rebuilt from the live components. 2) Update the comments on the disk states, which were out-of-sync with reality. 3) When rebuilding to a spare component, that spare now enters the state rf_ds_rebuilding_spare instead of the state rf_ds_used_spare. 4) When the rebuild is actually complete then the spare component enters the rf_ds_used_spare state. rf_ds_used_spare is now used exclusively for the case where the rebuilding to the spare has completed successfully. XXX: Someday we need to teach raidctl(8) about this new state, and take out the backwards compatibility code in rf_netbsdkintf.c (see RAIDFRAME_GET_INFO in raidioctl()). For today, this fix needs to be generic enough that it can get backported without major grief. XXX: Needs pullup to netbsd-5*, netbsd-6*, and netbsd-7 Fixes PR#49244.
2014-06-14Change dk_lookup() to return an anonymous vnode not associated withhannken
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
2013-03-06fix parens in a messageyamt
2012-02-20Add logic to the main reconstruction loop to handle RAID5 with rotatedoster
spares. While here, observe that we were actually doing one more stripe than we thought we were, and correct that too (it didn't matter for non-RAID5_RS, but it definitely does for RAID5_RS). Add some bounds-checking at the beginning to handle the case where the number of stripes in the set is smaller than the sliding reconstruction window. XXX: this problem likely needs to be fixed for PARITY_DECLUSTERING too.
2011-10-14Change the vnode locking protocol of VOP_GETATTR() to request at leasthannken
a shared lock. Make all calls outside of file systems respect it. The calls from file systems need review. No objections from tech-kern.
2011-08-03Address part of PR kern/44972. From YAMAMOTO Takashi. Thanks!oster
2011-05-28rf_ReconstructInPlace: don't leave a vnode open on errors.yamt
fixes a part of PR/44972.
2011-05-24Suggested to oster@ and approved via private e-mail as a help tobuhrow
people who are getting reconstruction failures.
2011-05-11convert the main raidPtr mutex to a kmutex, and add a couple of cv's tomrg
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.
2011-05-02convert rb_mutex to a kmutex/cv.mrg
2011-02-19Define accessors for number of blocks and partition size in theenami
component label and use them where appropriate. Disscussed on tech-kern.
2010-11-19Introduce struct pathbuf. This is an abstraction to hold a pathnamedholland
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.
2010-11-01add support for >2TB raid devices.mrg
- 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
2009-11-17Finally commit the RAIDframe parity map Summer Of Code project.jld
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.
2009-02-11If we see a RF_RECON_WRITE_ERROR event we know a write has finished andoster
we need to account for that. Failure to do so means we can end up waiting forever for writes we think are outstanding, but which have already completed. Addresses the RAIDframe part of PR#40569. Thanks to Matthias Scheler for reporting the issue and verifying the fix.
2008-12-20When unconfiguring an array where a reconstruct is in progress, abortoster
the reconstruct and wait for IOs to drain before pulling the plug. Should fix the panic reported by der Mouse on tech-kern.
2008-09-23Nuke unneeded printf(). Spotted by pooka@.oster
2008-05-19Re-work some of the guts of the reconstruction code.oster
Reconmap used to have one pointer for every reconstruction unit. This does not scale well in the land of 1TB disks, where some 100MB+ of "status pointers" are required for typical configurations. Convert the reconstruction code to use a "sliding status window" which will scale nicely regardless of the number of stripes/reconstruction units in the RAID set. Convert the main reconstruction loop to rebuild the array in chunks rather than in one big lump. As part of these changes, introduce a function to kick any waiters on the head separation callback list, and use that in the main reconstruction event queue to wake up the waiters if things have stalled. (I believe this may fix a race condition that could occur at at least at the very end of a disk during reconstruction under heavy IO load.) Thanks to Brian Buhrow for all his help, support, and patience in testing these changes.
2008-04-15A forced recon read should not default to indicating that the readsoster
for that disk have stopped, since this will bump us out of the normal reconstruction loop prematurely. Fixes the (mostly cosmetic) bug where the reconstruction status values stop updating, and from raidctl it appears that reconstruction has totally stalled (which it actually hasn't -- the reconstruction does complete properly, but not in the normal way).
2008-04-14Print out the status value if a reconstruction read fails.oster
Don't print out write promotions during reconstruct unless we are debugging reconstructs.
2008-01-26In a land before time, when kernel processes roamed the system, weoster
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.
2007-11-26Remove the "struct lwp *" argument from all VFS and VOP interfaces.pooka
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
2007-09-21Fix wording in a comment and correct a debug line. From Olivier Cherrieroster
(via private mail). Thanks!
2007-07-18Fix fallout from recent kthread changes.ad
2007-07-09Merge some of the less invasive changes from the vmlocking branch:ad
- kthread, callout, devsw API changes - select()/poll() improvements - miscellaneous MT safety improvements
2007-06-26Change dk_lookup() to accept an additional argument of the type enum uio_segcube
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.
2006-11-16__unused removal on arguments; approved by core.christos
2006-10-12- sprinkle __unused on function decls.christos
- fix a couple of unused bugs - no more -Wno-unused for i386
2006-08-27- use dk_lookup instead of our home-spun version.christos
- allow raid to be configured in a wedge - allow wedges to be configured in a raid - add autoconfiguration of wedges in a raid
2006-07-21- Use the LWP cached credentials where sane.ad
- Minor cosmetic changes.
2006-05-14integrate kauth.elad
2005-12-11merge ktrace-lwp.christos
2005-07-18If rf_SubmitReconBuffer indicates the submission was blocked (foroster
whatever reason), return 0 instead of the default RF_RECON_READ_STOPPED. Returning RF_RECON_READ_STOPPED would result in rf_ContinueReconstructFailedDisk() thinking that the given component was "done" and breaking out of the main reconstruction loop far too early. Reconstruction still worked correctly as long as there were no errors, but RAIDframe wouldn't be in a position to properly handle read/write errors during reconstruction. This fixes the "raidctl's progress bar spins at 0% until reconstruction finishes" problem.
2005-06-08- initialize numRUsTotal before we indicate that we are doing a reconstruct.oster
- make numRUsComplete and numRUsTotal 64-bit quantities like everything else that records this information.
2005-02-27nuke trailing whitespaceperry
2005-02-12The 'next' argument to rf_CreateDiskQueueData is always NULL. Sinceoster
there is no particular reason to pass an extra NULL argument, turf it, and initialize p->next to NULL within the function.
2005-02-12Add a 'waitflag' argument to rf_CreateDiskQueueData() and use it tooster
determine if we are willing to wait for memory to come from the diskqueuedata (dqd) and bufpool pools. Cleanup the mess related to code calling rf_CreateDiskQueueData() with different expectations (and/or blatent disregard) of what might happen if there were insufficient pool resources.
2005-02-06It's not a bad idea to update the component labels whether or not theoster
reconstruction was successful.
2005-02-05rf_GetNextReconEvent() *will* return a valid event, so no need foroster
the assert. (we'd have panic'ed in there long before this assert if that wasn't the case). Minor whitespace changes.
2005-02-05Vastly improve the error handling in the case of a read/write erroroster
that occurs during a reconstruction. We go from zero error handling and likely panicing if something goes amiss, to gracefully bailing and leaving the system in the best, usable state possible. - introduce rf_DrainReconEventQueue() to allow easy cleaning of the reconstruction event queue - change how we cleanup the floating recon buffers in rf_FreeReconControl(). Detect the end of the list rather than traversing according to a count. - keep track of the number of pending reconstruction writes. In the event of a read error, use this to wait long enough for the pending writes to (hopefully) drain. - more cleanup is still needed on this code, but I didn't want to start mixing major functional changes with minor cleanups. XXX: There is a known issue with pool items left outstanding due to the IO failure, and this can show up in the form of a panic at the tail end of a shutdown. This problem is much less severe than before these changes, and the hope/plan is that this problem will go away once this code gets overhauled again.
2005-01-22Torch some #define's missed in last commit.oster
2005-01-22Reconstruction Descriptors are only allocated once per reconstruction,oster
and don't need their own pool or freelist or anything fancier than a malloc/free.
2005-01-18ForceReconReadDoneProc() needs a return after doing the firstoster
rf_CauseReconEvent().
2004-12-12The switch() in rf_ContinueReconstructFailedDisk() is never actuallyoster
used in non-simulation code, and thus is just wasting space (and making the code more confusing to read!). Turf the switch, left-shift the indentation of code, and nuke 'state' field of struct RF_RaidReconDesc_s. No real functional changes.
2004-11-15continueFunc and continueArg arn't used. Turf. Simplify calls tooster
rf_GetNextReconEvent().
2004-03-18Re-work the locking mechanisms for reconstruct and PSS structuresoster
such that we don't actually hold a simplelock while we are doing a pool_get(), but that we still effectively protecting critical code. This should fix all of the outstanding LOCKDEBUG warnings related to rebuilding RAID sets.
2004-03-13 - don't use rf_PrintUserStats() for recon statistics.oster
rf_PrintUserStats() was mean for the simulator, and doesn't provide any real info in kernel-space, especially for reconstructs. Reconstructing actually renders the stats even more useless, since it resets them all to zero before the reconstruct starts! - since rf_PrintUserStats() is no longer used, nuke it along with the routines that feed it. Nothing was using this code, and if we ever need it again, we know where to find it.
2004-03-07- Introduce rf_pools which contains all of the various global pools usedoster
by RAIDframe. Convert all other RAIDframe global pools to use pools defined within this new structure. - Introduce rf_pool_init(), used for initializing a single pool in RAIDframe. Teach each of the configuration routines to use rf_pool_init(). - Cleanup a few pool-related comments. - Cleanup revent initialization and #defines. - Add a missing pool_destroy() for the reconbuffer pool. (Saves another 1K off of an i386 GENERIC kernel, and makes stuff a lot more readable)
2004-03-07- fix up initialization of rf_recond_pooloster
- introduce rf_reconbuffer_pool and teach rf_MakeReconBuffer() to use it
2004-03-05Use RF_INCLUDE_PARITY_DECLUSTERING_DS to #if-out more unneeded bits.oster
(We can't do RF_DISTRIBUTE_SPARE bits without the parity declustering stuff.)