summaryrefslogtreecommitdiff
path: root/sys/scsi
AgeCommit message (Collapse)Author
2016-03-19Do not run into sdgetdisklabel() when scsi disk is dying. AddAlexander Bluhm
special error handling in sdopen() as temporary hack. OK krw@
2016-03-18After sleeping and before accessing sc_link, check that scsi diskAlexander Bluhm
is not dying. OK krw@
2016-03-17Do not access the scsi link structure in sdclose() if the diskAlexander Bluhm
device is already dying. Delete the sc_timeout when setting the SDF_DYING flag as the timeout delete in sdclose() may not be reached. OK krw@
2016-03-16Add SDF_DYING checks to more functions in scsi disk, to prevent anAlexander Bluhm
use after free of the scsi link structure during detach. OK krw@
2016-03-12Standardize on calling local scsi_link variables 'link' instead ofKenneth R Westerback
'sc_link'. 'sc_link' is a field in the various device *_softc structures, where the sc_ prefix was for 'softc'. Reduces potential mental confusion. Newer code from down under was already using 'link'. No functional change. Prompted by bluhm@'s adventures in scsi. ok dlg@ jmatthew@
2016-03-12When unplugging an USB umass stick, the kernel could panic becauseAlexander Bluhm
of a use after free. In sdopen() the scsi link pointer is taken from the scsi disk struct. While the scsi disk memory is refcounted by autoconf, the scsi link may be detached and freed during sleep. The solution is to check wether the disk is dying after every sleep. The SDF_DYING flag is set before scsi bus and scsi disk are detached, so without this flag the link must be valid. input and OK krw@
2016-03-11"if (_3btol(cmd->len) != 0)" is more likely to be a useful test thanKenneth R Westerback
"if (cmd->len) != 0)", as cmd->len is a 3 byte array. Broken since media_blkno accounting was introduced in r1.72 (2007!). Might fix some obscure tape issues around miscounting variable sized blocks. Spotted by mmcc@ and his friend clang.
2016-03-10Enforce some naming sanity. Stop using 'sc_link' to mean two differentKenneth R Westerback
things by renaming the field 'SLIST_HEAD(, scsi_link) sc_link' to 'sc_link_list' in struct scsibus_softc. Use 'sb' as the short name for scsibus_softc variables. Impetus from & ok bluhm@
2016-03-07Sync no-argument function declaration and definition by adding (void).Christian Weisgerber
ok mpi@ millert@
2016-02-03Do not access the scsi link of the disk at the beginning of sdopen()Alexander Bluhm
and sdminphys() if the scsi disk is dying. The memory of the link may have been freed already. OK krw@
2016-02-03When accessing the scsi link of a scsi disk, use a variable "sc_link"Alexander Bluhm
everywhere. This is the first step to fix a use after free of the sc_link when the disk detaches. If a function gets a scsi transfer, the scsi link is always valid. Call this variable "link" consistently. OK krw@
2015-08-23add some sizes to free. looked over by deraadtTed Unangst
2015-06-07More damned eye searing whitespace.Kenneth R Westerback
2015-04-02use correct capitalization of 'BlackBerry'Jasper Lievisse Adriaanse
"sure" deraadt@
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-03-08Fix some format specifiers in debug code.Kenneth R Westerback
Pointed out by Kor son of Rynar (sic) when trying to test some debug code. ok matthew@
2015-03-04prevent umass devices from being considered for paths.David Gwynne
ok deraadt@
2015-02-11we dont need sys/lock.h because we dont use lockmgr, but we do needDavid Gwynne
sys/atomic.h for atomic_setbits_int.
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-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-12-15convert bcopy to memcpy. ok dlg krwTed Unangst
2014-09-20Fix bug in taskq conversion that would lead to a null pointer dereference.Mark Kettenis
ok krw@, jsg@
2014-09-18Some disks, such as the Seagate Cheetah 73LP FC with Sun firmwareMark Kettenis
(ST373405FSUN72G) respond to a START STOP UNIT command that spins down the disk with a "Logical Unit Not Ready, Initialization Command Required". Besides causing some dmesg spam, our sd(4) driver responds to such a response by spinning the disk back up. Prevent this from happening by respecting the SCSI_IGNORE_NOT_READY flag and using that flag when spinning down the disk. ok miod@
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-09-09remove the scsi_task() wrapper around workq_add_task now that nothingDavid Gwynne
uses it. dont need to include workq.h anymore here either now.
2014-09-09rework the hotplug requests to use tasks rather than workqs.David Gwynne
tested on mpi(4) sas.
2014-07-13use mallocarray where arguments are multiplied; ok teduTheo de Raadt
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-07-10Now that sd(4) drives under softraid0 have their cache flushed whenMartin Pieuchot
DVACT_POWERDOWN is propagated in this subtree, there is no need for this shutdown hook anymore. RIP. ok kettenis@
2014-07-01take the biglock before calling the xs completion handler.David Gwynne
should be safe to call the midlayer io path without the biglock now.
2014-07-01take the biglock when calling an adapters scsi_cmd handler.David Gwynne
2014-07-01start on being able to safely run io through the midlayer withoutDavid Gwynne
the kernel biglock. the plan is to have the midlayer assume its running without the biglock, but that it cant call adapters or devices without taking the biglock first. this diff just wraps the calls to the adapter iopool get and put handlers up in the biglock. this is safe now because of kettenis' commit to src/sys/kern/init_main.c r1.120. ive been running this in various places since early 2011.
2014-05-01move pointer use to after a NULL pointer checkJonathan Gray
ok dlg@
2014-04-22factor out the code that figures out whether you're probing or detachingDavid Gwynne
a whole bus, a target, or a specific lun on a target from the bioctl and scsi_req paths. i want to reuse this factored code for something claudio wants.
2014-04-20make the status handler more like rdac and emc. the big functional changeDavid Gwynne
is to check xs->status on completion to make sure it worked.
2014-04-19move scsi_xs_put after checks that use fields in the xsJonathan Matthew
ok dlg@
2014-04-19implement emc_mpath_checksense() according to what my cx500 throws.David Gwynne
tested by jmatthew@
2014-04-17rework this to implement the active path checks when mpath asks forDavid Gwynne
it rather than on attach. just need to implement a sense handler to detect failover and this is done. thanks to jmatthew@ for plugging this together again for me.
2014-04-03massage the preferred path detection to happen when mpath asks forDavid Gwynne
a paths status, rather than on attach. the status it returns depends on the type of device you have. hds provides two types of arrays, symmetric and asymmetric. on a symmetric device you can shove io down any path to any port on any controller and it will work. on symmetric devices we say all paths are part of the same group, and unconditionally return active path status to any check request. on asymmetric devices we group paths by which controller in teh array they connect to. the controllers return whether theyre providing a preferred path via a couple of status bits in a hds specific vpd page, so we query that and return the state of the bits. unfortunately hds arrays dont report change of lun ownership in any way, so we dont currently have any way of failing over at the moment. ill have to think about the least worst way to handle that. tested by deraadt@ on hppa
2014-04-02whitespace fix, no functional changeDavid Gwynne
2014-04-02skey == SKEY_ILLEGAL_REQUEST && ASC_ASCQ(sense) == 0x9401 meansDavid Gwynne
invalid request due to current lu ownership
2014-02-19If a disk returns a size of 0, treat it as an error to let theMartin Pieuchot
driver re-probe for its capacity. Allow to fully recognized Lexar JumpDrive S33 USB 3.0 sticks. ok krw@, dlg@
2014-02-13if an attached sd(4) is readonly, make sure it's noticable in theAlexander Hall
dmesg, or write operations just fail with EACCES for no obvious reason ok krw@ tedu@
2014-01-31SUNW SUNWGS INT FCBPL can be considered an asym device now we can uniquelyDavid Gwynne
identify them over multiple paths using their wwnn.
2014-01-31if a device doesnt have device ids or serial numbers, try using node_wwn toDavid Gwynne
generate a devid. if its an fc device this is good enough.
2014-01-30SGI branded seagate disks work fineDavid Gwynne
2014-01-27poison the io "allocated" by the default pool allocator so any attempt toDavid Gwynne
use it should cause a fault. based on discussion with miod@
2014-01-18rename scsi_ioh_runqueue to scsi_iopool_run, and make it availableDavid Gwynne
outside scsi_base.c. this will allow adapters to restrict access to iopool resources based on some state, and then kick the pending requests on the pool when the state comes good again. ive been avoiding this for a long time, but it is the least worst way to deal with some uses of XS_NO_CCB. discussion with kettenis@ helped me decide this was right.
2013-12-06Add a DVACT_WAKEUP op to the *_activate() API. This is called after theTheo de Raadt
kernel resumes normal (non-cold, able to run processes, etc) operation. Previously we were relying on specific DVACT_RESUME op's in drivers creating callback/threads themselves, but that has become too common, indicating the need for a built-in mechanism. ok dlg kettenis, tested by a sufficient amount of people