summaryrefslogtreecommitdiff
path: root/sys/dev/softraid.c
AgeCommit message (Collapse)Author
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
2011-04-29only handle vanilla scsi inquiry requests, reject VPD requests since theyreDavid Gwynne
not handled. based on atascsi code. ok marco@
2011-04-14Ignore scsi start stop instead of trying to be clever. A softraidMarco Peereboom
discipline should always reflect the correct status. This fixes unexpected state changes jordan saw.
2011-04-06fix installboot.Marco Peereboom
ok jsing
2011-04-06make rebuild also work in bigmemMarco Peereboom
2011-04-06handle bigmem for metadata reads and writes. this should be pre allocatedMarco Peereboom
but for now this allows us to move forward.
2011-04-05Iopoolification. Testing by marco@.Kenneth R Westerback
ok dlg@ marco@
2011-03-15Attach one sensordev per softraid device rather than one sensordev perJoel Sing
discipline. This results in a drive sensor being attached for each volume under the same sensordev, instead of having multiple sensordevs each with a single drive. Fixes PR6576. Tested by Mattieu Baptiste. ok deraadt@
2011-01-29spaces that make my eyes bleed. no binary change.Marco Peereboom
2011-01-23Factor out block level I/O handling code and correctly handle I/Os thatJoel Sing
exceed MAXPHYS in size. Thanks to ckuethe@ and stsp@ for testing. ok marco@
2011-01-22Ensure that boot storage area exists and is large enough, beforeJoel Sing
installing boot code. ok marco@
2011-01-12more explicit_bzero to delete keys.Marco Peereboom
prodded and ok deraadt
2010-12-20READ CAPACITY and READ CAPACITY 16 commands report the last validKenneth R Westerback
logical block address, not the size of the device. Adjust softraid's handling of the commands accordingly. Fixes panics when newfs'ing the 'c' partition of a softraid volume (one shouldn't newfs 'c' partitions of any device). Reported by Andreas Bartlet via tech@. Fix tested by Andreas. ok marco@. functionally identical diff developed by dlg@
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-10-12Force openings to 1 for devices that can't do tagged i/o, i.e. moreKenneth R Westerback
than 1 i/o active at once. This reduces the chances that concurrent i/o's for such devices will confuse the device or the adapter code. It also eliminates a reason for adapter code to maintain its own queues. Tweak all drivers that fake INQUIRY results to set the SID_CmdQue flag, thus continuing to claim to be able to do tagged i/o. Positive feedback from matthew@ and marco@ for an earlier version. ok dlg@
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-09-07having a ca_activate function which just returns 1 is wrong on about 8 ↵Theo de Raadt
different levels; ok oga kettenis
2010-08-30fix tailq use; ok thibTheo de Raadt
2010-08-30During boot probe walk disklist rather than alldevs. This avoids a raceJoel Sing
where disks can be on alldevs, however they are not yet initialised and have not yet called disk_attach() (in particular this means that dk_label is a null pointer). Also, if we sleep restart the scan from the top of the disklist in case things have changed whilst we slept. ok marco@
2010-07-03explicitly specify flags to malloc and pool_get instead of relying on 0.Ted Unangst
This is more clear, and as thib pointed out, the default in softraid was wrong. ok thib.
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-06-28Remove all adapter-specific 'struct scsi_device's. They are never used. FirstKenneth R Westerback
step in elminating 'struct scsi_device' entirely. Spotted and initial diff from matthew@. ok matthew@ dlg@ deraadt@ marco@ miod@
2010-06-15softraid doesnt provide disk cache settings to tweak, mark those ioctls asDavid Gwynne
not supported. this prevents a panic caused by recursively entering the ioctl handler that now happens on boot when sd tries to enable write cache on all disks. found by ckeuthe@ tested by todd@
2010-06-15dont pass the dev_t from the scsi device drivers into the midlayer forDavid Gwynne
ioctl requests, and dont pass the proc pointers around for any ioctl requests in scsi land at all. neither were used, so trim the fat. ok krw@ marco@
2010-05-21Make compile with NBIO = 0Marco Peereboom
2010-05-20New scsi code seems to be stable. Pluck previously identifiedKenneth R Westerback
low-hanging splbio/splx pairs that are no longer needed and see if this reveals any hidden scsi flaws. ok dlg@
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@