#
272461 |
|
02-Oct-2014 |
gjb |
Copy stable/10@r272459 to releng/10.1 as part of the 10.1-RELEASE process.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
260387 |
|
06-Jan-2014 |
scottl |
MFC Alexander Motin's direct dispatch, multi-queue, and finer-grained locking support for CAM
r256826: Fix several target mode SIMs to not blindly clear ccb_h.flags field of ATIO CCBs. Not all CCB flags there belong to them.
r256836: Remove hard limit on number of BIOs handled with one ATA TRIM request.
r256843: Merge CAM locking changes from the projects/camlock branch to radically reduce lock congestion and improve SMP scalability of the SCSI/ATA stack, preparing the ground for the coming next GEOM direct dispatch support.
r256888: Unconditionally acquire periph reference on CCB allocation failure.
r256895: Fix memory and references leak due to unfreed path.
r256960: Move CAM_UNQUEUED_INDEX setting to the last moment and under the periph lock. This fixes race condition with cam_periph_ccbwait(), causing use-after-free.
r256975: Minor (mostly cosmetical) addition to r256960.
r257054: Some microoptimizations for da and ada drivers: - Replace ordered_tag_count counter with single flag; - From da remove outstanding_cmds counter, duplicating pending_ccbs list; - From da_softc remove unused links field.
r257482: Fix lock recursion, triggered by `smartctl -a /dev/adaX`.
r257501: Make getenv_*() functions and respectively TUNABLE_*_FETCH() macros not allocate memory and so not require sleepable environment. getenv() has already used on-stack temporary storage, so just use it more rationally. getenv_string() receives buffer as argument, so don't need another one.
r257914: Some CAM locks polishing: - Fix LOR and possible lock recursion when handling high-power commands. Introduce new lock to protect left power quota and list of frozen devices. - Correct locking around xpt periph creation. - Remove seems never used XPT_FLAG_OPEN xpt periph flag.
Again, Netflix assisted with testing the merge, but all of the credit goes to Alexander and iX Systems.
Submitted by: mav Sponsored by: iX Systems
|
#
257049 |
|
24-Oct-2013 |
mav |
MFC r256552: Unify periph invalidation and destruction reporting. Print message containing device model and serial number on invalidation.
Approved by: re (hrs)
|
#
256281 |
|
10-Oct-2013 |
gjb |
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation
|
#
255119 |
|
01-Sep-2013 |
mav |
Fix SES_ENABLE_PASSTHROUGH kernel option, unexpectedly broken during driver overhaul.
MFC after: 3 days
|
#
244014 |
|
08-Dec-2012 |
ken |
Fix a device departure bug for the the pass(4), enc(4), sg(4) and ch(4) drivers.
The bug occurrs when a userland process has the driver instance open and the underlying device goes away. We get the devfs callback that the device node has been destroyed, but not all of the closes necessary to fully decrement the reference count on the CAM peripheral.
The reason is that once devfs calls back and says the device has been destroyed, it is moved off to deadfs, and devfs guarantees that there will be no more open or close calls. So the solution is to keep track of how many outstanding open calls there are on the device, and just release that many references when we get the callback from devfs.
scsi_pass.c, scsi_enc.c, scsi_enc_internal.h: Add an open count to the softc in these drivers. Increment it on open and decrement it on close.
When we get a devfs callback to say that the device node has gone away, decrement the peripheral reference count by the number of still outstanding opens.
Make sure we don't access the peripheral with cam_periph_unlock() after what might be the final call to cam_periph_release_locked(). The peripheral might have been freed, and we will be dereferencing freed memory.
scsi_ch.c, scsi_sg.c: For the ch(4) and sg(4) drivers, add the same changes described above, and in addition, fix another bug that was previously fixed in the pass(4) and enc(4) drivers.
These drivers were calling destroy_dev() from their cleanup routine, but that could cause a deadlock because the cleanup routine could be indirectly called from the driver's close routine. This would cause a deadlock, because the device node is being held open by the active close call, and can't be destroyed.
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
#
242173 |
|
27-Oct-2012 |
mav |
Remove one more numeric priority constant.
|
#
241952 |
|
23-Oct-2012 |
mav |
Remove two more 'periph == NULL' checks missed in r241404. This condition can never be true as functions are called from single place and the checks just pollute the code and confuse Clang Static Analyzer.
|
#
240521 |
|
14-Sep-2012 |
eadler |
s/ is is / is /g s/ a a / a /g
Approved by: cperciva MFC after: 3 days
|
#
239213 |
|
12-Aug-2012 |
mjacob |
1. Remove SEN support. I doubt there are any working examples of this hardware still running (close to twenty years now).
2. Quiesece and use ENC_VLOG instead of ENC_LOG for most complaints. That is, they're visible with bootverbose, but otherwise quiesced and not repeatedly spamming messages with constant reminders that hardware in this space is rarely fully compliant.
MFC after: 1 month
|
#
238894 |
|
30-Jul-2012 |
bz |
Remove opt_enc.h from files committed with r235911. enc(4) is the 'encapsulating interface' used with IPsec and has nothing to do with storage 'enclosure' services.
MFC after: 3 days Noticed while: debugging why enc(4) is no longer automatically created
|
#
237328 |
|
20-Jun-2012 |
ken |
Fix several reference counting and object lifetime issues between the pass(4) and enc(4) drivers and devfs.
The pass(4) driver uses the destroy_dev_sched() routine to schedule its device node for destruction in a separate thread context. It does this because the passcleanup() routine can get called indirectly from the passclose() routine, and that would cause a deadlock if the close routine tried to destroy its own device node.
In any case, once a particular passthrough driver number, e.g. pass3, is destroyed, CAM considers that unit number (3 in this case) available for reuse.
The problem is that devfs may not be done cleaning up the previous instance of pass3, and will panic if isn't done cleaning up the previous instance.
The solution is to get a callback from devfs when the device node is removed, and make sure we hold a reference to the peripheral until that happens.
Testing exposed some other cases where we have reference counting issues, and those were also fixed in the pass(4) driver.
cam_periph.c: In camperiphfree(), reorder some of the operations.
The peripheral destructor needs to be called before the peripheral is removed from the peripheral is removed from the list. This is because once we remove the peripheral from the list, and drop the topology lock, the peripheral number may be reused. But if the destructor hasn't been called yet, there may still be resources hanging around (like devfs nodes) that haven't been fully cleaned up.
cam_xpt.c: Add an argument to xpt_remove_periph() to indicate whether the topology lock is already held.
scsi_enc.c: Acquire an extra reference to the peripheral during registration, and release it once we get a callback from devfs indicating that the device node is gone.
Call destroy_dev_sched_cb() in enc_oninvalidate() instead of calling destroy_dev() in the cleanup routine.
scsi_pass.c: Add reference counting to handle peripheral and devfs object lifetime issues.
Add a reference to the peripheral and the devfs node in the peripheral registration.
Don't attempt to add a physical path alias if the peripheral has been marked invalid.
Release the devfs reference once the initial physical path alias taskqueue run has completed.
Schedule devfs node destruction in the passoninvalidate(), and release our peripheral reference in a new routine, passdevgonecb() once the devfs node is gone. This allows the peripheral to fully go away, and the peripheral destructor, passcleanup(), will get called.
MFC after: 3 days Sponsored by: Spectra Logic
|
#
236138 |
|
27-May-2012 |
ken |
Work around a race condition in devfs by changing the way closes are handled in most CAM peripheral drivers that are not handled by GEOM's disk class.
The usual character driver open and close semantics are that the driver gets N open calls, but only one close, when the last caller closes the device.
CAM peripheral drivers expect that behavior to be honored to the letter, and the CAM peripheral driver code (specifically cam_periph_release_locked_busses()) panics if it is done incorrectly.
Since devfs has to drop its locks while it calls a driver's close routine, and it does not have a way to delay or prevent open calls while it is calling the close routine, there is a race.
The sequence of events, simplified a bit, is:
- devfs acquires a lock - devfs checks the reference count, and if it is 1, continues to close. - devfs releases the lock
- 2nd process open call on the device happens here
- devfs calls the driver's close routine
- devfs acquires a lock - devfs decrements the reference count - devfs releases the lock
- 2nd process close call on the device happens here
At the second close, we get a panic in cam_periph_release_locked_busses(), complaining that peripheral has been released when the reference count is already 0. This is because we have gotten two closes in a row, which should not happen.
The fix is to add the D_TRACKCLOSE flag to the driver's cdevsw, so that we get a close() call for each open(). That does happen reliably, so we can make sure that our reference counts are correct.
Note that the sa(4) and pt(4) drivers only allow one context through the open routine. So these drivers aren't exposed to the same race condition.
scsi_ch.c, scsi_enc.c, scsi_enc_internal.h, scsi_pass.c, scsi_sg.c: For these drivers, change the open() routine to increment the reference count for every open, and just decrement the reference count in the close.
Call cam_periph_release_locked() in some scenarios to avoid additional lock and unlock calls.
scsi_pt.c: Call cam_periph_release_locked() in some scenarios to avoid additional lock and unlock calls.
MFC after: 3 days
|
#
235980 |
|
25-May-2012 |
mav |
Remove sleep() from invalidate call in ses driver, waiting for daemon process exit. Instead use CAM's standard reference counting to prevent periph going away until process won't complete. I think that sleep in single CAM SWI thread is not a good idea and may lead to deadlocks if daemon process waits for some command completion. Combined with recent patch avoiding use of CAM SWI for ATA it just causes panics because of sleeps prohibited in interrupt thread context.
|
#
235911 |
|
24-May-2012 |
mav |
MFprojects/zfsd: Revamp the CAM enclosure services driver. This updated driver uses an in-kernel daemon to track state changes and publishes physical path location information\for disk elements into the CAM device database.
Sponsored by: Spectra Logic Corporation Sponsored by: iXsystems, Inc. Submitted by: gibbs, will, mav
|