summaryrefslogtreecommitdiff
path: root/sys/dev/softraid.c
AgeCommit message (Collapse)Author
2017-09-06In the case that we want to force a new RAID assembly and the metadataPatrick Wildt
type on the chunks is not the same, we don't actually care because we are going to clear their metadata anyway, so don't error out. This allows assembling a new RAID based on a drive that is zeroed and one that used to be part of a softraid in its previous life. ok jsing@
2017-08-30Report the rebuild state properly, so that in the case of a rebuildPatrick Wildt
the sensor does not show the drive state as "unknown". ok phessler@
2017-07-24tweak malloc(9) flags: since that M_NOWAIT might return NULL hence itGleydson Soares
doesnt make sense to use M_CANFAIL flag. ok dlg jsing
2017-06-12Upon failure, only return zero from the softraid ioctl handler when thereJoel Sing
is at least one bio status message. It is a much nicer user experience when we properly report failures, however in the case that we fail to do this, getting an errno back from the ioctl is somewhat better than simply printing "unknown error" from bioctl(8).
2017-06-06Provide sufficient info in error messages to identifyKenneth R Westerback
softraid volume and backing disk when i/o errors occur. Original issue reported by Paul de Weerd. Suggestions from jsing@. ok deraadt@ mikeb@
2017-04-14Avoid some false positives with cppcheck. No binary change.Alexander Bluhm
OK jsg@
2017-03-27If the sub-device of a softraid lacks a side-effect io function, returnTheo de Raadt
failure as early as possible. ok mlarkin claudio
2017-03-19Restore behavior from before r1.376: only set bv_percent if a rebuild isTheo Buehler
in progress. This eliminates the spurious and harmless "0% done" message in the output of 'bioctl softraid0' reported by various on misc. ok jsing
2016-07-20Plug potential leak of device list.Kenneth R Westerback
Problem found by Michael McConville. Tested & ok stsp@
2016-05-31Provide a function for calculting the rebuild percentage, rather thanJoel Sing
having five copies of the same code. ok krw@
2016-04-29Panic when attempting to execute a scsi command with no disciplineKenneth R Westerback
defined. Carrying on is pointless. And will currently cause a NULL pointer deref anyway. NULL deref found by mmcc@ and his friend clang. ok deraadt@
2016-04-26Display correct value in error message.Kenneth R Westerback
2016-04-26Do NOT attempt a rebuild using a hot spare with a sector sizeKenneth R Westerback
greater than the sector size of the softraid volume. i.e. 512-byte hot spares should work on 4096-byte volumes but 4096-byte hotspares will not work on 512-byte volumes. Pointed out, errors corrected and ok jsing@
2016-04-26Restore intro comment to sr_hotspare_rebuild(), which was erroneouslyKenneth R Westerback
replaced by comment for first chunk of code. Pointed out by jsing@.
2016-04-19Use consistent intro comment when searching for the first offlineKenneth R Westerback
chunk and perhaps save the next person reading the code some confusion.
2016-04-19Use variable 'cid' in for(;;) rather than 'i' with an assignmentKenneth R Westerback
'cid = i;' when break'ing. Makes code consistent with same search later. No functional change and shrinks later functional diff.
2016-04-19Change a variable name (chunk_no -> cid) to make a couple of codeKenneth R Westerback
chunks more obviously the same. Reduces size of upcoming diff. No functional change.
2016-04-12No need to rescan chunks in each discipline to find appropriateKenneth R Westerback
volume sector size. Determine volume sector size in sr_meta_init(). Pointed out, tweaked and ok jsing@
2016-04-04Enable creation of softraid volumes using disks with non-512 byteKenneth R Westerback
sectors. Volumes created will present a sector size equal to the largest sector size of the constituent disks. Softraid Metadata version cranks to 6 due to new field. ok jsing@ with tweaks that will follow soon.
2016-02-14Avoid using uninitialized variables in two corner cases. In oneKenneth R Westerback
case check if it was set and bail out with a useful message if not. In the other the variable was the wrong one anyway, and we can just use the correct variable. Found by & ok jsg@
2015-12-29Remove NULL-checks before free().mmcc
ok tb@
2015-08-19Stop passing around constants for metadata size and location. JustKenneth R Westerback
use the constants where needed. ok jsing@
2015-07-29Zap a SLIST in a more obviously correct/safe way.Kenneth R Westerback
Originally from pelikan@, recent prodding from bluhm@ and jsg@. ok pelikan@ millert@ bluhm@
2015-07-28Tweak a couple of [SLIST|TAILQ]_REMOVE() usages in loops to a moreKenneth R Westerback
obvious idiom. ok bluhm@ jsing@
2015-07-27zap trailing linefeeds from sr_error() and panic() callsAlexander Hall
ok jsing@
2015-07-21A few more daddr_t fixes. Rename 'phys_off' variables to 'offset'Kenneth R Westerback
since they are now relative to chunks. Use 'blkno' as normal variable name for daddr_t items rather than mix of 'blkno, blk, offset. Change field name ssd_data_offset to ssd_data_blkno since it is a block and not byte quantity. No intentional functional change.
2015-07-20fix spacingMike Larkin
2015-07-19Stop passing daddr_t parameters for lengths. Use long since that's the typeKenneth R Westerback
of the destination fields. ok jsing@
2015-07-19Change some obviously incorrect usages of daddr_t (a DEV_BSIZEKenneth R Westerback
address) to 64 signed or unsigned ints. Add some paranoia checks during partition size calculations to account for the fact that partition sizes (DL_GETPSIZE()) are unsigned values. More daddr_t rectification to do. ok jsing@
2015-07-19Stop adding and subtracting data offset. Just keep to chunk relativeKenneth R Westerback
block offsets until actual i/o is constructed and needs the physical offset. Eliminate a number of <<DEV_BSIZE shifts as a bonus. No intentional functional change. Fixed and ok jsing@
2015-07-19Use DEV_BSIZE instead of 512 where appropriate. Use DL_SECTOBLK()Kenneth R Westerback
where appropriate. Noop for disks with 512-byte sectors. i.e. the only kind currently allowed in softraid volumes. But starts laying the groundwork to allow disks with other sector sizes. ok jsing@
2015-05-29Nuke annoying whitespace nits to shrink some future diffs.Kenneth R Westerback
2015-05-20Signed types are bad array indicies - let it panic instead.Martin Pelikan
ok deraadt krw millert
2015-05-11Make softraid(4) compile with SR_DEBUG by fixing __kprintf__ specifiers.Martin Pelikan
ok jsing krw
2015-04-11Directly handle ioctls issued to a SCSI device associated with a softraidJoel Sing
volume, ignoring any device name specified in the bio(4) ioctl struct. One of bio(4)'s design flaws is that the device name is hardcoded in many of the ioctl structs, making it basically unusable with DUIDs. In the case of `bioctl -d' the bioctl(8) code actually uses opendev(3) on the given name, then issues the ioctl directly to the resulting device. As such, we already know which device (or in this case, softraid volume) the ioctl was intended for, however the current softraid(4) code ignores this and instead attempts to perform a lookup using the name in the bio(4) ioctl struct. This diff splits the sr_bio_ioctl() code into two parts - one that implements the API required by bio(4) and the other that contains the ioctl handling code, which now takes an optional pointer to the softraid discipline. If an ioctl is issued to a SCSI device associated with a softraid volume, pass the corresponding softraid discipline struct through and to the bio ioctl handler and use it in preference to performing a device name lookup. Amongst other things, this makes bioctl -d now work with DUIDs. ok krw@
2015-03-14Remove some includes include-what-you-use claims don'tJonathan Gray
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2015-02-09we want to defer work traditionally (in openbsd) handled in anDavid Gwynne
interrupt context to a taskq running in a thread. however, there is a concern that if we do that then we allow accidental use of sleeping APIs in this work, which will make it harder to move the work back to interrupts in the future. guenther and kettenis came up with the idea of marking a proc with CANTSLEEP which the sleep paths can check and panic on. this builds on that so you create taskqs that run with CANTSLEEP set except when they need to sleep for more tasks to run. the taskq_create api is changed to take a flags argument so users can specify CANTSLEEP. MPSAFE is also passed via this flags field now. this means archs that defined IPL_MPSAFE to 0 can now create mpsafe taskqs too. lots of discussion at s2k15 ok guenther@ miod@ mpi@ tedu@ pelikan@
2015-01-27remove the second void * argument on tasks.David Gwynne
when workqs were introduced, we provided a second argument so you could pass a thing and some context to work on it in. there were very few things that took advantage of the second argument, so when i introduced pools i suggested removing it. since tasks were meant to replace workqs, it was requested that we keep the second argument to make porting from workqs to tasks easier. now that workqs are gone, i had a look at the use of the second argument again and found only one good use of it (vdsp(4) on sparc64 if you're interested) and a tiny handful of questionable uses. the vast majority of tasks only used a single argument. i have since modified all tasks that used two args to only use one, so now we can remove the second argument. so this is a mechanical change. all tasks only passed NULL as their second argument, so we can just remove it. ok krw@
2014-12-19bcopy to memcpy. ok deraadt millertTed Unangst
2014-12-16only need lock.h here, not all of uvm_extern.hTed Unangst
2014-12-16primary change: move uvm_vnode out of vnode, keeping only a pointer.Ted Unangst
objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
2014-11-18move arc4random prototype to systm.h. more appropriate for most codeTed Unangst
to include that than rdnvar.h. ok deraadt dlg
2014-10-30muliply to get correct size for free. reported by kspillnerTed Unangst
2014-10-30add some sizes to free()Ted Unangst
2014-10-07remove preliminary AOE (ata over ethernet) support. not finished afterTed Unangst
many years and wide spread demand for support never materialized. time to pack it in.
2014-09-14remove uneeded proc.h includesJonathan Gray
ok mpi@ kspillner@
2014-09-13Replace all queue *_END macro calls except CIRCLEQ_END with NULL.Doug Hogan
CIRCLEQ_* is deprecated and not called in the tree. The other queue types have *_END macros which were added for symmetry with CIRCLEQ_END. They are defined as NULL. There's no reason to keep the other *_END macro calls. ok millert@
2014-08-01When attempting to rebuild a softraid volume, use the actual data offsetJoel Sing
from the volume metadata rather than the currently defined data offset. This allows rebuilds to work correctly when the volume metadata has a different data offset to that currently in use (for example, volumes created prior to softraid gaining boot support). Found the hard way by henning@ ok deraadt@
2014-07-20spacing glitchesTheo de Raadt
2014-07-20Support hibernating to softraid crypto volumes.Mike Larkin
much help and ok from deraadt@