summaryrefslogtreecommitdiff
path: root/sys/dev/softraid_crypto.c
AgeCommit message (Collapse)Author
2013-11-19Print daddr_t's with %lld, size_t's with %zu, int's with %d andKenneth R Westerback
u_int32_t's with %u. Translate DL_GETPSIZE() results to 512-byte-block values with DL_SECTOBLK(). ok jsing@
2013-11-04substantial namespace cleanup. Might go a little bit too far, but weTheo de Raadt
can expose some of the kernel structures with split .h files if need be. Discussed with various, including jsing.
2013-06-11final removal of daddr64_t. daddr_t has been 64 bit for a long enoughTheo de Raadt
test period; i think 3 years ago the last bugs fell out. ok otto beck others
2013-05-21Provide a function that handles the scheduling of work units. ThisJoel Sing
simplifies the discipline code, avoids code duplication and moves the scheduling logic into a single location. ok krw@
2013-04-01Rename sr_crypto_rw2() to sr_crypto_dev_rw(), which actually reflects theJoel Sing
fact that it is used to generate I/O to the underlying device. Input from/ok krw@
2013-04-01Validate the I/O request when it is first received, rather than waitingJoel Sing
until disk I/O is performed. This avoids doing encryption for a write that has an invalid I/O request. Additionally sr_crypto_wu_get() can get the block number from the work unit, instead of decoding the SCSI command (and failing to handle the invalid case). ok krw@
2013-03-31Use consistent error handling when validating the number of chunksJoel Sing
provided.
2013-03-31The return value of sd_free_resources() is never checked and all of theJoel Sing
implementations only ever returned zero. Change the return value from int to void instead of pretending it might mean something.
2013-03-30Provide a default discipline interrupt handling function and migrate all ofJoel Sing
the disciplines that now have the same interrupt code. ok krw@
2013-03-29sd_wu_pending is only decremented when scsi_done() or scsi_io_put() areJoel Sing
called. As a result, factor out the the sd_sync check/wakeup code and move it to after the scsi_done() call in sr_scsi_done(). Perform the same sd_sync check/wakeup after scsi_io_put() calls (including the addition of some that were previously missed). ok krw@
2013-03-02sr_alloc_resources() and sr_free_resources() can never be called withoutJoel Sing
a valid struct sr_discipline. Remove redundant NULL pointer checks.
2013-01-18Convert softraid crypto to the new ccb and workunit completion functions.Joel Sing
2013-01-16Set resid to zero if the scsi transfer completed without error.Joel Sing
ok krw@
2013-01-15Always initialise the discipline name, not just when we are doing a create.Joel Sing
2013-01-15Keep a function pointer to the per-discipline I/O interrupt handler in theJoel Sing
discipline data structure. To be used with an upcoming diff.
2012-10-09Provide a mechanism for the kernel to directly pass a mask key through toJoel Sing
a crypto volume when it is assembling it.
2012-10-08Provide a mechanism for the kernel to pass data through to the disciplineJoel Sing
during volume assembly.
2012-01-30Prevent softraid from being used with devices that do not have a sectorJoel Sing
size of 512 bytes - any other size is not currently supported. ok krw@
2012-01-22Convert softraid(4) to new bio(4) status interface. This allows bioctl(8)Joel Sing
to provide useful feedback, rather than reporting an ioctl failure and leaving the user to consult dmesg. For now we continue to print most things to the console, even if the message is a result of an ioctl.
2012-01-22Move list initialisation to the start of the function - this prevents usJoel Sing
from walking an uninitialised list if we fail to read the key disk.
2011-12-26Provide default set chunk state and set volume state functions whichJoel Sing
cover the no redundancy/no rebuild case. Use these for the AOE, crypto and RAID 0 disciplines.
2011-12-25Initialise discipline function pointers with defaults and only overrideJoel Sing
those that are needed by a specific discipline.
2011-09-20Mark softraid crypto volumes as being capable of auto assembly, since theyJoel Sing
are if used with a key disk.
2011-09-20Simplify the crypto descriptor handling by changing the list head, insteadJoel Sing
of splitting and rejoining the list.
2011-09-18Add support for variable length optional metadata in softraid(4). ThisJoel Sing
will allow new optional metadata types to be added without needing to change the softraid metadata version. Note that this commit changes the softraid metadata version, however an upgrade from older metadata is handled automatically. A full backup prior to upgrading is still strongly recommended. With feedback from stsp@ and marco.
2011-09-18Rename the optional metadata handler function and factor out the optionalJoel Sing
metadata handling code. This will simplify upcoming changes.
2011-07-07only allocate and copyin the length of kdfinfo data.Ted Unangst
ok deraadt matthew
2011-07-05ENOMEM causing EIO errors is bad juju. Softraid crypto did this.Owain Ainsworth
Instead of allocating a crypto op and the optional dma buffer on each and every io, preallocate a list of softraid crypto wus that contain a buffer of the max size we will use (MAXPHYS). since we know the number of openings we have in advance this means that on each io we just pick one, shorten the list of crypto descs, init any values then do the io. ok jsing (who provided many useful comments. he also provided a smarter way of handling the cryptop lists which is not in this diff but will be implemented soonish), marco@. dlg@ pointed out that this should probably use iopools but letting disciplines allocate their own iopool involves more softraid rejigging that will have to be done first. For now this is sufficient.
2011-06-18Change sizeof(&kdfinfo2) to sizeof(kdfinfo2).Matthew Dempsky
ok deraadt@
2011-06-17M_WAITOK cleanup of two cases:Michael Knudsen
1) Allocating with M_WAITOK, checking for NULL, and calling panic() is pointless (malloc() will panic if it can't allocate) so remove the check and the call. 2) Allocating with M_WAITOK, checking for NULL, and then gracefully handling failure to allocate is pointless. Instead also pass M_CANFAIL so malloc() doesn't panic so we can actually handle it gracefully. 1) was done using Coccinelle. Input from oga. ok miod.
2011-06-05Fix function names in debug printfs and use a more user-friendly errorStefan Sperling
message if the key disk cannot be opened. ok marco (some time ago)
2011-05-20sr_scsi_cmd copes with failed i/o just fine so there's no needMike Belopuhov
to panic if we couldn't allocate memory for crypto descriptors; tested by dcoppa, ok marco
2011-04-06make crypto work with bigmemMarco Peereboom
2011-04-05Iopoolification. Testing by marco@.Kenneth R Westerback
ok dlg@ marco@
2011-03-06fix function name in error/debug messages; ok marcoStefan Sperling
2011-01-12stray tabMarco Peereboom
2011-01-12explicit zeroing of key information in the softraid ioctl codeTheo de Raadt
ok marco
2011-01-12more explicit_bzero to delete keys.Marco Peereboom
prodded and ok deraadt
2011-01-12lots of explicit_bzero for things which contain parts of keysTheo de Raadt
ok marco
2010-11-06Move raid1 and crypto io to a workq. This is to avoid a potential VOP_Marco Peereboom
call while in interrupt context. Contains an additional spl dance as found by thib. Tested by many opn various arches. Note that raid 0/4/5/6 have not been moved over yet.
2010-09-27A few M_ZEROs without any M_WAITOK/M_NOWAITs.Thordur I. Bjornsson
2010-09-27tedu's shiny new pool_get kassert found an instance of PR_NOWAIT orMarco Peereboom
PR_WAITOK not being set. While here add a diagnostic check for malloc.
2010-09-23The only sensible argument for VOP_* calls that take a struct proc pointer isOwain Ainsworth
curproc. A bunch of callers were passing in 0 (not even NULL, 0) as this pointer, which was fine until the called vnode function tried to do something with it. Typically, this code was then copy/pasted to various parts of the tree. Accept the facts of life and switch all of these over to passing curproc for now until the argument can be removed. Discovered by stsp trying to create a softraid on top of a vnd, which crashed with a NULL deref in vndioctl. softraid bits tested by mikeb and jsing. raidframe bits tested by pea, matthieu and naddy. The rest tested by at least thib, jsing and myself. ok thib@, jsing@.
2010-07-02Rename the volume specific flags variable.Joel Sing
ok marco@
2010-07-02Determine the data offset using a variable specified within the softraidJoel Sing
metadata. This allows us to implement seamless transitions from the previous metadata version to the current version, avoiding the need to recreate the softraid volume. Joint work with marco@ during c2k10. ok marco@
2010-05-18dont let sys/ioctl.h imply that you get the ioctls in dkio.h. thisDavid Gwynne
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include <sys/dkio.h> to the places that actually want and use the disk ioctls. this became an issue when krw@'s X build failed when he was testing a change to dkio.h. tested by krw@ help from and ok miod@
2010-04-18Make key disks use their own optional metadata type, rather than reusingJoel Sing
crypto optional metadata. ok marco@
2010-03-28Completely overhaul optional metadata handling, allowing for multipleJoel Sing
optional metadata per volume and discipline specific optional metadata processing. ok marco@
2010-03-28Correctly initialise variables to prevent possible free without malloc inJoel Sing
error path. Found by jsg@ using the clang static analyser.
2010-03-26Add storage for the boot block and boot loader to the softraid metadata.Joel Sing
Also add a new optional metadata type for boot data. This is the first step (of many) towards being able to boot from softraid volumes. WARNING: This version of the softraid metadata is not compatible with previous versions. As a result, any softraid volumes created with older kernels will not assemble. Data on existing softraid volumes should be backed up before upgrading. The volume should then be recreated and the data restored. ok marco@