#
344394 |
|
20-Feb-2019 |
dab |
MFC r344024:
CID 1009492: Logically dead code in sys/cam/scsi/scsi_xpt.c
In `probedone()`, for the `PROBE_REPORT_LUNS` case, all paths that fall to the bottom of the case set `lp` to `NULL`, so the test for a non-NULL value of `lp` and call to `free()` if true is dead code as the test can never be true. Fix by eliminating the whole if statement. To guard against a possible future change that accidentally violates this assumption, use a `KASSERT()` to catch if `lp` is non-NULL.
Sponsored by: Dell EMC Isilon
|
#
311402 |
|
05-Jan-2017 |
mav |
MFC r298810 (by pfg): sys/cam: spelling fixes in comments.
No functional change.
|
#
295819 |
|
19-Feb-2016 |
ken |
MFC, r295417:
r295417 | ken | 2016-02-08 15:13:08 -0700 (Mon, 08 Feb 2016) | 9 lines
Fix the SCSI Extended INQUIRY probe case when an error is returned and a retry is scheduled.
Instead of leaving the device queue frozen, unfreeze the device queue so that the retry can happen.
Sponsored by: Spectra Logic
Approved by: re (gjb)
|
#
288338 |
|
28-Sep-2015 |
mav |
MFC r287289: Attach pass driver to LUNs is OFFLINE state.
Previously such LUNs were silently ignored. But while they indeed unable to process most of SCSI commands, some, like RTPG, they still can.
|
#
278974 |
|
18-Feb-2015 |
ken |
MFC 278228:
The __FreeBSD_version has been changed to 1001508 for the addition of the CDAI_TYPE_EXT_INQ request type.
------------------------------------------------------------------------ r278228 | ken | 2015-02-04 17:12:21 -0700 (Wed, 04 Feb 2015) | 32 lines
Add support for probing the SCSI VPD Extended Inquiry page (0x86).
This VPD page is effectively an extension of the standard Inquiry data page, and includes lots of additional bits.
This commit includes support for probing the page in the SCSI probe code, and an additional request type for the XPT_DEV_ADVINFO CCB. CTL already supports the Extended Inquiry page.
Support for querying this page in the sa(4) driver will come later.
sys/cam/scsi/scsi_xpt.c: Probe the Extended Inquiry page, if the device supports it, and return it in response to a XPT_DEV_ADVINFO CCB if it is requested.
sys/cam/scsi/cam_ccb.h: Define a new advanced information CCB data type, CDAI_TYPE_EXT_INQ.
sys/cam/cam_xpt.c: Free the extended inquiry data in a device when the device goes away.
sys/cam/cam_xpt_internal.h: Add an extended inquiry data pointer and length to struct cam_ed.
sys/sys/param.h Bump __FreeBSD_version for the addition of the new CDAI_TYPE_EXT_INQ advanced information type.
Sponsored by: Spectra Logic MFC after: 1 week
------------------------------------------------------------------------
Sponsored by: Spectra Logic
|
#
278169 |
|
03-Feb-2015 |
ken |
MFC 276831:
r276831 | ken | 2015-01-08 09:27:56 -0700 (Thu, 08 Jan 2015) | 30 lines
Fix a bug in the CAM SCSI probe code that caused changes in inquiry data to go undetected.
The probe code does an MD5 checksum of the inquiry data (and page 0x80 serial number if available) before doing a reprobe of an existing device, and then compares a checksum after the probe to see whether the device has changed.
This check was broken in January, 2000 by change 56146 when the extended inquiry probe code was added.
In the extended inquiry probe case, it was calculating the checksum a second time. The second time it included the updated inquiry data from the short inquiry probe (first 36 bytes). So it wouldn't catch cases where the vendor, product, revision, etc. changed.
This change will have the effect that when a device's inquiry data is updated and a rescan is issued, it will disappear and then reappear. This is the appropriate action, because if the inquiry data or serial number changes, it is either a different device or the device configuration may have changed significantly. (e.g. with updated firmware.)
scsi_xpt.c: Don't calculate the initial MD5 checksum on standard inquiry data and the page 0x80 serial number if we have already calculated it.
Sponsored by: Spectra Logic
|
#
275204 |
|
28-Nov-2014 |
mav |
MFC r274756: Remove residual xpt_release_device() call left after r272406 cleanup.
Excessive release here could trigger use-after-free condition and kernel panic on LUN 0 disconnect.
|
#
273976 |
|
02-Nov-2014 |
mav |
MFC r272409: Use REPORT LUNS command for SPC-2 devices with LUN 0 disconnected.
SPC-2 tells REPORT LUNS shall be supported by devices supporting LUNs other then LUN 0. If we see LUN 0 disconnected, guess there may be others, and so REPORT LUNS shall be supported.
|
#
273975 |
|
02-Nov-2014 |
mav |
MFC r272406: Make disconnected LUN 0 don't remain in half-configured state if there are no LUNs on SPC-3 target after we tried REPORT LUNS.
|
#
273974 |
|
02-Nov-2014 |
mav |
MFC r272401, r272402: Rework the logic of sequential SCSI LUN scanner.
Previous logic was not differentiating disconnected LUNs and absent targets. That made it to stop scan if LUN 0 was not found for any reason. That made problematic, for example, using iSCSI targets declaring SPC-2 compliance and having no LUN 0 configured.
The new logic continues sequential LUN scan if: -- we have more configured LUNs that need recheck; -- this LUN is connected and its SCSI version allows more LUNs; -- this LUN is disconnected, its SCSI version allows more LUNs and we guess they may be connected (we haven't scanned first 8 LUNs yet or kern.cam.cam_srch_hi sysctl is set to scan more).
|
#
260626 |
|
14-Jan-2014 |
mav |
MFC r260541, r260547: Take additional reference on SCSI probe periph to cover its freeze count.
Otherwise periph may be invalidated and freed before single-stepping freeze is dropped, causing use after free panic.
|
#
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
|
#
259204 |
|
10-Dec-2013 |
nwhitehorn |
MFC r257345,257382,257388:
Implement extended LUN support. If PIM_EXTLUNS is set by a SIM, encode the upper 32-bits of the LUN, if possible, into the target_lun field as passed directly from the REPORT LUNs response. This allows extended LUN support to work for all LUNs with zeros in the lower 32-bits, which covers most addressing modes without breaking KBI. Behavior for drivers not setting PIM_EXTLUNS is unchanged. No user-facing interfaces are modified.
Extended LUNs are stored with swizzled 16-bit word order so that, for devices implementing LUN addressing (like SCSI-2), the numerical representation of the LUN is identical with and without PIM_EXTLUNS. Thus setting PIM_EXTLUNS keeps most behavior, and user-facing LUN IDs, unchanged. This follows the strategy used in Solaris. A macro (CAM_EXTLUN_BYTE_SWIZZLE) is provided to transform a lun_id_t into a uint64_t ordered for the wire.
This is the second part of work for full 64-bit extended LUN support and is designed to a bridge for stable/10 to the final 64-bit LUN code. The third and final part will involve widening lun_id_t to 64 bits and will not be MFCed. This third part will break the KBI but will keep the KPI unchanged so that all drivers that will care about this can be updated now and not require code changes between HEAD and stable/10.
Reviewed by: scottl
|
#
288338 |
|
28-Sep-2015 |
mav |
MFC r287289: Attach pass driver to LUNs is OFFLINE state.
Previously such LUNs were silently ignored. But while they indeed unable to process most of SCSI commands, some, like RTPG, they still can.
|
#
278974 |
|
18-Feb-2015 |
ken |
MFC 278228:
The __FreeBSD_version has been changed to 1001508 for the addition of the CDAI_TYPE_EXT_INQ request type.
------------------------------------------------------------------------ r278228 | ken | 2015-02-04 17:12:21 -0700 (Wed, 04 Feb 2015) | 32 lines
Add support for probing the SCSI VPD Extended Inquiry page (0x86).
This VPD page is effectively an extension of the standard Inquiry data page, and includes lots of additional bits.
This commit includes support for probing the page in the SCSI probe code, and an additional request type for the XPT_DEV_ADVINFO CCB. CTL already supports the Extended Inquiry page.
Support for querying this page in the sa(4) driver will come later.
sys/cam/scsi/scsi_xpt.c: Probe the Extended Inquiry page, if the device supports it, and return it in response to a XPT_DEV_ADVINFO CCB if it is requested.
sys/cam/scsi/cam_ccb.h: Define a new advanced information CCB data type, CDAI_TYPE_EXT_INQ.
sys/cam/cam_xpt.c: Free the extended inquiry data in a device when the device goes away.
sys/cam/cam_xpt_internal.h: Add an extended inquiry data pointer and length to struct cam_ed.
sys/sys/param.h Bump __FreeBSD_version for the addition of the new CDAI_TYPE_EXT_INQ advanced information type.
Sponsored by: Spectra Logic MFC after: 1 week
------------------------------------------------------------------------
Sponsored by: Spectra Logic
|
#
278169 |
|
03-Feb-2015 |
ken |
MFC 276831:
r276831 | ken | 2015-01-08 09:27:56 -0700 (Thu, 08 Jan 2015) | 30 lines
Fix a bug in the CAM SCSI probe code that caused changes in inquiry data to go undetected.
The probe code does an MD5 checksum of the inquiry data (and page 0x80 serial number if available) before doing a reprobe of an existing device, and then compares a checksum after the probe to see whether the device has changed.
This check was broken in January, 2000 by change 56146 when the extended inquiry probe code was added.
In the extended inquiry probe case, it was calculating the checksum a second time. The second time it included the updated inquiry data from the short inquiry probe (first 36 bytes). So it wouldn't catch cases where the vendor, product, revision, etc. changed.
This change will have the effect that when a device's inquiry data is updated and a rescan is issued, it will disappear and then reappear. This is the appropriate action, because if the inquiry data or serial number changes, it is either a different device or the device configuration may have changed significantly. (e.g. with updated firmware.)
scsi_xpt.c: Don't calculate the initial MD5 checksum on standard inquiry data and the page 0x80 serial number if we have already calculated it.
Sponsored by: Spectra Logic
|
#
275204 |
|
28-Nov-2014 |
mav |
MFC r274756: Remove residual xpt_release_device() call left after r272406 cleanup.
Excessive release here could trigger use-after-free condition and kernel panic on LUN 0 disconnect.
|
#
273976 |
|
02-Nov-2014 |
mav |
MFC r272409: Use REPORT LUNS command for SPC-2 devices with LUN 0 disconnected.
SPC-2 tells REPORT LUNS shall be supported by devices supporting LUNs other then LUN 0. If we see LUN 0 disconnected, guess there may be others, and so REPORT LUNS shall be supported.
|
#
273975 |
|
02-Nov-2014 |
mav |
MFC r272406: Make disconnected LUN 0 don't remain in half-configured state if there are no LUNs on SPC-3 target after we tried REPORT LUNS.
|
#
273974 |
|
02-Nov-2014 |
mav |
MFC r272401, r272402: Rework the logic of sequential SCSI LUN scanner.
Previous logic was not differentiating disconnected LUNs and absent targets. That made it to stop scan if LUN 0 was not found for any reason. That made problematic, for example, using iSCSI targets declaring SPC-2 compliance and having no LUN 0 configured.
The new logic continues sequential LUN scan if: -- we have more configured LUNs that need recheck; -- this LUN is connected and its SCSI version allows more LUNs; -- this LUN is disconnected, its SCSI version allows more LUNs and we guess they may be connected (we haven't scanned first 8 LUNs yet or kern.cam.cam_srch_hi sysctl is set to scan more).
|
#
260626 |
|
14-Jan-2014 |
mav |
MFC r260541, r260547: Take additional reference on SCSI probe periph to cover its freeze count.
Otherwise periph may be invalidated and freed before single-stepping freeze is dropped, causing use after free panic.
|
#
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
|
#
259204 |
|
10-Dec-2013 |
nwhitehorn |
MFC r257345,257382,257388:
Implement extended LUN support. If PIM_EXTLUNS is set by a SIM, encode the upper 32-bits of the LUN, if possible, into the target_lun field as passed directly from the REPORT LUNs response. This allows extended LUN support to work for all LUNs with zeros in the lower 32-bits, which covers most addressing modes without breaking KBI. Behavior for drivers not setting PIM_EXTLUNS is unchanged. No user-facing interfaces are modified.
Extended LUNs are stored with swizzled 16-bit word order so that, for devices implementing LUN addressing (like SCSI-2), the numerical representation of the LUN is identical with and without PIM_EXTLUNS. Thus setting PIM_EXTLUNS keeps most behavior, and user-facing LUN IDs, unchanged. This follows the strategy used in Solaris. A macro (CAM_EXTLUN_BYTE_SWIZZLE) is provided to transform a lun_id_t into a uint64_t ordered for the wire.
This is the second part of work for full 64-bit extended LUN support and is designed to a bridge for stable/10 to the final 64-bit LUN code. The third and final part will involve widening lun_id_t to 64 bits and will not be MFCed. This third part will break the KBI but will keep the KPI unchanged so that all drivers that will care about this can be updated now and not require code changes between HEAD and stable/10.
Reviewed by: scottl
|