summaryrefslogtreecommitdiff
path: root/sys/dev/softraid.c
AgeCommit message (Collapse)Author
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-10-08Change handling for volumes that are marked no-auto assemble. If we bootedJoel Sing
from the given volume ignore the no-auto assemble flag, since the root file system is located on it.
2012-10-08bzero the right variable.Joel Sing
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-28Only pass bio ioctls through to the softraid bio ioctl handler. Rename theJoel Sing
handler to emphasise that it is for bio ioctls only. Discovered the hard way by dhill@
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-22Disable the softraid disk attach hook on detach.Joel Sing
2012-01-22Ensure that the sc_lock is held before the status functions are called.Joel Sing
2012-01-21Split sr_uuid_print() into two functions - one that formats and one thatJoel Sing
prints. Also rename sr_uuid_get() to sr_uuid_generate().
2012-01-20Add bio(4) status interface structs and utility functions to softraid(4).Joel Sing
2012-01-17Check the metadata level against the assembly level before proceeding withJoel Sing
any assembly. This avoids a panic when attempting to assemble a RAID 1 (or other) volume as a RAID 0 volume. Also reorder some of the other checks and diagnostics performed during assembly.
2012-01-17Add missing ioctl DNPRINTFs and nuke some rogue commas.Joel Sing
2012-01-11Move softraid root mapping to later in the boot process - this will allowJoel Sing
us to play some tricks in setroot().
2012-01-11Make sr_boot_chunk and sr_boot_volume accessible from userland. Add aJoel Sing
number of variables that are needed to detect and assemble volumes. A sr_metadata struct can be allocated and used via the sbc_metadata pointer, which we now do in the kernel boot probe/assembly code.
2011-12-31Implement a concatenating discipline for softraid.Joel Sing
Many thanks to Marco Peereboom for his assistance with testing and debugging. Thanks also to Josh Grosse and Chris Jackman for testing.
2011-12-28Cleanup the metadata initialisation process - have sr_meta_init()Joel Sing
initialise both the volume and chunk metadata before the discipline specific sd_create() function is called. The sr_meta_init_complete() function is then called to complete the initialisation based on values provided by sd_create().
2011-12-28Avoid the use of an invalid disklabel by setting a DK_LABELVALID flagJoel Sing
if we correctly read and validated the disklabel. Always check that this flag is set before using the DUID from the disklabel. Discussed with deraadt@ ok krw@
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-11-13When initiating a rebuild update the DUID for the chunk so thatJoel Sing
installboot has the correct details. Also zero the boot DUID list before populating it in installboot, preventing the DUIDs of offline chunks from remaining around.
2011-11-13Cleanup rebuild initialisation code. In particular, reconstruct the chunkJoel Sing
metadata from the volume metadata rather than using the metadata from some random chunk. The coerced size is gained from another online chunk.
2011-11-11Remove a bogus check which dereferences an uninitialised pointer.Joel Sing
From Pedro Martelletto. ok krw@ mikeb@
2011-11-11When rebuilding check the size of the replacement chunk against theJoel Sing
coerced size rather than the physical size of another chunk.
2011-11-11Remove unused sv_sensor_valid variable.Joel Sing
2011-11-11When setting up a bootable softraid volume, do not try to save the bootJoel Sing
blocks or boot loader to chunks that are not online. ok mikeb@
2011-11-08Typo. BIOC_SSOFFLINE is the ioctl command. Pass BIOC_SDOFFLINE toKenneth R Westerback
sd_set_chunk_state() as the new state. ok jsing@
2011-09-19If the rootduid matches a softraid chunk of a bootable softraid volume,Joel Sing
map the rootduid to the DUID of the softraid volume. This means that regardless of where the kernel is loaded from we always get the softraid volume as the root device, providing we booted from one of its chunks. If we boot from any other disk then the rootduid remains unchanged. With this diff it is now possible to have the root filesystem on softraid, however at this stage the kernel still needs to be loaded from a separate FFS partition. ok deraadt@
2011-09-19When installboot is run on a softraid volume, add boot optional metadataJoel Sing
to store the DUID of the softraid volume and each of the chunks that it is assembled from. This allows us to correctly identify the root disk. ok deraadt@
2011-09-19Cleanup sr_ioctl_createraid(). There are three clear cases - (1) corruptJoel Sing
or invalid metadata; (2) a new volume with no existing metadata; and (3) an existing volume with metadata. This removes duplicated code and simplifies the code path. Also ensure that we only process the optional metadata once per volume and not once per chunk. Move the optional metadata handler calls into sr_ioctl_createraid().
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-08-08Fix a formating bug that caused a bad print on big endian arches.Marco Peereboom
ok deraadt
2011-07-17Backout a bunch of my SCSI commits from c2k11. At least one of theseMatthew Dempsky
is causing problems when trying to boot sparc64 from an isp(4). Verified to fix the sparc64/isp(4) regression by krw@; ok deraadt@
2011-07-08First batch of converting SCSI HBAs from setting saa_targets andMatthew Dempsky
saa_luns instead of adapter_buswidth and luns in the prototype link. ok dlg@, miod@
2011-07-07Fix the LBA offset calculation for the last block in a rebuild, if thereJoel Sing
is a partial block. Also correctly handle the case where there is no partial block. Whilst here remove a pointless variable. Issues spotted by and based on diffs from Piotr Durlej - thanks! ok marco@
2011-07-07Make sr_shutdown() a general function and use this from sr_detach() toJoel Sing
avoid duplication. Implement a sr_shutdownhook() function that simply calls sr_shutdown() and use this for the shutdown hook. ok marco@
2011-07-06When checking if a chunk is in use, do not match on NODEV.Joel Sing
2011-07-06Use a single shutdown hook for the softraid controller instead ofJoel Sing
having one per volume. ok marco@
2011-07-06Actually make sr_detach() work. At this stage we never detach softraid(4),Joel Sing
however since this code exists it still should work correctly.
2011-07-06Retain a reference to the registered sensor task so that we can unregisterJoel Sing
it again.
2011-07-06Move all volume shutdown code into sr_shutdown_discipline() and use a flagJoel Sing
to indicate if we should force a metadata write. ok marco@
2011-07-04Fix debugging prints in softraid(4) so that it can compile withMatthew Dempsky
SR_DEBUG enabled. Broken since r1.227.
2011-07-03Call config_detach() on the child scsibus in sr_detach().Matthew Dempsky
ok jsing@
2011-07-02Cleanup the softraid boot probe code. Rename the rather poorly namedJoel Sing
sr_metadata_list struct to sr_boot_chunk and use a sr_metadata struct rather than an array of u_int8_t when storing the metadata. Also rename some variables to keep the boot volume/boot chunk consistency. This diff also fixes a memory leak where the structures were never freed for key disks. Otherwise there should be no functional change. ok marco@
2011-06-24Avoid a possible null dereference.Joel Sing
ok marco@
2011-06-23Simplify softraid(4) to behave like other HBAs by using a singleMatthew Dempsky
scsibus(4) for all attached disks, rather than one scsibus(4) per disk. This takes advantage of recent improvements in the SCSI midlayer to better support hotplug devices, and also decouples softraid(4) from scsibus(4) device unit numbers. ok jsing@, dlg@, krw@, deraadt@; marco@'s still unconvinced
2011-06-20Fix softraid(4) to set xs->cmd = &xs->cmdstore rather than pointing itMatthew Dempsky
to a separately allocated SCSI command structure. ok marco@, jsing@
2011-05-03Move SLIST initializations earlier so that failure handling paths canMatthew Dempsky
safely use them. Found by Clang. "go for it" marco@
2011-04-29tiny whitespace fixesDavid Gwynne