summaryrefslogtreecommitdiffstats
path: root/sys/scsi/mpath.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* "non-existant" is one of those words that don't exist, so use "non-existent"phessler2019-02-101-4/+4
| | | | | | | instead From Pamela Mosiejczuk, many thanks! OK phessler@ deraadt@
* add some sizes to free. looked over by deraadttedu2015-08-231-3/+3
|
* More damned eye searing whitespace.krw2015-06-071-2/+2
|
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* prevent umass devices from being considered for paths.dlg2015-03-041-1/+4
| | | | ok deraadt@
* remove uneeded proc.h includesjsg2014-09-141-2/+1
| | | | ok mpi@ kspillner@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-3/+3
| | | | after discussions with beck deraadt kettenis.
* move pointer use to after a NULL pointer checkjsg2014-05-011-2/+3
| | | | ok dlg@
* fix next path selection so if the current path is NULL (which can occur ifdlg2013-09-081-5/+6
| | | | | paths are lost and groups become empty) we dont try and do stuff with it that causes null derefs and awesome panics.
* rename scsi_sem_{enter,leave} to scsi_pending_{start,finish}. these aredlg2013-08-291-3/+3
| | | | | | | the wrappers around handling of pending work, theyre not semaphores. names from tedu@ ok krw@ guenther@
* get rid of the different path scheduler types, which simplifies thedlg2013-08-271-15/+13
| | | | | | code that picks the next path. we assume roundrobin within a group of paths now. the asym sym(4) devices work around this by putting every path in its own group.
* implement handling of group failover.dlg2013-08-261-28/+112
| | | | | | | | | | | | if a controller sends sense data back, the path driver can tell mpath that its indicating failover which kicks off an iteration over all the groups until one says its active. if no groups claim to be active, a timeout fires the process off again after a second. you can start controller handover on rdac (well, an md3200i is all i had to test with, others might need more work) and everything keeps going. ill try to get to emc and hds working when i can poke hardware again.
* when i first imagined how paths on mpath worked, i thought thedlg2013-08-261-1/+7
| | | | | | | | | | | | | | | | | midlayer would be able to call things on paths to explicitely online or offline them. turns out thats not how the Real World(tm) works, instead its better to wait for failure and probe for the status of paths, and pick the active group of paths from that. there's even evidence that the mechanisms for forcing controllers into active/passive roles from the scsi initiator are being deprecated. they expect hosts to be able to cope with arbitrary controller role changes and failover accordingly. this replaces the online and offline function pointers in the path_ops structure with a status check function pointer. instead of returning a state, the checker is expected to call mpath_path_status() when its finished figuring out what the state is.
* free the dev slot on group allocation failure if we're building a new dev.dlg2013-08-261-2/+4
|
* introduce the idea of groups of paths. mpath had stuff to manageddlg2013-08-261-23/+75
| | | | | | | | | | | | | | | | | | | | | devices and paths. devices are what mpath presents as targets on its scsibus, and paths are the things attached to hardware controllers that are available to shove io down to the actual real target. all paths were considered usable for handling io on behalf of a device. this adds groups in between devices and paths. only paths on the first group in the list will now be used to handle io now. sym devices will only have one group. asym devices will treat each path as a different group. rdac, emc, and hds will group paths based on which controller in the array theyre connected to. in the future we will intercept sense data from passive controllers and use that to start running checks to pick a new primary group so we can handle controller failover situations. the group id in hds(4) is currently busted, everything else should be correct.
* now that mpath is attached before any hardware, we can simplify the code.dlg2013-08-261-25/+19
| | | | | | | | firstly, move the array of targets that mpath presents into the softc. secondly, when paths call the mpath api we can simply check if the softc global is not null rather than walk through autoconf data. mpath will either have already attached or will never attach in the future.
* we dont need mpath ccbs if all theyre used for is storing xfers on a list.dlg2013-06-101-54/+12
| | | | | we can just use the SIMPLEQ bits that are in xfers directly. this cuts out a bunch of pools and iopools goo. less is more.
* Backout a bunch of my SCSI commits from c2k11. At least one of thesematthew2011-07-171-3/+3
| | | | | | is causing problems when trying to boot sparc64 from an isp(4). Verified to fix the sparc64/isp(4) regression by krw@; ok deraadt@
* support "failover" style access to volumes, ie, only use one activedlg2011-07-111-10/+16
| | | | | | | | | | | path when talking to an array until it goes away, then you fail over to the next active path. im using this to talk to ses(4) in my dell, and allows us to support arrays that have multiple controllers but have no way of reporting which one is active. using the MRU semantic means we can talk to them without them flipping the active role between its controllers all the time. claudios transtec iscsi box is like this.
* First batch of converting SCSI HBAs from setting saa_targets andmatthew2011-07-081-3/+3
| | | | | | saa_luns instead of adapter_buswidth and luns in the prototype link. ok dlg@, miod@
* M_WAITOK cleanup of two cases:mk2011-06-171-2/+3
| | | | | | | | | | | | | | | | 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.
* if a path returns XS_SELTIMEOUT, retry the io down another path like wedlg2011-04-271-2/+2
| | | | do for XS_RESET. adapters return SELTIMEOUT when the device is gone.
* if mpath is disabled in config or ukc, then prevent path drivers fromdlg2011-04-171-1/+16
| | | | | | | | | | | | | | attaching since theyre useless without mpath. the path drivers ask mpath if its ok to use the device before doing their own matches (this is so mpath can prevent paths attaching to itself), so im just adding this check there. this uses code from miod to walk cfdata for the mpath entry and then checks its state. this is ok because mpath is only attached in one place, so there arent multiple cfdata entries for it. ok krw@ deraadt@ miod@ matthew@
* move forward with scsi multipathing.dlg2011-04-051-82/+266
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the big change is how paths between mpath capable devices and the kernel are managed. originally the midlayer would steal the links to the devices and hide them behind mpath. all the changes an adapter made to a link (eg activate or detach), the midlayer had to test if it was an mpath link and then call special mpath code to handle it. the original code also assumed that all paths behaved the same, but the reality is that different devices have different command sets and behaviours. figuring out which behaviour to pick and prioritising them is basically the same job autoconf does with match and attach. rather than special casing mpath in the midlayer and reimplimenting autoconf, this turns paths into actual device drivers with match and attach routines. after they figure out if the path is active, they then give it to mpath(4) to use as a backend. i have written drivers for symmetric access devices (sym(4)) where all paths to the same logical unit are as good as each other, lsi/engenio arrays (rdac(4), and emc arrays (emc(4)). the rdac and emc drivers only detect active paths at attach time, the do not cope if the controller changes state unless you unplug the path and plug it in again to retest the active state. they also do not have support for directing array failover. operating and hoplugging has been tested with mpii(4), fc and sas mpi(4), and iscsi via vscsi (claudio did this too). ok krw@ deraadt@
* let mpath build again even though it is disabledtodd2010-07-211-2/+1
| | | | ok dlg@
* Restore setting xs->bp; fixes ncr(4) on VAX.matthew2010-07-011-1/+2
| | | | ok miod@, krw@
* Remove all adapter-specific 'struct scsi_device's. They are never used. Firstkrw2010-06-281-6/+1
| | | | | | | | step in elminating 'struct scsi_device' entirely. Spotted and initial diff from matthew@. ok matthew@ dlg@ deraadt@ marco@ miod@
* "Believe it or not," nothing uses scsi_xfer's req_sense_length fieldmatthew2010-06-271-2/+1
| | | | | | in any meaningful way, so just get rid of it. ok krw@, dlg@
* New scsi code seems to be stable. Pluck previously identifiedkrw2010-05-201-7/+1
| | | | | | | low-hanging splbio/splx pairs that are no longer needed and see if this reveals any hidden scsi flaws. ok dlg@
* Change the scsi_cmd function member of scsi_adapter from int tokrw2010-03-231-7/+5
| | | | | | | | | | | | | void. Use XS_NO_CCB error in the scsi command (xs) to report the NO_CCB condition. Eliminates all SUCCESSFULLY_QUEUED and COMPLETE confusion and untangles the midlayer from the adapter a bit more. Eyes and some fixes by miod@ There may be some compile issues on little used (i.e. I don't have any) drivers but the change is mechanical and thus easy to remedy. ok dlg@
* scsi_done sets ITSDONE, we dont have to do it.dlg2010-01-031-2/+1
|
* put the midlayer changes back in.dlg2009-12-011-28/+69
| | | | | | | | | | | the two issues affecting it last time are gone. the first, mishandling of TRY_AGAIN_LATER is not relevant now that krw got rid of TRY_AGAIN_LATER. the second, the misbehaving IBM disk was found to be a problem with siop using ordered tags on most ops combined with the speed of the new code. putting this in so we can move forward. ok krw@ "commit please" marco@
* revert midlayer back to it was before i put my big rewrite in. this isdlg2009-11-121-69/+28
| | | | | | | causing a weird problems on an alpha and also appears responsible for isp(4) weirdness i havent had a chance to examine yet. sigh, this makes me sad.
* backout the backout marco did of my code because of the NO_CCB breakage.dlg2009-11-101-28/+69
| | | | | | | the fix for the NO_CCB breakage will follow shortly. tested by krw@ marco@ johan@ ok krw@ marco@
* The big diff dlg committed to the midlayer breaks NO_CCB andmarco2009-11-051-69/+28
| | | | | | | | | | TRY_AGAIN_LATER. NO_CCB is a timer based mechanism that can trivially be made to fail by running IO to two or more disks simultaneously. The TRY_AGAIN_LATER thing is more subtle because it now is a permanent failure instead of transient however this is much harder to hit because something must have gone wrong before it hits. ok deraadt krw miod
* if you're attempting to detach multiple devices (eg, many targets,dlg2009-10-231-5/+5
| | | | | | | | | | | | | | | | | many luns, or the entire bus), dont report ENXIO as an error to the caller. this broke autoconf when it tried to forcefully remove a bus such as umass and it thought there was a failure. this introduces a way for scsi hbas to call activate/deactivate on a device based on its target/lun address via a call to scsi_activate(). they can then schedule the actual detach/attach in a thread later via scsi_req_probe/detach. the mpi changes tweak the sas event handling code to use these apis to properly handle attaches and detaches of disks. event handling is still disabled till i can make it less chatty. umass breakage reported by form@
* devices below the scsibus should all be detached via scsi_detach_lun.dlg2009-10-221-1/+14
| | | | | | | | | | | | | | scsibusdetach wasnt doign it properly, so we would be leaking on detach in some cases. now, with the introduction of mpath, the scsi_link structures can represent a path to a mpath node as well as normal devices. this intercepts the device activate entrypoints and sends them to mpath if it it in use rather than assuming a device is always there. the scsibusdetach change ensures that detach always ends up handling the mpath node case too. hotplug bus functionality (eg, usb) tested by form@
* rework how devids are handled in the midlayer and mpath.dlg2009-10-141-10/+19
| | | | | | | | | | | | | | | | previously a devid was a structure containing its type, length, and a pointer to the actual devid value. this has been changed so a devid is a header followed immediately by the memory making up the id value. this allows the header and its value to be allocated together. devids are now reference counted, so multiple things (eg, the mpath node handlers and the various scsi_link structures) can share the same allocation safely. this also frees devids when scsi_links go away, which was previously not done. if mpath is enabled, then print the devids out as part of the devices attach line.
* rework the scsi midlayer to start addressing some problems i havedlg2009-09-141-19/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with it which became extremely annoying with what mpath wants to do. the major change is a new interface for submitting scsi commands. previously the only way for drivers like sd, cd, st, etc to push commands onto the hardware was via scsi_scsi_cmd(). the problem with scsi_scsi_cmd is that it doesnt tell the caller if the command failed, was queued, or completed unless you shoved a buf down with it. this is important for mpath which wants to know what the physical path to the device did so it can report it back to the midlayer which called it. this provides a new api which lets drivers like cd/sd/st/mpath etc allocate an xs, fill it in, and provide a completion routine which the midlayer will call with the state of the command when it is finished with it. the caller is then responsible for freeing the xs. from the hba side of thing, the return code from the scsi_cmd entrypoint is largely ignored now, and it is now always the responsibility of the hba driver to call scsi_done when it has completed the io, rather than returning COMPLETE and expecting the midlayer to do it for you. i have emulated scsi_scsi_cmd on top of this new api so existing users of it will continue to work. sd(4) has been reworked to use the new api directly to both demonstrate its use and test that the new api actually does work. this diff was mostly written in a day at f2k9. thanks to miod for poking through hba drivers to help mitigate against fallout from the change to the COMPLETE semantic. this has been reviewed by krw who didnt spot anything wrong. thanks to dave del debbio for testing. ok deraadt@
* shove a minphys request against mpath down all to the minphys on each pathdlg2009-08-091-1/+15
| | | | | | | so we can guarantee that any of the paths we push the io down later will work. with help from a discussion from beck and krw
* if a physical path to a device behind mpath goes away, remove the path. itdlg2009-08-091-2/+29
| | | | | | is worth noting that the device on mpath will persist even if all the paths behind it have gone away. returning the paths will allow operations to work against the device again.
* add mpath(4), a driver that steals paths to scsi devices if itdlg2009-08-091-0/+240
thinks they could be available via multiple paths. those stolen devices are then made available via mpath(4). this is the minimum amount of code to implement the stealing. it is generally broken and very brittle, so it is currently disabled. it is going in so i can work on it in the tree.