317320 |
23-Apr-2017 |
mav |
MFC r316653: Fix few minor issues found by Clang Analyzer. |
315939 |
25-Mar-2017 |
mav |
MFC r315084: Increase device openings to tagged maximum.
Some SIMs report much less untagged device openings then tagged ones. Target mode devices are not handled by regular probing routines, and so there is nothing to increase queue size for them to the SIM's maximum. To fix that resize the queue explicitly on ctl periph registration. This radically improves performance of mpt(4) in target mode.
Also fetch and report device queue statistics in `ctladm dumpstructs`, since regular way of `camcontrol tags` is not usable in target mode. |
315891 |
24-Mar-2017 |
mav |
MFC r315022: Request change of SIM target role only when it is different.
Separate WWNs change into separate request to know what actually failed. |
315889 |
24-Mar-2017 |
mav |
MFC r315030: Abort all ATIOs and INOTs queued to SIM on LUN disable.
Some SIMs may not abort them implicitly, that either fail the LUN disable request or just make us wait for those CCBs forever. With this change I can successfully disable LUNs on mpt(4). For isp(4), which aborts them implicitly, this change should be irrelevant. |
315887 |
24-Mar-2017 |
mav |
MFC r315025: Switch work_queue from TAILQ to STAILQ.
It is mostly FIFO and we don't need random removal there. |
315813 |
23-Mar-2017 |
mav |
MFC r311305 (by asomers): Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)
The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are fixed-length strings. AFAICT the only place they're read is in sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated. However, the kernel doesn't null-terminate them. A bunch of copy-pasted code uses strncpy to write them, and doesn't guarantee null-termination. For at least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually overflows. You can see the result by doing "camcontrol negotiate da0 -v".
This change null-terminates those fields everywhere they're set in the kernel. It also shortens a few strings to ensure they'll fit within the 16-character field.
PR: 215474 Reported by: Coverity CID: 1009997 1010000 1010001 1010002 1010003 1010004 1010005 CID: 1331519 1010006 1215097 1010007 1288967 1010008 1306000 CID: 1211924 1010009 1010010 1010011 1010012 1010013 1010014 CID: 1147190 1010017 1010016 1010018 1216435 1010020 1010021 CID: 1010022 1009666 1018185 1010023 1010025 1010026 1010027 CID: 1010028 1010029 1010030 1010031 1010033 1018186 1018187 CID: 1010035 1010036 1010042 1010041 1010040 1010039 |
315138 |
12-Mar-2017 |
mav |
MFC r314307: Add support for SIMs without autosense.
If we asked to send sense data by setting CAM_SEND_SENSE, but SIM didn't confirm transmission by setting CAM_SENT_SENSE, assume it was not sent. Queue the I/O back to CTL for later REQUEST SENSE with ctl_queue_sense(). This is needed for error reporting on SPI HBAs like ahc(4)/ahd(4). |
314767 |
06-Mar-2017 |
mav |
MFC r314338: Polish handling of different reset flavours.
The biggest change is that ctl_remove_initiator() now generates I_T NEXUS LOSS event, cleaning part of LUs state related to the initiator. |
314763 |
06-Mar-2017 |
mav |
MFC r314496: Add check missed in r314257. |
314761 |
06-Mar-2017 |
mav |
MFC r314387: Make ctl_queue_sense() not sleep.
It may be called in non-sleepable frontend context. |
314757 |
06-Mar-2017 |
mav |
MFC r314299, r314300: Fix residual length reporting in target mode.
This allows to properly handle cases when target wants to receive or send more data then initiator wants to send or receive. Previously in such cases isp(4) returned CAM_DATA_RUN_ERR, while now it returns resid > 0. |
314755 |
06-Mar-2017 |
mav |
MFC r314257: Add reporting SAS protocol, in case we ever have one. |
314753 |
06-Mar-2017 |
mav |
MFC r314255: Reenable CTL_WITH_CA, optimizing it for lower memory usage.
This code was disabled due to its high memory usage. But now we need this functionality for cfumass(4) frontend, since USB MS BBB transport does not support autosense. |
314751 |
06-Mar-2017 |
mav |
MFC r314247: Axe out some forever disabled questionable functionality.
This code is complicated enough even in its base shape. |
314749 |
06-Mar-2017 |
mav |
MFC r314246: Improve CAM target frontend reference counting.
Before this change it was possible to trigger some use-after-free panics by disabling LUNs/ports under heavy load. |
314745 |
06-Mar-2017 |
mav |
MFC r314204: Explicitly abort ATIO if CTIO sending status has failed.
This helps SIM to free related resources in questionable cases. |
314740 |
06-Mar-2017 |
mav |
MFC r314200: We can't access periph after ctlfe_free_ccb(). |
314739 |
06-Mar-2017 |
mav |
MFC r314196: Unify ATIO/INOT CCBs requeuing. |
314737 |
06-Mar-2017 |
mav |
MFC r314193: Some code cleanup. |
314727 |
06-Mar-2017 |
mav |
MFC r314027: Do not blindly free completed ATIOs/INOTs on invalidation.
When LUN is disabled, SIM starts returning queued ATIOs/INOTs. But at the same time there can be some ATIOs/INOTs still carrying real new requests. If we free those, SIM may leak some resources, forever expecting for any response from us. So try to be careful, separating ATIOs/INOTs carrying requests which still must be processed, from ATIOs/INOTs completed with errors which can be freed. |
314380 |
28-Feb-2017 |
mav |
MFC r313744: No need to erase sense_data when sense_len is set to zero. |
314238 |
25-Feb-2017 |
mav |
MFC r313910: Change XCOPY memory allocations.
Before this change XCOPY code could allocate memory in chunks up to 16-32MB (VMware does XCOPY in 4MB chunks by default), that could be difficult for VM subsystem to do due to KVA fragmentation, that sometimes created huge allocation delays, blocking any I/O for respective LU for that time.
This change limits allocations down to TPC_MAX_IO_SIZE, which is 1MB now. 1MB is also not a cookie, but ZFS also can do that for large blocks, so it should be less dramatic. As drawback this increases CPU overhead, but it still look acceptable comparing to time consumed by ZFS read/write. |
314026 |
21-Feb-2017 |
mav |
MFC r313736: Fix panic on shutdown of ramdisk LU with zero capacity. |
313998 |
20-Feb-2017 |
ken |
MFC 313895:
------------------------------------------------------------------------ r313895 | ken | 2017-02-17 13:15:27 -0700 (Fri, 17 Feb 2017) | 9 lines
Make ctl(4) build with CTL_IO_DELAY defined.
sys/cam/ctl/ctl.c: In ctl_datamove(), inside CTL_IO_DELAY, add a lun variable and fill it in before trying to dereference it.
Sponsored by: Spectra Logic
------------------------------------------------------------------------ |
313371 |
07-Feb-2017 |
mav |
MFC r312694: Make CTL ramdisk backend a real RAM disk.
If "capacity" LU option is set, ramdisk backend now implements featured thin provisioned disk, storing data in malloc(9) allocated memory blocks of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU size is used for indirection tree (bigger pblocksize reduce the overhead). Backend supports all unmap and anchor operations. If configured capacity is overflowed, proper error conditions are reported.
If "capacity" LU option is not set, the backend operates mostly the same as before without allocating real storage: writes go to nowhere, reads return zeroes, reporting that all LBAs are unmapped.
This backend is still mostly oriented on testing and benchmarking (it is still a volatile RAM disk), but now it should allow to run real FS tests, not only simple dumb dd. |
313369 |
07-Feb-2017 |
mav |
MFC r312603: Add initial support for CTL module unloading.
It is only a first step and not perfect, but better then nothing. The main blocker is CAM target frontend, that can not be unloaded, since CAM does not have mechanism to unregister periph driver now. |
313367 |
07-Feb-2017 |
mav |
MFC r312348: Remove writing 'residual' field of struct ctl_scsiio.
This field has no practical use and never readed. Initiators already receive respective residual size from frontends. Removed field had different semantics, which looks useless, and was never passed through by any frontend.
While there, fix kern_data_resid field support in case of HA, missed in r312291. |
313365 |
07-Feb-2017 |
mav |
MFC r312291, r312669: Make CTL frontends report kern_data_resid for under-/overruns.
It seems like kern_data_resid was never really implemented. This change finally does it. Now frontends update this field while transferring data, while CTL/backends getting it can more flexibly handle the result. At this point behavior should not change significantly, still reporting errors on write overrun, but that may be changed later, if we decide so.
CAM target frontend still does not properly handle overruns due to CAM API limitations. We may need to add some fields to struct ccb_accept_tio to pass information about initiator requested transfer size(s). |
313363 |
07-Feb-2017 |
mav |
MFC r312343: Improve error message on duplicate iSCSI port. |
312849 |
26-Jan-2017 |
mav |
MFC r312232: Add under-/overrun support to IOCTL and CAM SIM frontends. |
312847 |
26-Jan-2017 |
mav |
MFC r312231: When in kernel, map ctl_scsi_zero_io() to ctl_zero_io(). |
312845 |
26-Jan-2017 |
mav |
MFC r312026: Improve CAM_CDB_POINTER support. |
312843 |
26-Jan-2017 |
mav |
MFC r311873: Fix malloc(M_WAITOK) under mutex, introduced at r311787. |
312841 |
26-Jan-2017 |
mav |
MFC r311804: Rewrite CTL statistics in more simple and scalable way.
Instead of collecting statistics for each combination of ports and logical units, that consumed ~45KB per LU with present number of ports, collect separate statistics for every port and every logical unit separately, that consume only 176 bytes per each single LU/port. This reduces struct ctl_lun size down to just 6KB.
Also new IOCTL API/ABI does not hardcode number of LUs/ports, and should allow handling of very large quantities.
Old API is still enabled in stable branches for compatibility reasons. |
312839 |
26-Jan-2017 |
mav |
MFC r311787: Allocate memory for prevent flags only for removable LUs.
This array takes 64KB of RAM now, that was more then half of struct ctl_lun size. If at some point we support more ports, this may need another tune. |
312837 |
26-Jan-2017 |
mav |
MFC r311680: Make CTL_GETSTATS ioctl return partial data if buffer is small. |
312835 |
26-Jan-2017 |
mav |
MFC r310778, r310782: Improve use of I/O's private area.
- Since I/Os are allocates from per-port pools, make allocations store pointer to CTL softc there, and use it where needed instead of global. - Created bunch of helper macros to access LUN, port and CTL softc. |
312587 |
21-Jan-2017 |
mav |
MFC r311892: Do not wait for HA thread shutdown if scheduler is stopped.
This wait loop made system hang on panic instead of reboot. |
312585 |
21-Jan-2017 |
mav |
MFC r310649: Allow more efficient use of private area.
There are 16 bytes of space, so we may store two pointers in one. |
312583 |
21-Jan-2017 |
mav |
MFC r310646: Do not update "saved" mode page on every MODE SELECT.
We do not have non-volatile memory to really save those values, so we neither report nor support this capability. Also saved mode pages are not replicated between HA peers now. |
312581 |
21-Jan-2017 |
mav |
MFC r310644: Fix/synchronize field types in struct ctl_modepage_header. |
312579 |
21-Jan-2017 |
mav |
MFC r310640, r310643: Add support for revert to defaults (RTD) bit in MODE SELECT. |
312577 |
21-Jan-2017 |
mav |
MFC r310635: Decouple limits on number of LUNs per port and LUs per CTL.
Those two values are not directly related, so make them independent. This does not change any limits immediately, but makes number of LUNs per port controllable via tunable/sysctl kern.cam.ctl.lun_map_size. After this change increasing CTL_MAX_LUNS should be pretty cheap, and even making it tunable should be easy. |
312575 |
21-Jan-2017 |
mav |
MFC r310575: Fix improperly used nexus.targ_lun. |
312573 |
21-Jan-2017 |
mav |
MFC r310555: Some random code cleaning.
- Reduce indentation. - Remove extra braces. - Add few missing savety checks. |
312571 |
21-Jan-2017 |
mav |
MFC r310539: Remove CTL_MAX_LUNS from places where it is not required. |
311673 |
08-Jan-2017 |
mav |
MFC r311446: Fix bootverbose affecting code logic in r294558.
Reported by: Jilles Tjoelker <jilles@stack.nl> |
311442 |
05-Jan-2017 |
mav |
MFC r310534: Improve third-party copy error reporting.
For EXTENDED COPY: - improve parameters checking to report some errors before copy start; - forward sense data from copy target as descriptor in case of error; - report which CSCD reported error in sense key specific information. For WRITE USING TOKEN: - pass through real sense data from copy target instead of reporting our copy error, since for initiator its a "simple" write, not a copy. |
311440 |
05-Jan-2017 |
mav |
MFC r310524: Improve length handling when writing sense data.
- Allow maximal sense size limitation via Control Extension mode page. - When sense size limited, include descriptors atomically: whole or none. - Set new SDAT_OVFL bit if some descriptors don't fit the limit. - Report real written sense length instead of static maximal 252 bytes. |
311436 |
05-Jan-2017 |
mav |
MFC r310478: Add place-holders for TAPE STREAM MIRRORING subcommands of XCOPY.
We do not support tapes, so this is only a comments. |
311433 |
05-Jan-2017 |
mav |
MFC r310390: Add support for REPD bit in RSTMF command.
We have no real timeout values to report there, but its better then error. |
311432 |
05-Jan-2017 |
mav |
MFC r310389: Fix REPORT SUPPORTED OPERATION CODES for READ/WRITE BUFFER commands.
Specifications require MODE parameter of those commands to be treated the same as SERVICE ACTION parameter of other commands. |
311430 |
05-Jan-2017 |
mav |
MFC r310373: Add support for REPORTING OPTIONS == 3 in REPORT SUPPORTED OPERATION CODES. |
311428 |
05-Jan-2017 |
mav |
MFC r310366: Add support for SITUA bit in Logical Block Provisioning mode page.
VMware tries to enable this bit to avoid multiple threshold notifications in case of multiple initiators connected to the same LUN. Unfortunately their code sends MODE SELECT(6) request with parameter length hardcoded for the page without any thresholds. Since we have four threshold and our page is bigger, this attempt fails, that is correct in my understanding. So all we can do about this now is to report proper error code and hope VMware fix their code one day. |
311423 |
05-Jan-2017 |
mav |
MFC r310356: Add support for locally assigned RFC 4122 UUID LUN identifiers. |
311421 |
05-Jan-2017 |
mav |
MFC r310339: Bump specifications support to SAM-6/SPC-5. |
311419 |
05-Jan-2017 |
mav |
MFC r310298: Improve error handling when I/O split between several BIOs.
If we get several error codes, handle one with lowest offset. |
311417 |
05-Jan-2017 |
mav |
MFC r310285: When reporting "Logical block address out of range" error, report the LBA in sense data INFORMATION field. |
311413 |
05-Jan-2017 |
mav |
MFC r310275: Fix typo in function name. |
311411 |
05-Jan-2017 |
mav |
MFC r310272: Add new bits into Extended Inquiry VPD page. |
311409 |
05-Jan-2017 |
mav |
MFC r310266: Add support for NUAR bit in Control mode page. |
311407 |
05-Jan-2017 |
mav |
MFC r310265: Add set of macros to simplify code access to mode pages fields. |
311404 |
05-Jan-2017 |
mav |
MFC r310259: Following SPC-5, make REQUEST SENSE report "Logical unit not supported" in returned parameter data for not accessible LUNs. |
311403 |
05-Jan-2017 |
mav |
MFC r310257: Improve support for informational exceptions.
While CTL still has no real events to report in this way (like SMART), it is possible to trigger false event by manually setting TEST bit in Informational Exceptions Control mode page, that can be useful for initiator testing. This code supports all flavours of IE reporting: UNIT ATTENTION, RECOVERED ERROR and NO SENSE sense keys, REQUEST SENSE command and Informational Exceptions log page. |
311402 |
05-Jan-2017 |
mav |
MFC r298810 (by pfg): sys/cam: spelling fixes in comments.
No functional change. |
311401 |
05-Jan-2017 |
mav |
MFC r295476 (by trasz): Remove stray semicolons from the iSCSI code. |
311400 |
05-Jan-2017 |
mav |
MFC r294558: Hide "soconnect() error" messages under bootverbose.
They can be too noisy. |
308079 |
29-Oct-2016 |
mav |
MFC r307374: Add LU option to control reported provisioning type. |
308078 |
29-Oct-2016 |
mav |
MFC r307350: Add LUN options to limit UNMAP and WRITE SAME sizes.
CTL itself has no limits on on UNMAP and WRITE SAME sizes. But depending on backends large requests may take too much time. To avoid that new configuration options allow to hint initiator maximal sizes it should not exceed. |
304737 |
24-Aug-2016 |
mav |
Fix HA mode configuration on FreeBSD 10.x.
This is direct commit, compensating CTLFLAG_RDTUN difference between FreeBSD 10.x and 11.x branches. |
304417 |
18-Aug-2016 |
mav |
MFC r300293: Pass task management response information from CTL through CAM to isp(4), utilizing previously unused arg field of struct ccb_notify_acknowledge.
This makes new QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT requests really functional for CAM target mode drivers. |
302237 |
27-Jun-2016 |
bdrewery |
MFC r292384:
Fix style issues around existing SDT probes.
** Changes to sys/netinet/in_kdtrace.c and sys/netinet/in_kdtrace.h skipped. |
300588 |
24-May-2016 |
mav |
MFC r299347, r299348: Validate XCOPY range offsets and lengths. |
300587 |
24-May-2016 |
mav |
MFC r299346: More XCOPY parameters validation. |
300586 |
24-May-2016 |
mav |
MFC r299329: Improve validation of some POPULATE TOKEN parameters. |
299400 |
11-May-2016 |
pfg |
MFC r298703: cam: unsign some types to match their definitions and avoid overflows.
numpatterns is u_int.
ctl: CTL_NUM_MODE_PAGES comes from sizeof(). In struct:ctl_scsiio, kern_sg_entries is uint32_t. |
299191 |
06-May-2016 |
sbruno |
MFC r298279
Plug memory leak in ctl(4) when ctl_copyin_args() is called with a non- null terminated ASCII string.
PR: 207626 Submitted by: cturt@hardenedbsd.org |
296442 |
07-Mar-2016 |
mav |
MFC r296392: Set bhsdi_target_transfer_tag to reserved value, which is 0xffffffff.
This should be a purely cosmetic change. |
294978 |
28-Jan-2016 |
kib |
MFC r293350: Convert sys/cam to use make_dev_s(). |
292590 |
22-Dec-2015 |
mav |
MFC r292290: Set DS flag, required for LPB log page by spec. |
291496 |
30-Nov-2015 |
mav |
MFC r291383: Fix panic when trying to sort unsupported command in OOA queue.
Handle unsupported commands as not conflicting/blocking. |
291389 |
27-Nov-2015 |
mav |
MFC r290820: Add NULL check to make Coverity happy. |
291388 |
27-Nov-2015 |
mav |
MFC r290670: Modify target port groups logic in CTL.
- Introduce "ha_shared" port option, which being set to "on" moves the port into separate port group, shared between HA nodes. This allows to better handle cases when iSCSI portals are bound to CARP address that can dynamically move between nodes. Some initiators (at least VMware) don't detect that after iSCSI reconnect they've attached to different SCSI port from different port group, that totally breakes ALUA status parsing. In theory, I believe, it should be enough to have different iSCSI portal group tags on different nodes to make initiators detect this condition, but it seems like VMware ignores those values, and even full LUN retaste forced by UA does not help. - Make CTL report up to three port groups: 1 -- non-HA mode or ports with "ha_shared" option set, 2 -- HA node 1, 3 -- HA node 2. - Report Transitioning state for all port groups when HA interlink is connected, but neither of nodes is primary for the LUN. |
290778 |
13-Nov-2015 |
mav |
MFC r290458: Add two more KASSERTs. |
290776 |
13-Nov-2015 |
mav |
MFC r289881: Give CTL support for PIM_EXTLUNS when talking to CAM.
CTL itself still lives in flat LUN space, but it can generate extended numbers if CAM SIM reports such capability. |
290775 |
13-Nov-2015 |
mav |
MFC r289843: Add partial support for QUERY TMF to CAM and isp(4).
This change allows to decode respective functions in isp(4) in target mode and pass them through CAM to CTL. Unfortunately neither CAM nor isp(4) support returning response info for those task management functions now.
On the other side I just have no initiator to test this functionality. |
290774 |
13-Nov-2015 |
mav |
MFC r289702: Make some panic strings mode informative. |
290172 |
30-Oct-2015 |
mav |
MFC r289819: Fix LUN disable in CAM broken at r285155. |
290137 |
29-Oct-2015 |
mav |
MFC r290004: Don't try to replicate mode pages not present on this device. |
289489 |
18-Oct-2015 |
mav |
MFC r289136: Remove lock upgrade attempt from ctl_be_block_open_file().
I am not sure what for it was done. Now open routine should automatically fall back to read-only if open for writing is impossible. In such case attempt to upgrade to write sounds strange. |
289363 |
15-Oct-2015 |
mav |
MFC r289017: Add missing vnode lock in case of file modify request.
Submitted by: Richard Kojedzinszky |
288822 |
05-Oct-2015 |
mav |
MFC r288458: More aggressively fill WUT read pipeline.
On some tests I've measured 5% copy speedup from this. |
288821 |
05-Oct-2015 |
mav |
MFC r288450: Make zero WUT use WRITE SAME with recently allowed NDOB flag. |
288820 |
05-Oct-2015 |
mav |
MFC r288449: Implement SPC-3 exceptions to SPC-2 RESERVE and RELEASE behavior. |
288819 |
05-Oct-2015 |
mav |
MFC r288448: Unify PR variable names to reduce confusion. |
288818 |
05-Oct-2015 |
mav |
MFC r288427: Use proper STAILQ_* macros where possible. |
288816 |
05-Oct-2015 |
mav |
MFC r288369: Really implement PREVENT ALLOW MEDIUM REMOVAL command. |
288815 |
05-Oct-2015 |
mav |
MFC r288368: Don't report SYNC_NV bit set in SYNCHRONIZE CACHE as error.
While this bit is obsolete in SBC-3, behavior controlled by it is allowed on device discretion. |
288814 |
05-Oct-2015 |
mav |
MFC r288367: Fix arguments order. |
288813 |
05-Oct-2015 |
mav |
MFC r288359: Report that we can read all flavours of DVD. Why not? |
288812 |
05-Oct-2015 |
mav |
MFC r288358: Add CD/DVD Capabilities and Mechanical Status Page.
This page is obsolete since MMC-4, but still used by some software.
approved by: |
288811 |
05-Oct-2015 |
mav |
MFC r288348: Umplement media load/eject support for removable devices.
In case of block backend eject really closes the backing store, while load tries to open it back. Failed store open is reported as no media. |
288810 |
05-Oct-2015 |
mav |
MFC r288310: Add to CTL initial support for CDROMs and removable devices.
Relnotes: yes |
288809 |
05-Oct-2015 |
mav |
MFC r288264: Allow LOG SENSE command on non-disk devices. |
288808 |
05-Oct-2015 |
mav |
MFC r288262: Remove concept of control device. |
288807 |
05-Oct-2015 |
mav |
MFC r288261: Move ioctl frontend defines where they belong. |
288806 |
05-Oct-2015 |
mav |
MFC r288260: Remove few more unused variables. |
288805 |
05-Oct-2015 |
mav |
MFC r288259: Remove some duplicate, legacy, dead and questionable code. |
288804 |
05-Oct-2015 |
mav |
MFC r288247: Pass to sobind() copy of the address, not the original. |
288803 |
05-Oct-2015 |
mav |
MFC r288239: Properly lock LUN in ctl_failover_lun(). |
288802 |
05-Oct-2015 |
mav |
MFC r288224: Constify ctl_serialize_table. |
288801 |
05-Oct-2015 |
mav |
MFC r288229: Fix bit masks changed for the wrong commands in r288221. |
288800 |
05-Oct-2015 |
mav |
MFC r288221: Remove some dead code found by Clang analyzer. |
288799 |
05-Oct-2015 |
mav |
MFC r288220: Remove stale comments and some excessive empty lines. |
288798 |
05-Oct-2015 |
mav |
MFC r288215: Switch I/O time accounting from system time to uptime.
While there, make num_dmas accounted independently of CTL_TIME_IO. |
288797 |
05-Oct-2015 |
mav |
MFC r288214: Collect DMA statistics on secondary HA node. |
288796 |
05-Oct-2015 |
mav |
MFC r288213: Make HA handle datamove and done in a universal way, using port methods.
Now from primary node point of view requests transferred from secondary node should look almost normal and always have valid port. |
288795 |
05-Oct-2015 |
mav |
MFC r288211: Remove some control_softc references. |
288794 |
05-Oct-2015 |
mav |
MFC r288175: Allow WRITE SAME with NDOB bit set but without UNMAP.
This combination was originally forbidden, but allowed at spc4r3. |
288793 |
05-Oct-2015 |
mav |
MFC r288170: Add new report types to REPORT LUNS command.
This is only for completeness, since we have nothing new to report there. |
288792 |
05-Oct-2015 |
mav |
MFC r288166: Update WRITE ATOMIC(16) support to sbc4r8 draft.
This is only a cosmetic change. We still don't support atomic boundary field in the CDB, but at least now we do it formally. |
288791 |
05-Oct-2015 |
mav |
MFC r288165: Add support for READ BUFFER(16) command. |
288790 |
05-Oct-2015 |
mav |
MFC r288148: Synchronize mode pages between HA peers.
We allow to modify only few fields in mode pages now, but still it is not good if they unexpectedly change during failover. Also this fixes reporting of "Mode parameters changed" UAs on secondary node. |
288789 |
05-Oct-2015 |
mav |
MFC r288146: Make HA peers announce their parameters on connect.
HA protocol requires strict version, parameters and configuration match. Differences there may cause full set of problems up to kernel panic. To avoid that, validate peer parameters on connect, and abort connection immediately if some mismatch detected. |
288788 |
05-Oct-2015 |
mav |
MFC r288110: Add support for Control extension mode page. |
288787 |
05-Oct-2015 |
mav |
MFC r288104: Remove duplicate and incomplete code handling LUN modify.
Instead reuse code from LUN creation. This allows most of LUN media options to be changed live with modify request without full restart. |
288786 |
05-Oct-2015 |
mav |
MFC r288067: Log iSCSI session reinstatements.
False session reinstatements can be result of misconfiguration, when several initiators use the same initiator name and ISID. |
288782 |
05-Oct-2015 |
mav |
MFC r288021: Mark with DMA flag I/Os waiting for iSCSI write data after R2T.
Reads and immediate writes are not blocking, so don't bother. |
288781 |
05-Oct-2015 |
mav |
MFC r288020: Remove couple excess SGLIST I/O flags.
Those flags duplicated respective (sg_entries > 0) values. |
288779 |
05-Oct-2015 |
mav |
MFC r287994: Always execute REPORT LUNS and REQUEST SENSE commands locally.
REPORT LUNS command is more related to target rather then specific LUN. This node may be primary for LUNs for some reason unknown to another, and command forwarded to another node won't be able to report them.
REQUEST SENSE is related to LUN, but in our implementation it reports only UAs and CAs, that are stored locally rather then on primary node. |
288778 |
05-Oct-2015 |
mav |
MFC r287993: Split two command flags with different meaning.
This is only a cosmetical change. |
288777 |
05-Oct-2015 |
mav |
MFC r287991: Pack struct ctl_ha_msg_hdr by 8 bytes. |
288776 |
05-Oct-2015 |
mav |
MFC r287986: Fix memory corruption when >128K transferred through HA link.
While there, do some cleaning. |
288775 |
05-Oct-2015 |
mav |
MFC r287968: Mark I/Os with DMA flag while moving data through the HA link. |
288774 |
05-Oct-2015 |
mav |
MFC r287967: Relax serseq option operation for reads.
Previously, with serseq enabled, next command was unblocked only after previous completed. With this change, for read operations, next command is unblocked as soon as last media read completed. This is important for frontends that actually wait for data move completion (like camtgt), or when data are moved through the HA link, or especially when both. |
288773 |
05-Oct-2015 |
mav |
MFC r287957: Kill HA link and shutdown the threads on shutdown. |
288770 |
05-Oct-2015 |
mav |
MFC r287940: Replicate initiators WWPNs and names between HA peers. |
288769 |
05-Oct-2015 |
mav |
MFC r287933: Replicate port->init_devid to HA peer. |
288768 |
05-Oct-2015 |
mav |
MFC r287921: When reporting TPT UA, report which of thresholds was reached. |
288767 |
05-Oct-2015 |
mav |
MFC r287913: Report number of failed XCOPY segment. |
288765 |
05-Oct-2015 |
mav |
MFC r287912: Report proper medium error code for VERIFY commands. |
288764 |
05-Oct-2015 |
mav |
MFC r287875: Fix reading after end of file for file-backed LUNs.
If backing file is smaller then the LUN size, we have to explicitly clear the rest of the buffer to not leak some random data from previous I/Os. |
288763 |
05-Oct-2015 |
mav |
MFC r287868: Make COMPARE AND WRITE report offset of difference. |
288762 |
05-Oct-2015 |
mav |
MFC r287860: Frontends don't need to set errors themselves. |
288761 |
05-Oct-2015 |
mav |
MFC r287855: Don't flap the HA link if sysctl is reset to the same value. |
288759 |
05-Oct-2015 |
mav |
MFC r287818: Fix completion/error status reporting. |
288758 |
05-Oct-2015 |
mav |
MFC r287816: Close potential race between datamove and HA failover. |
288757 |
05-Oct-2015 |
mav |
MFC r287784: Implement data/status aggregation for secondary HA node.
For short read requests this reduces latency by 30%, reporting command completion after two interlink roundtrips instead of full three. |
288756 |
05-Oct-2015 |
mav |
MFC r287783: Implement data/status aggregation for camsim backend.
This is almost pointless for primary HA node, but useful for secondary, where between fe_datamove and fe_done calls goes another link roundtrip. |
288755 |
05-Oct-2015 |
mav |
MFC r287778: Remove CTL_PRIV_LBA_LEN from HA messages.
Previously it was used for statistics, but now just a 16 extra bytes. |
288754 |
05-Oct-2015 |
mav |
MFC r287774: Implement QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT.
Now we support most of SAM-5 task management. |
288752 |
05-Oct-2015 |
mav |
MFC r287765: Map CLEAR TASK SET and I_T NEXUS RESET for iSCSI.
The last should not be called without iSCSIProtocolLevel negotiation. |
288751 |
05-Oct-2015 |
mav |
MFC r287764: Implement iSCSI TARGET COLD RESET task management function.
Implement it as CTL_TASK_TARGET_RESET plus termination of all sessions. |
288750 |
05-Oct-2015 |
mav |
MFC r287760: Improve read-only support. |
288749 |
05-Oct-2015 |
mav |
MFC r287758: Reannounce port to HA peer if LUN map changed after online. |
288747 |
05-Oct-2015 |
mav |
MFC r287756: Report INQUIRY DATA HAS CHANGED for related LUNs on port on-/offline. |
288746 |
05-Oct-2015 |
mav |
MFC r287754: Report CTL_UA_LUN_CHANGE on LUN map change. |
288745 |
05-Oct-2015 |
mav |
MFC r287748: Make TARGET RESET respect LUN mapping. |
288744 |
05-Oct-2015 |
mav |
MFC r287724: Check for obsolete NUL bin in CSCD descriptor. |
288743 |
05-Oct-2015 |
mav |
MFC r287721: Add HA support for CTL_TASK_I_T_NEXUS_RESET. |
288742 |
05-Oct-2015 |
mav |
MFC r287720: Fix false CTL_UA_RES_RELEASE on secondary HA node. |
288740 |
05-Oct-2015 |
mav |
MFC r287715: Improve XCOPY error reporting. |
288739 |
05-Oct-2015 |
mav |
MFC r287714: Report that we have no limit on POPULATE TOKEN segment size. |
288738 |
05-Oct-2015 |
mav |
MFC r287712: Correct RTPG bitmask. |
288737 |
05-Oct-2015 |
mav |
MFC r287711: Some HA polishing. |
288736 |
05-Oct-2015 |
mav |
MFC r287707: CTL documentation update, mostly for HA. |
288735 |
05-Oct-2015 |
mav |
MFC r287671: Make ctld restart on primary HA node less invasive for secondary. |
288734 |
05-Oct-2015 |
mav |
MFC r287670: Close races between device close and request processing.
All requests arriving for processing after OFFLINE flag set are rejected with BUSY status. Races around OFFLINE flag setting are closed by calling taskqueue_drain_all(). |
288733 |
05-Oct-2015 |
mav |
MFC r287664: Reference/release devices on every I/O, rather on open/close.
While this may be slower, it allows device destruction to complete, rather then block waiting for indefinitely long time. |
288732 |
05-Oct-2015 |
mav |
MFC r287621: Reimplement CTL High Availability.
CTL HA functionality was originally implemented by Copan many years ago, but large part of the sources was never published. This change includes clean room implementation of the missing code and fixes for many bugs.
This code supports dual-node HA with ALUA in four modes: - Active/Unavailable without interlink between nodes; - Active/Standby with second node handling only basic LUN discovery and reservation, synchronizing with the first node through the interlink; - Active/Active with both nodes processing commands and accessing the backing storage, synchronizing with the first node through the interlink; - Active/Active with second node working as proxy, transfering all commands to the first node for execution through the interlink.
Unlike original Copan's implementation, depending on specific hardware, this code uses simple custom TCP-based protocol for interlink. It has no authentication, so it should never be enabled on public interfaces.
The code may still need some polishing, but generally it is functional.
Relnotes: yes Sponsored by: iXsystems, Inc. |
288731 |
05-Oct-2015 |
mav |
MFC r287620: Remove unused target and initiator IDs. |
288730 |
05-Oct-2015 |
mav |
MFC r287618: Disable CTL_IO_DELAY feature.
It is too developer-oriented to be enabled by default. |
288728 |
05-Oct-2015 |
mav |
MFC r287500: Allow LUN options modification via CTL_LUNREQ_MODIFY.
Not all changes take effect, but that is a different question. |
288727 |
05-Oct-2015 |
mav |
MFC r287499: Move setting of media parameters inside open routines.
This is preparation for possibility to open/close media several times per LUN life cycle. While there, rename variables to reduce confusion. As additional bonus this allows to open read-only media, such as ZFS snapshots. |
288726 |
05-Oct-2015 |
mav |
MFC r287455, r287458, r287459: Remove some dead code. |
288725 |
05-Oct-2015 |
mav |
MFC r287433: Small UA cleanup. |
288724 |
05-Oct-2015 |
mav |
MFC r287372: Make most of port methods optional and remove bunch of dummies. |
288723 |
05-Oct-2015 |
mav |
MFC r287293: Remove 600 bytes of port_priv from struct ctl_io_hdr.
This field used only for camtgt frontend, and once it any way preallocates all requests, let it preallocate this memory too, not bothering core code. |
288722 |
05-Oct-2015 |
mav |
MFC r287221: Fix type bug introduced at r286811. |
288721 |
05-Oct-2015 |
mav |
MFC r286811: Polish sizes processing. |
288720 |
05-Oct-2015 |
mav |
MFC r286807: Move "ioctl" CAM frontend into separate file.
It has nothing to share with too huge ctl.c other then device descriptor, but even that may be counted as design error that may be fixed later. At some point we may even want to have several ioctl ports. |
288719 |
05-Oct-2015 |
mav |
MFC r286806: Drop "internal" CTL frontend.
Its idea was to be a simple initiator and execute several commands from kernel level, but FreeBSD never had consumer for that functionality, while its implementation polluted many unrelated places. |
288718 |
05-Oct-2015 |
mav |
MFC r286406, r286414: Wrap some unused functions with notyet, it is necessary to be able to build the modules/ctl directly. Remove a dead MALLOC_DEFINE. |
288713 |
05-Oct-2015 |
mav |
MFC r285155: Make first step toward supporting target and initiator roles same time.
To avoid conflicts between target and initiator devices in CAM, make CTL use target ID reported by HBA as its initiator_id in XPT_PATH_INQ. That target ID is known to never be used for initiator role, so it won't conflict. For Fibre Channel and FireWire HBAs this specific ID choice is irrelevant since all target IDs there are virtual. Same time for SPI HBAs it seems could be even requirement to use same target ID for both initiator and target roles.
While there are some more things to polish in isp(4) driver, first tests of using both roles same time on the same port appeared successfull:
# camcontrol devlist -v scbus0 on isp0 bus 0: <FREEBSD CTLDISK 0001> at scbus0 target 1 lun 0 (da20,pass21) <> at scbus0 target 256 lun 0 (ctl0) <> at scbus0 target -1 lun ffffffff (ctl1) |
288706 |
05-Oct-2015 |
mav |
MFC r285030: Fix couple panics on forced unmount of backing file. |
288697 |
05-Oct-2015 |
mav |
MFC r278398 (by trasz): Fix ordering of "*logout" and "*terminate"; no functional changes. |
287498 |
06-Sep-2015 |
mav |
MFC r287432: Fix copy-paste bug introduced in r275458. |
286931 |
19-Aug-2015 |
mav |
MFC r286353: Pass SYNCHRONIZE CACHE command parameters to backends.
At this point IMMED flag is translated to MNT_NOWAIT flag of VOP_FSYNC(), hoping that file system implements that (ZFS seems doesn't). |
286930 |
19-Aug-2015 |
mav |
MFC r286345: Relax serialization of SYNCHRONIZE CACHE commands.
Before this change SYNCHRONIZE CACHE commands were executed exclusively, as if they had ORDERED tag. But looking through SCSI specs I've found no any reason to be so strict. For reads this ordering seems pointless. For writes it looks less obvious, so I left ordering against preceeding write commands, while following ones are no longer required to wait. |
286928 |
19-Aug-2015 |
mav |
MFC r286320: Issue all reads of single XCOPY segment simultaneously.
During vMotion and Clone VMware by default runs multiple sequential 4MB XCOPY requests same time. If CTL issues reads sequentially in 1MB chunks for each XCOPY command, reads from different commands are not detected as sequential by serseq option code and allowed to execute simultaneously. Such read pattern confused ZFS prefetcher, causing suboptimal disk access. Issuing all reads same time make serseq code work properly, serializing reads both within each XCOPY command and between them.
My tests with ZFS pool of 14 disks in RAID10 shows prefetcher efficiency improved from 37% to 99.7%, copying speed improved by 10-60%, average read latency reduced twice on HDD layer and by five times on zvol layer. |
286817 |
16-Aug-2015 |
mav |
MFC r286514: Remove verbose CTL messages.
Reporting SCSI errors to console is often useless, pollutes logs and may affect performance. For debugging there is kern.cam.ctl.debug sysctl |
284798 |
25-Jun-2015 |
mav |
MFC r284640: Bring per-port LUN enable/disable code up to date: - remove last remnants of never implemented multiple targets support; - implement missing support for LUN mapping in this area.
Due to existing locking constraints LUN mapping code is practically unlocked at this point. Hopefully it is not racy enough to live until somebody get idea how to call sleeping fronend methods under lock also taken by the same frontend in non-sleepable context. :( |
284797 |
25-Jun-2015 |
mav |
MFC r284627: Remove some dead and duplicate LUN enabling code. |
284796 |
25-Jun-2015 |
mav |
MFC r284639: Introduce separate lock for tokens to reduce ctl_lock scope. |
284795 |
25-Jun-2015 |
mav |
MFC r284641: Fix REPORT LUNS command output for the case when same LUN mapped to same port several times. While it is unusual configuration, it is not illegal. |
284794 |
25-Jun-2015 |
mav |
MFC r284622: Remove device queue freeze handling and replace it with dummy.
At this point CTL has no known use case for device queue freezes. Same time existing (considered to be broken) code was found to cause modify-after-free issues. |
284793 |
25-Jun-2015 |
mav |
MFC r284541: Change ATIO/INOT counting to prevent periph destruction while requests are still running inside CTL. |
284586 |
19-Jun-2015 |
mav |
MFC r284013: Allow setting only WWNN or only WWPN. |
284158 |
08-Jun-2015 |
mav |
MFC r284044: Fix wrong function name in error message. |
282862 |
13-May-2015 |
mav |
MFC r282565: Handle EDQUOT backend storage errors same as ENOSPC. |
280722 |
27-Mar-2015 |
ken |
MFC revision 280463
------------------------------------------------------------------------ r280463 | ken | 2015-03-24 15:42:28 -0600 (Tue, 24 Mar 2015) | 5 lines
Remove some #if 0'ed code that apparently confuses cscope.
Requested by: Peter Xu <xzpeter@gmail.com> MFC after: 3 days
------------------------------------------------------------------------
Sponsored by: Spectra Logic |
280258 |
19-Mar-2015 |
rwatson |
Merge r263233 from HEAD to stable/10:
Update kernel inclusions of capability.h to use capsicum.h instead; some further refinement is required as some device drivers intended to be portable over FreeBSD versions rely on __FreeBSD_version to decide whether to include capability.h.
Sponsored by: Google, Inc. |
279273 |
25-Feb-2015 |
mav |
MFC r278584: Add support for General Statistics and Performance log page.
CTL already collects most of statistics reported there, so why not. |
279005 |
19-Feb-2015 |
mav |
MFC r278672: Teach CTL to ask GEOM devices about BIO_DELETE support. |
279004 |
19-Feb-2015 |
mav |
MFC r278625: Make XCOPY and WUT commands respect physical block size/offset.
This change by 2-3 times improves performance of misaligned XCOPY and WUT commands by avoiding unneeded read-modify-write cycles inside ZFS. |
279003 |
19-Feb-2015 |
mav |
MFC r278161: Bring some more order into iSCSI portal group tags support.
While ctld(8) still does not allow multiple portal groups per target to be configured, kernel should now be able to handle it.
Sponsored by: iXsystems, Inc. |
279002 |
19-Feb-2015 |
mav |
MFC r278037: CTL LUN mapping rewrite.
Replace iSCSI-specific LUN mapping mechanism with new one, working for any ports. By default all ports are created without LUN mapping, exposing all CTL LUNs as before. But, if needed, LUN mapping can be manually set on per-port basis via ctladm. For its iSCSI ports ctld does it via ioctl(2). The next step will be to teach ctld to work with FibreChannel ports also.
Respecting additional flexibility of the new mechanism, ctl.conf now allows alternative syntax for LUN definition. LUNs can now be defined in global context, and then referenced from targets by unique name, as needed. It allows same LUN to be exposed several times via multiple targets.
While there, increase limit for LUNs per target in ctld from 256 to 1024. Some initiators do not support LUNs above 255, but that is not our problem.
Relnotes: yes Sponsored by: iXsystems, Inc. |
278999 |
19-Feb-2015 |
mav |
MFC r278619: Make WRITE SAME commands respect physical block size.
This change by 2-3 times improves performance of misaligned WRITE SAME commands by avoiding unneeded read-modify-write cycles inside ZFS. |
278906 |
17-Feb-2015 |
mav |
MFC r278500: Do not abort already aborted tasks.
This fixes abort of new tasks with the same tags as previously aborted, but still remaining on the queue. |
278796 |
15-Feb-2015 |
mav |
MFC r277917 (by ken), r278598: Improve SCSI Extended Inquiry VPD page (0x86) support.
sys/cam/scsi/scsi_all.h: In struct scsi_extended_inquiry_data: - Increase the length field to 2 bytes, as it is 2 bytes in SPC-4. - Add bit definitions for the various Activiate Microcode actions. - Add the Sequential Access Logical Block Protection support bit, since we need that in the sa(4) driver. (For modifications that will come later.) - Add definitions for the various Multi I_T Nexus Microcode Download modes.
sys/cam/ctl/ctl.c: As of SPC-4, a single report of "REPORTED LUNS DATA HAS CHANGED" is to be given per I_T nexus. Once it is reported, the unit attention condition should be cleared for all LUNS attached to an I_T nexus.
Previously that only happened when a REPORT LUNS command was processed.
This behavior may be different (according to SAM-5) when the UA_INTLCK_CTRL bits are non-zero in the control mode page but CTL does not currently support that.
So, in view of the spec, whenever we report a LUN inventory change unit attention, clear it on all LUNs for that particular I_T nexus.
Add a new function, ctl_clear_ua() that will clear a unit attention on all LUNs for the given I_T nexus.
One field in the extended inquiry data that we could potentially report at some point is the maximum supported sense data length. To do that, we would the SIM to report (via path inquiry perhaps) how much sense data it is able to send.
Add comments to explain some of the bits that are set in the Extended Inquiry VPD page.
Add a few comments to make it more clear which functions handle various VPD pages. |
277919 |
30-Jan-2015 |
mav |
MFC r277247: Don't count status as sent until CTIO completes successfully.
If we aggregated status sending with data move and got error, allow status to be updated and resent again separately. Without this command may stuck without status sent at all. |
277918 |
30-Jan-2015 |
mav |
MFC r277529: Don't count requests with status sent as overlapping.
While those requests are still in target OOA queue, for initiator they are already completed, so tags can be reused. |
277810 |
27-Jan-2015 |
mav |
MFC r277647: Fix wrong LUN reference in XCOPY block-to-block operation.
This could cause data corruption due to accessing wrong LUN in case of retries on write errors. Failed writes were retried to read LUN. |
276618 |
03-Jan-2015 |
mav |
MFC r274036 (by trasz): s/icl_pdu_new_bhs/icl_pdu_new/; no functional changes, just a little nicer code. |
276617 |
03-Jan-2015 |
mav |
MFC r276141: Hide block device VPD pages for non-block devices. |
276616 |
03-Jan-2015 |
mav |
MFC r275953: Replace ctl_min() macro with MIN(). |
276615 |
03-Jan-2015 |
mav |
MFC r275943: Constify some static data. |
276614 |
03-Jan-2015 |
mav |
MFC r275942: Reduce number of places where global control_softc is used.
At some point we may want to have several CTL instances, and that is not really impossible. |
276613 |
03-Jan-2015 |
mav |
MFC r275864: Make sequence numbers checks more strict.
While we don't support MCS, hole in received sequence numbers may mean only PDU loss. While we don't support lost PDU recovery, terminate the connection to avoid stuck commands.
While there, improve handling of sequence numbers wrap after 2^32 PDUs. |
276237 |
26-Dec-2014 |
mav |
MFC r275920, r276127: Pass real optimal transfer size supported by backend.
For files and ZVOLs that is 1MB now, not 128K. |
276179 |
24-Dec-2014 |
mav |
MFC r275865: Add configuration options to override physical and UNMAP blocks geometry.
While in most cases CTL should correctly fetch those values from backing storages, there are some initiators (like MS SQL), that may not like large physical block sizes, even if they are true. For such cases allow override fetched values with supported ones (like 4K). |
276139 |
23-Dec-2014 |
mav |
MFC r275959: Report initiator id in portlist XML in more formalized way. |
276137 |
23-Dec-2014 |
mav |
MFC r275842: Do not count RCTD bit set as an error.
We can not really implement it, but specification tells that it "shall" work, so it can be safely ignored. |
275895 |
18-Dec-2014 |
mav |
MFC r275568: Count consecutive read requests as blocking in CTL for files and ZVOLs.
Technically read requests can be executed in any order or simultaneously since they are not changing any data. But ZFS prefetcher goes crasy when it receives consecutive requests from different threads. Since prefetcher works on level of separate blocks, instead of two consecutive 128K requests it may receive 32 8K requests in mixed order.
This patch is more workaround then a real fix, and it does not fix all of prefetcher problems, but it improves sequential read speed by 3-4x times in some configurations. On the other side it may hurt performance if some backing store has no prefetch, that is why it is disabled by default for raw devices. |
275894 |
18-Dec-2014 |
mav |
MFC r275512: In addition to r275481 allow threshold notifications work without UNMAP.
While without UNMAP support there is not much initiator can do about it, the administrator still better be notified about the storage overflow.
Sponsored by: iXsystems, Inc. |
275893 |
18-Dec-2014 |
mav |
MFC r275481: Add to CTL support for threshold notifications for file-backed LUNs.
Previously it was supported only for ZVOL-backed LUNs, but now should work for file-backed LUNs too. Used value in this case is a space occupied by the backing file, while available value is an available space on file system. Pool thresholds are still not implemented in this case.
Sponsored by: iXsystems, Inc. |
275892 |
18-Dec-2014 |
mav |
MFC r275474: Add GET LBA STATUS command support to CTL.
It is implemented for LUNs backed by ZVOLs in "dev" mode and files. GEOM has no such API, so for LUNs backed by raw devices all LBAs will be reported as mapped/unknown.
Sponsored by: iXsystems, Inc. |
275891 |
18-Dec-2014 |
mav |
MFC r275461: Increase CTL ports limit from 128 to 256 and LUNs limit from 256 to 1024.
After recent optimizations this change is no longer blocked by CTL memory consumption. Those limits are still not free, but much cheaper now.
Relnotes: yes Sponsored by: iXsystems, Inc. |
275889 |
18-Dec-2014 |
mav |
MFC r275459: Unify function names after r275458. |
275888 |
18-Dec-2014 |
mav |
MFC r275458: Do not pre-allocate UNIT ATTENTIONs storage for every possible initiator.
Abusing ability of major UAs cover minor ones we may not account UAs for inactive ports. Allocate UAs storage for port and start accounting only after some initiator from that port fetched its first POWER ON OCCURRED.
This reduces per-LUN CTL memory usage from >1MB to less then 100K. |
275887 |
18-Dec-2014 |
mav |
MFC r275455: Remove some unused code. |
275886 |
18-Dec-2014 |
mav |
MFC r275447: Do not pre-allocate reservation keys memory for every possible initiator.
In configurations with many ports, like iSCSI, each LUN is typically accessed only by limited subset of ports. Allocating that memory on demand allows to reduce CTL memory usage from 5.3MB/LUN to 1.3MB/LUN. |
275885 |
18-Dec-2014 |
mav |
MFC r275405: Convert persis_offset from global variable to softc field. |
275884 |
18-Dec-2014 |
mav |
MFC r275404: Reduce code duplication by creating ctl_set_res_ua() helper. |
275883 |
18-Dec-2014 |
mav |
MFC r275403: Removed unused variable and unify some names. |
275882 |
18-Dec-2014 |
mav |
MFC r275365: Move ctlfe_onoffline() out of lock to let it sleep when needed.
Do some more other polishing while there. |
275881 |
18-Dec-2014 |
mav |
MFC r275058: Coalesce last data move and command status for read commands.
Make CTL core and block backend set success status before initiating last data move for read commands. Make CAM target and iSCSI frontends detect such condition and send command status together with data. New I/O flag allows to skip duplicate status sending on later fe_done() call.
For Fibre Channel this change saves one of three interrupts per read command, increasing performance from 126K to 160K IOPS. For iSCSI this change saves one of three PDUs per read command, increasing performance from 1M to 1.2M IOPS.
Sponsored by: iXsystems, Inc. |
275880 |
18-Dec-2014 |
mav |
MFC r275032: Decouple datamove/done logic from CTL status set. |
275879 |
18-Dec-2014 |
mav |
MFC r275009: Use ctl_set_success() instead of direct inlining. |
275878 |
18-Dec-2014 |
mav |
MFC r274962: Replace home-grown CTL IO allocator with UMA.
Old allocator created significant lock congestion protecting its lists of preallocated I/Os, while UMA provides much better SMP scalability. The downside of UMA is lack of reliable preallocation, that could guarantee successful allocation in non-sleepable environments. But careful code review shown, that only CAM target frontend really has that requirement. Fix that making that frontend preallocate and statically bind CTL I/O for every ATIO/INOT it preallocates any way. That allows to avoid allocations in hot I/O path. Other frontends either may sleep in allocation context or can properly handle allocation errors.
On 40-core server with 6 ZVOL-backed LUNs and 7 iSCSI client connections this change increases peak performance from ~700K to >1M IOPS! Yay! :)
Sponsored by: iXsystems, Inc. |
275694 |
11-Dec-2014 |
mav |
MFC r275478: Swap resource count scopes for used/available space.
Used count should be reported as per-LUN, while available should not. |
275673 |
10-Dec-2014 |
mav |
MFC r275446: Plug memory leaks on UNMAP and XCOPY with invalid parameters. |
275495 |
05-Dec-2014 |
mav |
MFC r274805: Make cfiscsi_offline() synchronous, waiting for connections termination before return. This should make ctld restart more clean and predictable. |
275494 |
05-Dec-2014 |
mav |
MFC r274795: Close race between cfiscsi_offline() and new connection arrival.
Incoming connection should be either rejected or accepted and terminated. |
275493 |
05-Dec-2014 |
mav |
MFC r274785: Partially reconstruct Active/Standby clusting.
In this mode one head is in Active state, supporting all commands, while another is in Standby state, supporting only minimal LUN discovery subset.
It is still incomplete since Standby state requires reservation support, which is impossible to do right without having interlink between heads. But it allows to run some basic experiments. |
275445 |
03-Dec-2014 |
trasz |
MFC r274703:
Fix typo.
Sponsored by: The FreeBSD Foundation |
275310 |
30-Nov-2014 |
trasz |
MFC r273918:
Change the default log level for iSCSI target from 3 to 1. It should have been 1 from the beginning; not sure how it ended up at 3.
Sponsored by: The FreeBSD Foundation |
275203 |
28-Nov-2014 |
mav |
MFC r274840, r274940: Make iSCSI frontend less chatty while waiting for tasks termination. |
275202 |
28-Nov-2014 |
mav |
MFC r274790: Remove bunch of unused lun variables. |
275201 |
28-Nov-2014 |
mav |
MFC r274789: Reduce race between LUN destruction and request arrival. |
275200 |
28-Nov-2014 |
mav |
MFC r274786: Log errors for absent LUNs too. |
274732 |
20-Nov-2014 |
mav |
MFC r274154, r274163: Add to CTL support for logical block provisioning threshold notifications.
For ZVOL-backed LUNs this allows to inform initiators if storage's used or available spaces get above/below the configured thresholds.
Sponsored by: iXsystems, Inc. |
274562 |
16-Nov-2014 |
mav |
MFC r274333: Handle PREEMPT AND ABORT service action equal to PREEMPT.
With command serialization used in CTL, there are no other commands to abort when PREEMPT AND ABORT gets to run, so it is practically equal to PREEMPT. |
274492 |
14-Nov-2014 |
mav |
MFC r274206: Synchronize medium rotation rate in legacy Rigid Disk Drive Geometry mode page with modern Block Device Characteristics VPD page. |
274389 |
11-Nov-2014 |
mav |
MFC r274081: Fix residual copy/paste in r274080. |
274388 |
11-Nov-2014 |
mav |
MFC r274080: Improve error handling around duplicate lun and port enable.
This fixes kernel panic if port enabled twice and then disabled. |
274387 |
11-Nov-2014 |
mav |
MFC r274253: Fix LUN resize broken by r272911 commit. |
274004 |
03-Nov-2014 |
mav |
MFC r273809: Implement better handling for ENOSPC error for both CTL and CAM.
This makes VMWare VAAI Thin Provisioning Stun primitive activate, pausing the virtual machine, when backing storage (ZFS pool) is getting overflowed. |
274003 |
03-Nov-2014 |
mav |
MFC r273730, r273731: Reduce code duplication around Write Exclusive persistent reservation.
While there, allow some more commands to pass persistent reservation. |
274002 |
03-Nov-2014 |
mav |
MFC r273711: Allocate buffer for READ BUFFER/WRITE BUFFER commands on demand.
These commands are rare, but consume additional 256KB RAM per LUN. |
273982 |
02-Nov-2014 |
mav |
MFC r273708: Fix support for LUN flat space addressing. |
273981 |
02-Nov-2014 |
mav |
MFC r273693: Fix printing non-terminated strings in devlist XML. |
273980 |
02-Nov-2014 |
mav |
MFC r273687: Add "rpm" and "formfactor" LUN options to match istgt functionality. |
273979 |
02-Nov-2014 |
mav |
MFC r273640: Add support for 12/16-byte EUI and 16-byte NAA IDs. |
273978 |
02-Nov-2014 |
mav |
MFC r273075: Remove couple Copan's vendor-specific mode pages.
Those pages are highly system-/hardware-specific, the code is incomplete, and so they hardly can be useful for anybody else. |
273977 |
02-Nov-2014 |
mav |
MFC r273073: Some groundwork for later Informational Exceptions support.
This includes support for: - Read-Write Error Recovery mode page; - Informational Exceptions Control mode page; - Logical Block Provisioning mode page; - LOG SENSE command.
No real Informational Exceptions features yet. This is only a placeholder. |
273532 |
23-Oct-2014 |
mav |
MFC r273259: Make VPD 80h (Serial Number) transfer length match serial number length. |
273531 |
23-Oct-2014 |
mav |
MFC r273163: Implement more functional CTL debug logging.
Setting bits in kern.cam.ctl.debug allows to log errors, commands and some commands data respectively. |
273324 |
20-Oct-2014 |
mav |
MFC r273046: Don't confuse frontend with zero length data moves, just return immediately. |
273323 |
20-Oct-2014 |
mav |
MFC r273038: Add support for READ DEFECT DATA (10/12) commands.
SPC-4 r2 allows to return empty defect list if the list is not supported. We don't reallu support defect data lists, but this suppresses some errors. |
273322 |
20-Oct-2014 |
mav |
MFC r273029: Report physical block size for file-backed LUNs, using vattr.va_blocksize. |
273321 |
20-Oct-2014 |
mav |
MFC r273008: Remove stale comments. |
273320 |
20-Oct-2014 |
mav |
MFC r272978: Improve and document `ctladm portlist` subcommand.
Make this subcommand less FC-specific, reporting target and port addresses in more generic way. Also make it report list of connected initiators in unified way, working for both FC and iSCSI, and potentially others. |
273319 |
20-Oct-2014 |
mav |
MFC r272947: Give physical and virtual ports numbers some more meaning. |
273318 |
20-Oct-2014 |
mav |
MFC r272939: Shorten frontend name. |
273317 |
20-Oct-2014 |
mav |
MFC r272938: Filter out duplicate AC_PATH_REGISTERED async events.
Queued async events handling in CAM opened race, that may lead to duplicate AC_PATH_REGISTERED events delivery during boot. That was not happening before r272935 because the driver was initialized later. After that change it started create duplicate ports in CTL. |
273316 |
20-Oct-2014 |
mav |
MFC r272935: Mark CTL frontend's CAM driver as CAM_PERIPH_DRV_EARLY.
Target mode operation does not depend on the initiator mode scan process. This change allows the target driver to attach earlier and receive some async events (like AC_CONTRACT) that could be lost otherwise. |
273315 |
20-Oct-2014 |
mav |
MFC r272911: Make ctld start even if some LUNs are unable to open backing storage.
Such LUNs will be visible to initiators, but return "not ready" status on media access commands. If backing storage become available later, `ctladm modify ...` or `service ctld reload` can trigger its reopen. |
273314 |
20-Oct-2014 |
mav |
MFC r272893: Store persistent reservation keys as uint64_t instead of uint8_t[8].
This allows to simplify the code and save 512KB of RAM per LUN (8%) by removing no longer needed "registered" keys flags. |
273313 |
20-Oct-2014 |
mav |
MFC r272812: Make iSCSI connection close somewhat less aggressive.
It allows to push out some final data from the send queue to the socket before its close. In particular, it increases chances for logout response to be delivered to the initiator. |
273312 |
20-Oct-2014 |
mav |
MFC r272748: Implement software (mode page) and hardware (config) write protection. |
273311 |
20-Oct-2014 |
mav |
MFC r272734: Add support for WRITE ATOMIC (16) command and report SBC-4 compliance.
Atomic writes are only supported for ZVOLs in "dev" mode. In other cases atomicity can not be guarantied and so the command is blocked. |
273310 |
20-Oct-2014 |
mav |
MFC r272613: Add support for MaxBurstLength and Expected Data transfer Length parameters.
Before this change target could send R2T request for write transfer of any size, that could violate iSCSI RFC, which allows initiator to limit maximum R2T size by negotiating MaxBurstLength connection parameter.
Also report an error in case of write underflow, when initiator provides less data than initiator expects. Previously in such case our target sent R2T request for non-existing data, violating the RFC, and confusing some initiators. SCSI specs don't explicitly define how write underflows should be handled and there are different oppinions, but reporting error is hopefully better then violating iSCSI RFC with unpredictable results. |
273309 |
20-Oct-2014 |
mav |
MFC r272597: Fix length of Extended INQUIRY Data VPD page. |
273307 |
20-Oct-2014 |
mav |
MFC r271395 (by trasz): Make sure we handle less than zero timeouts in iSCSI initiator and target in a reasonable way.
Sponsored by: The FreeBSD Foundation |
272798 |
09-Oct-2014 |
mav |
MFC r272650: Set CAM_SIM_QUEUED flag before calling ctl_queue() to avoid race.
PR: 194128 Submitted by: Scott M. Ferris <smferris@gmail.com> Sponsored by: EMC/Isilon Storage Division |
272647 |
06-Oct-2014 |
mav |
MFC r272355: Fix couple issues with ROD tokens content. |
272646 |
06-Oct-2014 |
mav |
MFC r272247: Do not transfer unneeded training zero bytes in INQUIRY response.
It is an addition to r269631. |
272644 |
06-Oct-2014 |
mav |
MFC r272224: Fix page length reported for Block Limits VPD page. |
272643 |
06-Oct-2014 |
mav |
MFC r272033: Fix ASCQ for "Logical unit not ready, manual intervention required" error. |
272642 |
06-Oct-2014 |
mav |
MFC r271959: Pretend that we support BYTCHK=1 in WRITE AND VERIFY command.
Technically that is not true, but since we don't implement VERIFY there at all, doing only WRITE part, this is a minor sin. |
272641 |
06-Oct-2014 |
mav |
MFC r271954: Deny ANCHOR flag set without UNMAP flag set in WRITE SAME commands. |
272640 |
06-Oct-2014 |
mav |
MFC r271951: Don't try to continue aborted commands if status was not set. |
272639 |
06-Oct-2014 |
mav |
MFC r271945: Simplify legacy reservation handling. Drop it on I_T nexus loss. |
272638 |
06-Oct-2014 |
mav |
MFC r271942: Don't report unsupported FUA_NV bit set in READ/WRITE commands as error.
While this bit is obsolete in SBC-3, SBC-2 allowed to silently ignore it. |
272637 |
06-Oct-2014 |
mav |
MFC r271941: Report proper errors codes for unsupported SERVICE ACTION values. |
272636 |
06-Oct-2014 |
mav |
MFC r271940: Polish INQUIRY command fields validation. |
272635 |
06-Oct-2014 |
mav |
MFC r271930: Allow SUBPAGE CODE field in MODE SENSE commands. |
272634 |
06-Oct-2014 |
mav |
MFC r271869: Fix inverted expression to report block size in mode page block descriptor. |
272633 |
06-Oct-2014 |
mav |
MFC r271845: Allow more commands to pass persistent reservation according to SPC-4 r37. |
272632 |
06-Oct-2014 |
mav |
MFC r271839: Add support for "no Data-Out Buffer" (NDOB) flag of WRITE SAME (16) command. |
272631 |
06-Oct-2014 |
mav |
MFC r271606: Always report that we support REPORT TARGET PORT GROUPS command.
Without clustering support we any way have only one group of permanently active ports, but that gives us one more supported VMWare feature. ;)
Solaris' Comstar also reports it even when only one port is present. |
272630 |
06-Oct-2014 |
mav |
MFC r271507: Implement control over command reordering via options and control mode page.
It allows to bypass range checks between UNMAP and READ/WRITE commands, which may introduce additional delays while waiting for UNMAP parameters. READ and WRITE commands are always processed in safe order since their range checks are almost free. |
272629 |
06-Oct-2014 |
mav |
MFC r271505: Add "readcache" and "writecache" LUN options to control default behavior.
Default values are "on". Disabling requires backend to support IO_DIRECT and IO_SYNC flags respectively, or some alternatives. |
272626 |
06-Oct-2014 |
mav |
MFC r271503: Implement range checks between UNMAP and READ/WRITE commands.
Before this change UNMAP completely blocked other I/Os while running. Now it blocks only colliding ones, slowing down others only due to ZFS locks collisions.
Sponsored by: iXsystems, Inc. |
272625 |
06-Oct-2014 |
mav |
MFC r271443: Add support for Extended INQUIRY Data (0x86) VPD page. |
272623 |
06-Oct-2014 |
mav |
MFC r271360: Remove uninitialized and unused variable, reported by Coverity. |
272622 |
06-Oct-2014 |
mav |
MFC r271358: Fix array overrun, reported by Coverity. |
272621 |
06-Oct-2014 |
mav |
MFC r271354: Fix couple off-by-one range check errors, reported by Coverity. |
272620 |
06-Oct-2014 |
mav |
MFC r271353: Fix memory leak on error, reported by Coverity. |
272619 |
06-Oct-2014 |
mav |
MFC r271352: Fix minor buffer overflow reported by Coverity. |
272618 |
06-Oct-2014 |
mav |
MFC r271316: Report that DPO and FUA bits are supported after r271311. |
272617 |
06-Oct-2014 |
mav |
MFC r271311: Add support for Mode Page Policy (0x87) VPD page. |
272616 |
06-Oct-2014 |
mav |
MFC r271309: Improve cache control support, including DPO/FUA flags and the mode page.
At this moment it works only for files and ZVOLs in device mode since BIOs have no respective respective cache control flags (DPO/FUA). |
272203 |
27-Sep-2014 |
mav |
MFC r272040: When reporting some major UNIT ATTENTION condition, like POWER ON OCCURRED or I_T NEXUS LOSS, clear all minor UAs for the LUN, redundant in this case.
All SAM specifications tell that target MAY do it, but libiscsi initiator seems require it to be done, terminating connection with error if some more UAs happen to be reported during iSCSI connection.
Approved by: re (gjb) |
272101 |
25-Sep-2014 |
mav |
MFC r271957: Fix read overrun handling, broken by using wrong variable.
Approved by: re (marius) |
272100 |
25-Sep-2014 |
mav |
MFC r271949: Fix UNMAP stuck if the last block descriptor in the list is empty.
Approved by: re (glebius) |
271928 |
21-Sep-2014 |
mav |
MFC r271794: When updating device media size use cached cdevsw pointer.
Using pointer from the cdev directly is dangerous since we have no reference on it, and it may change any time. That caused panic if device has gone.
While there, report capacity change only if it really changed.
Approved by: re (dephij) |
271904 |
20-Sep-2014 |
mav |
MFC r271702: Fix tpc_create_token() introduced in r269497 to encode CREATOR LOGICAL UNIT DESCRIPTOR field as Identification Descriptor CSCD descriptor, not just as Identification Descriptor.
Approved by: re (gjb) |
271618 |
15-Sep-2014 |
trasz |
MFC r271393:
Make it possible to disable NOP-In PDUs by the iSCSI initiator by setting kern.cam.ctl.iscsi.ping_timeout to 0. This fixes interoperability with some initiators that don't properly support NOP-Ins, namely iPXE/gPXE.
Approved by: re (kib) |
271529 |
13-Sep-2014 |
mav |
MFC r271362: Make ctl_port_mask an array to support more then 32 ports.
Overflow reported by Coverity.
CID: 1229894
Approved by: re (marius) |
270891 |
31-Aug-2014 |
trasz |
MFC r270282:
Use proper include paths in kernel iSCSI code.
Sponsored by: The FreeBSD Foundation |
270389 |
23-Aug-2014 |
mav |
MFC r270176: Fix lock recursion on LUN shutdown, introduced on r269497. |
270109 |
17-Aug-2014 |
mav |
MFC r269631: Reduce reported additional INQUIRY data length.
sizeof(struct scsi_inquiry_data) of 256 bytes combined with off-by-one error in the changed code gave total INQUIRY data length above 255 bytes, that was maximal INQUIRY length in SPC-2. While SPC-3 increased the maximal length to 64K, at least sg3_utils are still confused by that. |
270108 |
17-Aug-2014 |
mav |
MFC r269622: Fix several issues and inconsistencies in UNMAP capabilities reporting.
This makes Windows 2012 to start using UNMAP on our disks. |
270107 |
17-Aug-2014 |
mav |
MFC r269587: Reimplement WRITE USING TOKEN with Block Zero token using WRITE SAME.
On my ZVOL of SSDs that increases speed of zero writing in that way from 1 to 2.5GB/s by reducing CPU overhead. |
270106 |
17-Aug-2014 |
mav |
MFC r269497: Add support for Windows dialect of EXTENDED COPY command, aka Microsoft ODX.
This allows to avoid extra network traffic when copying files on NTFS iSCSI disks within one storage host by drag'n'dropping them in Windows Explorer of Windows 8/2012. It should also accelerate Hyper-V VM operations, etc. |
269574 |
05-Aug-2014 |
mav |
MFC r269444, r269450: Plug EXTENDED COPY request data memory leak. |
269572 |
05-Aug-2014 |
mav |
MFC r269442: Fix some bugs in RECEIVE COPY STATUS data. |
269570 |
05-Aug-2014 |
mav |
MFC r269441: Add missing comparisons to make list IDs in EXTENDED COPY per-initiator, as they should be. Wrap it into a function to not duplicate the code. |
269429 |
02-Aug-2014 |
mav |
MFC r269123: Implement separate I/O dispatch method for ZVOLs in "dev" mode.
Unlike disk devices ZVOLs process all requests synchronously. That makes impossible sending multiple requests to them from single thread. From the other side ZVOLs have real d_read/d_write methods, which unlike d_strategy can handle uio scatter/gather and have no strict I/O size limitations.
So, if ZVOL in "dev" mode is detected, use of d_read/d_write methods instead of d_strategy allows to avoid pointless splitting of large requests into MAXPHYS (128K) sized chunks. |
269298 |
30-Jul-2014 |
mav |
MFC r268808: Increase maximal number of SCSI ports in CTL from 32 to 128.
After I gave each iSCSI target its own port, the old limit appeared to be not so big. This change almost proportionally increases per-LUN memory use, but it is still three times better then it was before r268807. |
269297 |
30-Jul-2014 |
mav |
MFC r268807: Reduce per-LUN memory usage from 18MB to 1.8MB.
CTL never had use for CA support code since SPI has gone, and there is no even frontends supporting that. But it still was reserving 256 bytes of memory per LUN per every possible initiator on every possible port.
Wrap unused code with ifdef's in case somebody ever need it. |
269296 |
30-Jul-2014 |
mav |
MFC r268767: Add support for VMWare dialect of EXTENDED COPY command, aka VAAI Clone.
This allows to clone VMs and move them between LUNs inside one storage host without generating extra network traffic to the initiator and back, and without being limited by network bandwidth.
LUNs participating in copy operation should have UNIQUE NAA or EUI IDs set. For LUNs without these IDs VMWare will use traditional copy operations.
Beware: the above LUN IDs explicitly set to values non-unique from the VM cluster point of view may cause data corruption if wrong LUN is addressed!
Sponsored by: iXsystems, Inc. |
269295 |
30-Jul-2014 |
mav |
MFC r268581: Merge several equal serialization indexes. |
269294 |
30-Jul-2014 |
mav |
MFC r269149: Fix several cases of NULL dereference when INQUIRY sent to absent LUN. |
269226 |
29-Jul-2014 |
mav |
MFC r269122: Fix infinite loop, when doing WRITE SAME on file-backed LUN. |
269202 |
28-Jul-2014 |
trasz |
MFC r269088:
Fix ctl(4) kldload failure that manifested like this:
link_elf_obj: symbol icl_pdu_new_bhs undefined
PR: 192031 Submitted by: Nils Beyer (earlier version) Sponsored by: FreeBSD Foundation |
269151 |
27-Jul-2014 |
mav |
MFC r269058: Fix build with QUEUE_MACRO_DEBUG. |
268699 |
15-Jul-2014 |
mav |
MFC r268447: Add LUN options to specify 64-bit EUI and NAA identifiers. |
268698 |
15-Jul-2014 |
mav |
MFC r268421: Remove status setting from datamove() path. Leave that to other places. |
268697 |
15-Jul-2014 |
mav |
MFC r268418: Enable TAS feature: notify initiator if its command was aborted by other.
That should make operation more kind to multi-initiator environment. Without this, other initiators may find out that something bad happened to their commands only via command timeout. |
268696 |
15-Jul-2014 |
mav |
MFC r268387: Fix task management functions status: task not found is not an error, while not implemented function is. |
268695 |
15-Jul-2014 |
mav |
MFC r268364: Fix "use after free" on port creation error in r268291. |
268694 |
15-Jul-2014 |
mav |
MFC r268363: Add support for READ FULL STATUS action of PERSISTENT RESERVE IN command. |
268692 |
15-Jul-2014 |
mav |
MFC r268362: Teach ctl_add_initiator() to dynamically allocate IIDs from pool.
If port passed negative IID value, the function will try to allocate IID from the pool of unused, based on passed wwpn or name arguments. It does all its best to make IID unique and persistent across reconnects.
This makes persistent reservation properly work for iSCSI. Previously, in case of reconnects, reservation could be unexpectedly lost, or even migrate between intiators. |
268691 |
15-Jul-2014 |
mav |
MFC r268356, r268357: When new connection comes in, check whether we already have session from the same intiator (Name+ISID). If so -- terminate the old session and let the new one take its place, as required by iSCSI RFC. |
268690 |
15-Jul-2014 |
mav |
MFC r268353: Implement ABORT TASK SET and I_T NEXUS RESET task management functions.
Use the last one to terminate active commands on iSCSI session termination. Previous code was aborting only commands doing some data moves. |
268689 |
15-Jul-2014 |
mav |
MFC r268330: Make gcc happy, init idlen2. |
268688 |
15-Jul-2014 |
mav |
MFC r268328: Close race in r268291 between port destruction, delayed by sessions teardown, and new port creation during `service ctld restart`.
Close it by returning iSCSI port internal state, that allows to identify dying ports, which should not be counted as existing, from really alive. |
268687 |
15-Jul-2014 |
mav |
MFC r268309: Add support for SCSI Ports (88h) VPD page. |
268686 |
15-Jul-2014 |
mav |
MFC r268308: Make REPORT TARGET PORT GROUPS command report realistic data instead of hardcoded garbage. |
268685 |
15-Jul-2014 |
mav |
MFC r268307: Move lun_map() method from command nexus to port.
Previous implementation made impossible to do some things, such as calling it for ports other then one through which command arrived. |
268684 |
15-Jul-2014 |
mav |
MFC r268302: Pass through iSCSI session ISID from LOGIN request to the CTL frontend.
ISID is an important part of initiator transport ID for iSCSI. It is not used now, but should be to properly implement persistent reservation. |
268683 |
15-Jul-2014 |
mav |
MFC r268293: Burry devid port method, which was a gross hack.
Instead make ports provide wanted port and target IDs, and LUNs provide wanted LUN IDs. After that core Device ID VPD code only had to link all of them together and add relative port and port group numbers.
LUN ID for iSCSI LUNs no longer created by CTL, but by ctld, and passed to CTL as "scsiname" LUN option. This makes LUNs to report the same set of IDs, independently from the port through which it is accessed, as required by SCSI specifications. |
268682 |
15-Jul-2014 |
mav |
MFC r268291: Create separate CTL port for every iSCSI target (and maybe portal group).
Having single port for all iSCSI connections makes problematic implementing some more advanced SCSI functionality in CTL, that require proper ports enumeration and identification.
This change extends CTL iSCSI API, making ctld daemon to control list of iSCSI ports in CTL. When new target is defined in config fine, ctld will create respective port in CTL. When target is removed -- port will be also removed after all active commands through that port properly aborted. This change require ctld to be rebuilt to match the kernel.
As a minor side effect, this allows to have iSCSI targets without LUNs. While that may look odd and not very useful, that is not incorrect. |
268681 |
15-Jul-2014 |
mav |
MFC r268288: Improve CTL_BEARG_* flags support, including optional values copyout. |
268680 |
15-Jul-2014 |
mav |
MFC r268287: Implement and use ctl_frontend_find(). |
268679 |
15-Jul-2014 |
mav |
MFC r268284: Introduce new IOCTL CTL_PORT_LIST reporting in more flexible XML format.
Leave old CTL_GET_PORT_LIST in place so far. Garbage-collect it later. |
268678 |
15-Jul-2014 |
mav |
MFC r268280: Make options KPI more generic to allow it to be used for ports too, not only for LUNs. |
268677 |
15-Jul-2014 |
mav |
MFC r268266, r268275: Separate concepts of frontend and port.
Before iSCSI implementation CTL had no knowledge about frontend drivers, it had only frontends, which really were ports (alike to LUNs, if comparing to backends). But iSCSI added there ioctl() method, which does not belong to frontend as a port, but belongs to a frontend driver. |
268676 |
15-Jul-2014 |
mav |
MFC r268265: Remove targ_enable()/targ_disable() frontend methods.
Those methods were never implemented, and I believe that their concept is wrong, since single frontend (SCSI port) can not handle several targets. |
268675 |
15-Jul-2014 |
mav |
MFC r268103: Add support for REPORT TIMESTAMP command. |
268674 |
15-Jul-2014 |
mav |
MFC r268096, r268306, r268361: Add more formal and strict command parsing and validation.
For every supported command define CDB length and mask of bits that are allowed to be set. This allows to remove bunch of checks through the code and still make the validation more strict. To properly do it for commands supporting multiple service actions, formalize their parsing by adding subtables for each of such commands.
As visible effect, this change allows to add support for REPORT SUPPORTED OPERATION CODES command, reporting to client all the data about supported SCSI commands, except timeouts. |
268673 |
15-Jul-2014 |
mav |
MFC r267639: Increase CTL_DEVID_LEN from 16 to 64 bytes.
SPC-4 recommends T10 vendor ID based LUN ID was created by concatenating product name and serial number (and istgt follows that). But product name is 16 bytes long by itself, so 16 bytes total length is clearly not enough to fit both.
To keep compatibility with existing configurations, pad short device IDs to old length of 16, same as before.
This change probably breaks CTL user-level ABI, so control tools should be rebuilt after this change. |
268556 |
12-Jul-2014 |
mav |
MFC r267643, r267873, r268391, r268398: Introduce fine-grained CTL locking to improve SMP scalability.
Split global ctl_lock, historically protecting most of CTL context: - remaining ctl_lock now protects lists of fronends and backends; - per-LUN lun_lock(s) protect LUN-specific information; - per-thread queue_lock(s) protect request queues. This allows to radically reduce congestion on ctl_lock.
Create multiple worker threads, depending on number of CPUs, and assign each LUN to one of them. This allows to spread load between multiple CPUs, still avoiging congestion on queues and LUNs locks.
On 40-core server, exporting 5 LUNs, each backed by gstripe of SATA SSDs, accessed via 6 iSCSI connections, this change improves peak request rate from 250K to 680K IOPS.
Sponsored by: iXsystems, Inc. |
268555 |
12-Jul-2014 |
mav |
MFC r268283: Improve readability of XML generated by CTL_LUN_LIST. |
268554 |
12-Jul-2014 |
mav |
MFC r268392: Do not return statuses for aborted iSCSI commands. |
268553 |
12-Jul-2014 |
mav |
MFC r268204: Use separate memory type M_CTLIO for I/Os.
CTL allocate large amount of RAM. This change give some more stats. |
268552 |
12-Jul-2014 |
mav |
MFC r267933: Simplify statistics calculation.
Instead of trying to guess size of disk I/O operations (it just won't work that way for newly added commands, and is equal to data move size for old ones), account data move traffic. If disk I/Os are that interesting, then backends have to account and provide that information.
Block backend already exports the information about disk I/Os via devstat, so having it here too is excessive. |
268551 |
12-Jul-2014 |
mav |
MFC r267906: Allow MODE SENSE commands through Write Exclusive persistent reservation, as required by SPC-4.
Report that fact in persistent reservation capabilities. |
268550 |
12-Jul-2014 |
mav |
MFC r267905: Add READ BUFFER and improve WRITE BUFFER SCSI commands support.
This gives some use to 512KB per-LUN buffers, allocated for Copan-specific processor code and not used. It allows, for example, to test transport performance and/or correctness without accessing the media, as supported by Linux version of sg3_utils. |
268549 |
12-Jul-2014 |
mav |
MFC r267877: Lock devstat updates in block backend to make it usable. Polish lock names. |
268546 |
12-Jul-2014 |
mav |
MFC r268419: Fix use-after-free on XPT_RESET_BUS.
That command is not queued, so does not use later status update. |
268545 |
12-Jul-2014 |
mav |
MFC r267986: Remove odd practice of inverting error codes.
-EPERM is equal to ERESTART, returning which from ioctl() handler causes infinite syscall restart. |
268261 |
04-Jul-2014 |
mav |
MFC r267641: Add some more CTL_FLAG_ABORT check points.
This should allow to abort commands doing mostly disk I/O, such as VERIFY or WRITE SAME. Before this change CTL_FLAG_ABORT was only checked around data moves, which for these commands may not happen for a very long time. |
268260 |
04-Jul-2014 |
mav |
MFC r267637: Add iSCSI Target Name ID descriptor to VPD 83h.
It shall/should be there according to SPC-4, and istgt also provides it. |
268259 |
04-Jul-2014 |
mav |
MFC r267610 (by trasz): Rework session termination in iSCSI target to actually wait for any outstanding commands to be properly aborted by CTL. Without it, in some cases (such as files backing the LUNs stored on failing disk drives), terminating a busy session would result in panic. |
268258 |
04-Jul-2014 |
mav |
MFC r267574 (by trasz): Make cs_terminating a bool; no functional changes. |
268257 |
04-Jul-2014 |
mav |
MFC r267547, r267551 (by trasz): Add LUN-associated name to VPD, to make Hyper-V Failover Cluster happy. |
268151 |
02-Jul-2014 |
mav |
MFC r267537: Add support for VERIFY(10/12/16) and COMPARE AND WRITE SCSI commands.
Make data_submit backends method support not only read and write requests, but also two new ones: verify and compare. Verify just checks readability of the data in specified location without transferring them outside. Compare reads the specified data and compares them to received data, returning error if they are different.
VERIFY(10/12/16) commands request either verify or compare from backend, depending on BYTCHK CDB field. COMPARE AND WRITE command executed in two stages: first it requests compare, and then, if succeesed, requests write. Atomicity of operation is guarantied by CTL request ordering code.
Sponsored by: iXsystems, Inc. |
268150 |
02-Jul-2014 |
mav |
MFC r267519: Make backends track completion by processed number of sectors instead of total transfer size.
Commands such as VERIFY or COMPARE AND WRITE may have transfer size not matching directly to number of sectors. |
268149 |
02-Jul-2014 |
mav |
MFC r267515: Remove memcpy() from ctl_private[] accesses.
That union is aligned enough to access data directly. |
268148 |
02-Jul-2014 |
mav |
MFC r267514: Move kern_total_len setting from backend to core code. |
268147 |
02-Jul-2014 |
mav |
MFC r267500: Format Portal Group Tag same as istgt does -- %4.4x instead of %x.
SPC-4 spec tells it should be "two or more hexadecimal digits". RFC3720 tells it is 16-bit value. |
268146 |
02-Jul-2014 |
mav |
MFC r267499: Remove custom processing for "file" option. |
268145 |
02-Jul-2014 |
mav |
MFC r267496, r267498: Add "vendor", "product" and "revision" options to control inquiry data. |
268144 |
02-Jul-2014 |
mav |
MFC r267485: Remove non-functional remnants of control LUN -- 18MB of RAM for nothing. |
268143 |
02-Jul-2014 |
mav |
MFC r267481, r267952: Implement small KPI to access LUN options instead doing it by hands. |
268142 |
02-Jul-2014 |
mav |
MFC r265323 (by trasz): Provide better descriptions for 'struct ctl_scsiio' fields; based mostly on emails from ken@. |
268141 |
02-Jul-2014 |
mav |
MFC r267872: Allow to use iSCSI immediate data by several ctl_datamove() calls.
While for FreeBSD client that is only a minor optimization, VMWare client doesn't support additional data requests after all data being sent once as immediate. |
267754 |
22-Jun-2014 |
mav |
MFC r267429: Fix some leaks on LUN creation error. |
265642 |
08-May-2014 |
mav |
MFC r264886: Remove limits on size of READ/WRITE operations.
Instead of allocating up to 16MB or RAM at once to handle whole I/O, allocate up to 1MB at a time, but do multiple ctl_datamove() and storage I/Os if needed. |
265641 |
08-May-2014 |
mav |
MFC r264884: Make CAM target CTL frontend respect SIM I/O size limitations.
If datamove size is bigger then SIM can handle, or it has more segments then this code can handle -- split it into several CTIO requests. |
265640 |
08-May-2014 |
mav |
MFC r264880 (by trasz): Modify CTL iSCSI frontend to properly handle situations where datamove routine is called multiple times per SCSI task. |
265637 |
08-May-2014 |
mav |
MFC r264407: Join CTL worker threads into one process for convenience. Report their idle state as "-". |
265634 |
08-May-2014 |
mav |
MFC r264274, r264279, r264283, r264296, r264297: Add support for SCSI UNMAP commands to CTL.
This patch adds support for three new SCSI commands: UNMAP, WRITE SAME(10) and WRITE SAME(16). WRITE SAME commands support both normal write mode and UNMAP flag. To properly report UNMAP capabilities this patch also adds support for reporting two new VPD pages: Block limits and Logical Block Provisioning.
UNMAP support can be enabled per-LUN by adding "-o unmap=on" to `ctladm create` command line or "option unmap on" to lun sections of /etc/ctl.conf.
At this moment UNMAP supported for ramdisks and device-backed block LUNs. It was tested to work great with ZFS ZVOLs. For file-backed LUNs UNMAP support is unfortunately missing due to absence of respective VFS KPI.
Sponsored by: iXsystems, Inc |
265513 |
07-May-2014 |
trasz |
MFC r264530:
Properly pass the initiator address when running in proxy mode.
Sponsored by: The FreeBSD Foundation |
265510 |
07-May-2014 |
trasz |
MFC r264527:
Make it possible to interrupt login when running in proxy mode.
Sponsored by: The FreeBSD Foundation |
265509 |
07-May-2014 |
trasz |
MFC r264526:
Properly identify target portal when running in proxy mode. While here, remove CTL_ISCSI_CLOSE, it wasn't used or implemented anyway.
Sponsored by: The FreeBSD Foundation |
265508 |
07-May-2014 |
trasz |
MFC r264525:
Add some stuff to make it easier to figure out for the system administrator whether the ICL_KERNEL_PROXY stuff got compiled in correctly.
Sponsored by: The FreeBSD Foundation |
265507 |
07-May-2014 |
trasz |
MFC r264524:
Make it possible for the iSCSI target side to operate in both normal and ICL_KERNEL_PROXY mode, and fix some bit rot so the latter actually works again.
Sponsored by: The FreeBSD Foundation |
265505 |
07-May-2014 |
trasz |
MFC r263740:
Use a less unusual syntax in debug printfs.
Sponsored by: The FreeBSD Foundation |
265504 |
07-May-2014 |
trasz |
MFC r264264 by mav@:
Wakeup only one thread of added in r263978i at a time.
This slightly reduces lock congestion between threads. |
265501 |
07-May-2014 |
trasz |
MFC r264110:
All the iSCSI sysctls are also tunables; advertise that.
Sponsored by: The FreeBSD Foundation |
265497 |
07-May-2014 |
trasz |
MFC r264024:
Use atomic ops instead of mutexes where appropriate.
Submitted by: mav@ Sponsored by: The FreeBSD Foundation |
265496 |
07-May-2014 |
trasz |
MFC r264023:
Instead of "icltx" and "iclrx", use thread names with prefix from upper layer, so that one can see which side of the stack the threads are for.
Sponsored by: The FreeBSD Foundation |
265495 |
07-May-2014 |
trasz |
MFC r264022:
Get rid of ICL lock; use upper-layer (initiator or target) lock instead. This avoids extra locking in icl_pdu_queue(); the upper layer needs to call it while holding its own lock anyway, to avoid sending PDUs out of order.
Sponsored by: The FreeBSD Foundation |
265494 |
07-May-2014 |
trasz |
MFC r264020:
Remove the homegrown ctl_be_block_io allocator, replacing it with UMA. There is no performance difference.
Reviewed by: mav@ Sponsored by: The FreeBSD Foundation |
265493 |
07-May-2014 |
trasz |
MFC r263979:
Hide CTL messages about SCSI error responses. Too many users take them for actual target errors. They can be enabled back by setting kern.cam.ctl.verbose=1, or booting with bootverbose.
Sponsored by: The FreeBSD Foundation |
265492 |
07-May-2014 |
trasz |
MFC r263978:
Make it possible to have multiple CTL worker threads. Leave the default of 1 for now.
Sponsored by: The FreeBSD Foundation |
265491 |
07-May-2014 |
trasz |
MFC r263811:
Remove ctl_mem_pool.{c,h}.
Sponsored by: The FreeBSD Foundation |
265490 |
07-May-2014 |
trasz |
MFC r263810:
Rework cfiscsi_datamove_in() to obey expected data transfer length received from the initiator.
Sponsored by: The FreeBSD Foundation |
265489 |
07-May-2014 |
trasz |
MFC r263745:
Target Transfer Tag is opaque; no need to htonl(3) it.
Sponsored by: The FreeBSD Foundation |
264727 |
21-Apr-2014 |
mav |
MFC r264191: Report stripe size and offset of the backing device in READ CAPACITY (16) as physical sector size and offset. |
264602 |
17-Apr-2014 |
trasz |
MFC r262837:
Make reset handling in iSCSI target RFC-compliant. This fixes some rare hangs with Open-iSCSI (Linux).
Sponsored by: The FreeBSD Foundation |
264523 |
16-Apr-2014 |
mav |
MFC r264307: Fix three refcounter leaks and lock recursion they covered. |
263735 |
25-Mar-2014 |
trasz |
MFC 262782:
Fix missing unlock in persistent reservations code, which resulted in panics with Hyper-V Failover Cluster.
Sponsored by: The FreeBSD Foundation |
262299 |
21-Feb-2014 |
mav |
MFC r261538: Make CTL block backend return proper error code for operations unsupposed by the underlying device. |
260817 |
17-Jan-2014 |
avg |
MFC r258622: dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINE |
260477 |
09-Jan-2014 |
mav |
MFC r257946: Introduce seperate mutex lock to protect protect CTL I/O pools, slightly reducing global CTL lock scope and congestion.
While there, simplify CTL I/O pools KPI, hiding implementation details. |
260476 |
09-Jan-2014 |
mav |
MFC r256995: Remove 128KB bzero() call done for every block I/O data buffer. |
260387 |
07-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 |
259304 |
13-Dec-2013 |
trasz |
MFC r258871:
Properly report an error instead of panicing when user tries to create LUN backed by non-disk device, e.g. /dev/null.
Sponsored by: The FreeBSD Foundation |
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
|
256201 |
09-Oct-2013 |
trasz |
Remove no longer useful debugging output and a stale comment.
Approved by: re (gjb) Sponsored by: FreeBSD Foundation
|
256197 |
09-Oct-2013 |
trasz |
Make the error handling more consistant. Shouldn't make any functional difference.
Approved by: re (gjb) Sponsored by: FreeBSD Foundation
|
256195 |
09-Oct-2013 |
trasz |
Tidy up, cache return value of a function, and add an assertion; shouldn't make any functional difference.
Approved by: re (gjb) Sponsored by: FreeBSD Foundation
|
256187 |
09-Oct-2013 |
trasz |
Fix NOP-In/NOP-Out payload handling. Previous way didn't work at all; fortunately nothing seems to actually use this feature, but it's required by standard.
Approved by: re (glebius) Sponsored by: FreeBSD Foundation
|
256163 |
08-Oct-2013 |
trasz |
Properly fix out of memory handling in the iSCSI target.
Approved by: re (glebius) Sponsored by: FreeBSD Foundation
|
256065 |
05-Oct-2013 |
trasz |
Split cfiscsi_datamove() in two; no functional changes.
Approved by: re (glebius) Sponsored by: FreeBSD Foundation
|
256058 |
04-Oct-2013 |
trasz |
Don't leak memory when removing an unconnected session, and remove useless UMA_ZONE_NOFREE that caused another leak when unloading the module.
Approved by: re (glebius) Sponsored by: FreeBSD Foundation
|
255848 |
24-Sep-2013 |
trasz |
Properly ignore PDUs with CmdSN outside of allowed range.
Approved by: re (glebius) Sponsored by: FreeBSD Foundation
|
255837 |
24-Sep-2013 |
trasz |
Fix a few instances of M_WAITOK in threads marked as prohibited from sleep, missed in r255824.
Approved by: re (kib) Sponsored by: FreeBSD Foundation
|
255824 |
23-Sep-2013 |
trasz |
Don't use M_WAITOK when running from context where sleeping is prohibited, such as callout or a geom thread.
Approved by: re (marius) Sponsored by: FreeBSD Foundation
|
255739 |
20-Sep-2013 |
trasz |
Add some spare fields to structs used by the new iSCSI stack - some just in case, some for future MC/S support.
This requires kernel and world rebuild.
Approved by: re (blanket) Sponsored by: FreeBSD Foundation
|
255570 |
14-Sep-2013 |
trasz |
Bring in the new iSCSI target and initiator.
Reviewed by: ken (parts) Approved by: re (delphij) Sponsored by: FreeBSD Foundation
|
255117 |
01-Sep-2013 |
mav |
Fix the build with CTLFEDEBUG, broken by unmapped I/O support changes.
|
254759 |
24-Aug-2013 |
trasz |
CTL changes required for iSCSI target, most notably LUN remapping and a mechanism to allow CTL frontends for retrieving LUN options.
Reviewed by: ken (earlier version)
|
254378 |
15-Aug-2013 |
trasz |
Turn comments about locking into actual lock assertions.
Reviewed by: ken Tested by: ken MFC after: 1 month
|
253987 |
06-Aug-2013 |
trasz |
Remove dead code.
|
252569 |
03-Jul-2013 |
mav |
Fix NULL-deference kernel panic on attempt of destroying non-existing ramdisk-backed CTL LUN.
|
250460 |
10-May-2013 |
eadler |
Fxi a bunch of typos.
PR: misc/174625 Submitted by: Jeremy Chadwick <jdc@koitsu.org>
|
250131 |
01-May-2013 |
eadler |
Correct a few sizeof()s
Submitted by: swildner@DragonFlyBSD.org Reviewed by: alfred
|
249468 |
14-Apr-2013 |
mav |
MFprojects/camlock r248982: Stop abusing xpt_periph in random plases that really have no periph related to CCB, for example, bus scanning. NULL value is fine in such cases and it is correctly logged in debug messages as "noperiph". If at some point we need some real XPT periphs (alike to pmpX now), quite likely they will be per-bus, and not a single global instance as xpt_periph now.
|
249466 |
14-Apr-2013 |
mav |
MFprojects/camlock r248890, r248897, r248898, r248900, r248903, r248905, r248917, r248918, r248978, r249001, r249014, r249030:
Remove multilevel freezing mechanism, implemented to handle specifics of the ATA/SATA error recovery, when post-reset recovery commands should be allocated when queues are already full of payload requests. Instead of removing frozen CCBs with specified range of priorities from the queue to provide free openings, use simple hack, allowing explicit CCBs over- allocation for requests with priority higher (numerically lower) then CAM_PRIORITY_OOB threshold.
Simplify CCB allocation logic by removing SIM-level allocation queue. After that SIM-level queue manages only CCBs execution, while allocation logic is localized within each single device.
Suggested by: gibbs
|
249410 |
12-Apr-2013 |
trasz |
Remove ctl(4) from GENERIC. Also remove 'options CTL_DISABLE' and kern.cam.ctl.disable tunable; those were introduced as a workaround to make it possible to boot GENERIC on low memory machines.
With ctl(4) being built as a module and automatically loaded by ctladm(8), this makes CTL work out of the box.
Reviewed by: ken Sponsored by: FreeBSD Foundation
|
249256 |
08-Apr-2013 |
ken |
Fix a memory leak that showed up when we delete LUNs. The memory used for the LUN was never freed.
ctl.c: Adjust ctl_alloc_lun() to make sure we don't clear the CTL_LUN_MALLOCED flag.
Reported by: Sreenivasa Honnur <shonnur@chelsio.com> Sponsored by: Spectra Logic MFC after: 3 days
|
249194 |
06-Apr-2013 |
trasz |
Make SYNCHRONIZE CACHE work with LUNs backed by device files (as opposed to regular files, which already worked fine). With this change, it's no longer neccessary to use "ctladm realsync off" workaround.
|
249102 |
04-Apr-2013 |
trasz |
Since the CTL version in FreeBSD does not support High Availability, ctl_is_single should always be set to 1. Make it so. Previously it was always 0, because ctl_isc_start() never got to run.
Suggested by: ken
|
249065 |
03-Apr-2013 |
trasz |
Fix locking problem in ctl_maintenance_in() - one cannot use M_WAITOK or call ctl_done() with mutex held.
Reviewed by: ken Sponsored by: FreeBSD Foundation
|
249028 |
02-Apr-2013 |
ken |
Fix sending virtual scatter/gather lists from the CTL CAM frontend peripheral.
Sponsored by: Spectra Logic
|
249026 |
02-Apr-2013 |
trasz |
Don't directly dereference userland pointer; instead use kernel pointer copied in from userspace. This fixes instant panic when creating CTL LUN on sparc64. Not a security problem, since the API is root-only.
Reviewed by: ken Sponsored by: FreeBSD Foundation
|
249019 |
02-Apr-2013 |
trasz |
Fix comment formatting.
|
249012 |
02-Apr-2013 |
trasz |
Remove unused code.
Reviewed by: ken
|
249009 |
02-Apr-2013 |
trasz |
Make it possible to build CTL as a module.
Reviewed by: ken Sponsored by: FreeBSD Foundation
|
247814 |
04-Mar-2013 |
ken |
Re-enable CTL in GENERIC on i386 and amd64, but turn on the CTL disable tunable by default.
This will allow GENERIC configurations to boot on small memory boxes, but not require end users who want to use CTL to recompile their kernel. They can simply set kern.cam.ctl.disable=0 in loader.conf.
The eventual solution to the memory usage problem is to change the way CTL allocates memory to be more configurable, but this should fix things for small memory situations in the mean time.
UPDATING: Explain the change in the CTL configuration, and how users can enable CTL if they would like to use it.
sys/conf/options: Add a new option, CTL_DISABLE, that prevents CTL from initializing.
ctl.c: If CTL_DISABLE is turned on, don't initialize.
i386/conf/GENERIC, amd64/conf/GENERIC: Re-enable device ctl, and add the CTL_DISABLE option.
|
246713 |
12-Feb-2013 |
kib |
Reform the busdma API so that new types may be added without modifying every architecture's busdma_machdep.c. It is done by unifying the bus_dmamap_load_buffer() routines so that they may be called from MI code. The MD busdma is then given a chance to do any final processing in the complete() callback.
The cam changes unify the bus_dmamap_load* handling in cam drivers.
The arm and mips implementations are updated to track virtual addresses for sync(). Previously this was done in a type specific way. Now it is done in a generic way by recording the list of virtuals in the map.
Submitted by: jeff (sponsored by EMC/Isilon) Reviewed by: kan (previous version), scottl, mjacob (isp(4), no objections for target mode changes) Discussed with: ian (arm changes) Tested by: marius (sparc64), mips (jmallet), isci(4) on x86 (jharris), amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)
|
245228 |
09-Jan-2013 |
ken |
Make CTL work a little better with loading and unloading drivers.
Previously CTL would leave individual LUNs enabled in the target driver, whether or not the port as a whole was enabled. It would also leave the wildcard LUN enabled indefinitely.
This change means that CTL will enable and disable any active LUNs, as well as the wildcard LUN, when enabling and disabling a port.
Also, fix a bug that could crop up due to an uninitialized CCB type.
ctl.c: Before calling ctl_frontend_online(), run through the LUN list and enable all active LUNs.
After calling ctl_frontend_offline(), run through the LUN list and disble all active LUNs.
scsi_ctl.c: Before bringing a port online, allocate the wildcard peripheral for that bus. And after taking a port offline, invalidate the wildcard peripheral for that bus.
Make sure that we hold the SIM lock around all calls to xpt_action() and other transport layer interfaces that require it.
Use CAM_SIM_{LOCK|UNLOCK} consistently to acquire and release the SIM lock.
Update a number of outdated comments. Some of these should have been fixed long ago.
Actually do LUN disbables now. The newer drivers in the tree work correctly for this as far as I know.
Initialize the CCB type to CTLFE_CCB_DEFAULT to avoid a panic due to uninitialized memory.
Submitted by: Chuck Tuffli (partially) MFC after: 1 week
|
244052 |
09-Dec-2012 |
ken |
Fix a couple of CTL locking issues and clean up some duplicated code.
ctl_frontend_cam_sim.c: Coalesce cfcs_online() and cfcs_offline() into a single function since these were identical except for one line.
Make sure we hold the SIM lock around path creation, and calling xpt_rescan().
scsi_ctl.c: In ctlfe_onoffline(), make sure we hold the SIM lock around path creation and free calls, as well as xpt_action().
In ctlfe_lun_enable(), hold the SIM lock around path and peripheral operations that require it.
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
244016 |
08-Dec-2012 |
ken |
Make sure we hold the SIM lock when calling xpt_free_path().
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
244015 |
08-Dec-2012 |
ken |
Fix the CTL OOA queue dumping code so that it does not hold a mutex while doing a copyout. That can cause a panic, because copyout can trigger VM faults, and we can't handle VM faults while holding a mutex.
The solution here is to malloc a separate buffer to hold the OOA queue entries, so that we don't risk a VM fault while filling up the buffer and we don't have to drop the lock. The other solution would be to wire the user's memory while filling their buffer with copyout, but that would have been a little more complex.
Also fix a debugging parenthesis issue in ctl_abort_task() pointed out by Chuck Tuffli.
Sponsored by: Spectra Logic Corporation MFC after: 1 week
|
242358 |
30-Oct-2012 |
trasz |
Use M_ZERO instead of explicit memsets and bzeros.
|
242174 |
27-Oct-2012 |
mav |
Remove several uses of numeric priorities from immediate CCB setups.
|
241896 |
22-Oct-2012 |
kib |
Remove the support for using non-mpsafe filesystem modules.
In particular, do not lock Giant conditionally when calling into the filesystem module, remove the VFS_LOCK_GIANT() and related macros. Stop handling buffers belonging to non-mpsafe filesystems.
The VFS_VERSION is bumped to indicate the interface change which does not result in the interface signatures changes.
Conducted and reviewed by: attilio Tested by: pho
|
241844 |
22-Oct-2012 |
eadler |
remove duplicate semicolons where possible.
Approved by: cperciva MFC after: 1 week
|
241508 |
13-Oct-2012 |
mav |
Extend SIM lock coverage during the bus registration process.
|
240993 |
27-Sep-2012 |
trasz |
Remove useless NULL checks after M_WAITOK allocations.
|
240948 |
26-Sep-2012 |
trasz |
Fix panic in CTL caused by trying to free invalid pointers passed by the userland process via the IOCTL interface.
Reviewed by: ken@
|
238870 |
28-Jul-2012 |
mjacob |
Handle a case where we had an SRR that pushed back the data pointer. This is a temp fix that resubmits the command, adjusted, so that the backend can fetch the data again.
Sponsored by: Spectralogic MFC after: 1 month
|
237726 |
28-Jun-2012 |
ken |
Add a loader tunable, kern.cam.ctl.disable, that will disable loading CTL. This may be useful in very low memory installations.
MFC after: 3 days
|
237601 |
26-Jun-2012 |
ken |
Fix an issue that caused the kernel to panic inside CTL when trying to attach to target capable HBAs that implement the old immediate notify (XPT_IMMED_NOTIFY) and notify acknowledge (XPT_NOTIFY_ACK) CCBs. The new API has been in place since SVN change 196008 in 2009.
The solution is two-fold: fix CTL to handle the responses from the HBAs, and convert the HBA drivers in question to use the new API.
These drivers have not been tested with CTL, so how well they will interoperate with CTL is unknown.
scsi_target.c: Update the userland target example code to use the new immediate notify API.
scsi_ctl.c: Detect when an immediate notify CCB is returned with CAM_REQ_INVALID or CAM_PROVIDE_FAIL status, and just free it.
Fix a duplicate assignment.
aic79xx.c, aic79xx_osm.c: Update the aic79xx driver to use the new API. Target mode is not enabled on for this driver, so the changes will have no practical effect.
aic7xxx.c, aic7xxx_osm.c: Update the aic7xxx driver to use the new API.
sbp_targ.c: Update the firewire target code to work with the new API.
mpt_cam.c: Update the mpt(4) driver to work with the new API. Target mode is only enabled for Fibre Channel mpt(4) devices.
MFC after: 3 days
|
236426 |
01-Jun-2012 |
mjacob |
Print FC PortID as a hex number. This makes it easy to figure out domain, etc..
Zero ATIO and INOTify allocations. It makes for much less guesswork when looking at the structure and seeing 'deadc0de' present.
Reviewed by: kdm MFC after: 2 weeks Sponsored by: Spectralogic
|
233963 |
06-Apr-2012 |
ken |
Change the SCSI INQUIRY peripheral qualifier that CTL reports for LUNs that don't exist.
Anecdotal evidence indicates that it is better to return 011b (bad LUN) than 001b (LUN offline). However, this change also gives the user a sysctl/tunable, kern.cam.ctl.inquiry_pq_no_lun, to override the change and return to the previous behavior. (The previous behavior was to return 001b, or LUN offline.)
ctl.c: Change the default inquiry peripheral qualifier to 011b, and add a sysctl and tunable to allow the user to change it back to 001b if needed.
Don't insert a Copan copyright statement in the inquiry data. The copyright statements on the files are sufficient.
ctl_private.h: Add sysctl variable context to the CTL softc.
ctl_cmd_table.c, ctl_frontend_internal.c, ctl_frontend.c, ctl_backend.c, ctl_error.c: Include sys/sysctl.h.
MFC after: 3 days
|
232604 |
06-Mar-2012 |
trasz |
Add LUN resizing to CTL. Also make it possible to explicitly set size when creating file-backed or device-backed LUN.
Reviewed by: ken (earlier version) Sponsored by: The FreeBSD Foundation
|
232074 |
23-Feb-2012 |
dim |
Use a better way to silence unneeded internal declaration warnings in several sys/cam/ctl files.
Suggested by: ed Reviewed by: ken MFC after: 1 week
|
231092 |
06-Feb-2012 |
emaste |
Avoid panic from unlocking a not locked mutex (in some error cases).
Reviewed by: ken@
|
230334 |
19-Jan-2012 |
ken |
Quiet some clang warnings when compiling CTL.
ctl_error.c, ctl_error.h: Take out the ctl_sense_format enumeration, and use scsi_sense_data_type instead.
Remove ctl_get_sense_format() and switch ctl_build_ua() over to using scsi_sense_data_type.
ctl_backend_ramdisk.c, ctl_backend_block.c: Use C99 structure initializers instead of GNU initializers.
ctl.c: Switch over to using the SCSI sense format enumeration instead of the CTL-specific enumeration.
Submitted by: dim (partially) MFC after: 1 month
|
230033 |
12-Jan-2012 |
ken |
Silence some unnecessary verbosity.
Reported by: mav MFC after: 1 month
|
229997 |
12-Jan-2012 |
ken |
Add the CAM Target Layer (CTL).
CTL is a disk and processor device emulation subsystem originally written for Copan Systems under Linux starting in 2003. It has been shipping in Copan (now SGI) products since 2005.
It was ported to FreeBSD in 2008, and thanks to an agreement between SGI (who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is available under a BSD-style license. The intent behind the agreement was that Spectra would work to get CTL into the FreeBSD tree.
Some CTL features:
- Disk and processor device emulation. - Tagged queueing - SCSI task attribute support (ordered, head of queue, simple tags) - SCSI implicit command ordering support. (e.g. if a read follows a mode select, the read will be blocked until the mode select completes.) - Full task management support (abort, LUN reset, target reset, etc.) - Support for multiple ports - Support for multiple simultaneous initiators - Support for multiple simultaneous backing stores - Persistent reservation support - Mode sense/select support - Error injection support - High Availability support (1) - All I/O handled in-kernel, no userland context switch overhead.
(1) HA Support is just an API stub, and needs much more to be fully functional.
ctl.c: The core of CTL. Command handlers and processing, character driver, and HA support are here.
ctl.h: Basic function declarations and data structures.
ctl_backend.c, ctl_backend.h: The basic CTL backend API.
ctl_backend_block.c, ctl_backend_block.h: The block and file backend. This allows for using a disk or a file as the backing store for a LUN. Multiple threads are started to do I/O to the backing device, primarily because the VFS API requires that to get any concurrency.
ctl_backend_ramdisk.c: A "fake" ramdisk backend. It only allocates a small amount of memory to act as a source and sink for reads and writes from an initiator. Therefore it cannot be used for any real data, but it can be used to test for throughput. It can also be used to test initiators' support for extremely large LUNs.
ctl_cmd_table.c: This is a table with all 256 possible SCSI opcodes, and command handler functions defined for supported opcodes.
ctl_debug.h: Debugging support.
ctl_error.c, ctl_error.h: CTL-specific wrappers around the CAM sense building functions.
ctl_frontend.c, ctl_frontend.h: These files define the basic CTL frontend port API.
ctl_frontend_cam_sim.c: This is a CTL frontend port that is also a CAM SIM. This frontend allows for using CTL without any target-capable hardware. So any LUNs you create in CTL are visible in CAM via this port.
ctl_frontend_internal.c, ctl_frontend_internal.h: This is a frontend port written for Copan to do some system-specific tasks that required sending commands into CTL from inside the kernel. This isn't entirely relevant to FreeBSD in general, but can perhaps be repurposed.
ctl_ha.h: This is a stubbed-out High Availability API. Much more is needed for full HA support. See the comments in the header and the description of what is needed in the README.ctl.txt file for more details.
ctl_io.h: This defines most of the core CTL I/O structures. union ctl_io is conceptually very similar to CAM's union ccb.
ctl_ioctl.h: This defines all ioctls available through the CTL character device, and the data structures needed for those ioctls.
ctl_mem_pool.c, ctl_mem_pool.h: Generic memory pool implementation used by the internal frontend.
ctl_private.h: Private data structres (e.g. CTL softc) and function prototypes. This also includes the SCSI vendor and product names used by CTL.
ctl_scsi_all.c, ctl_scsi_all.h: CTL wrappers around CAM sense printing functions.
ctl_ser_table.c: Command serialization table. This defines what happens when one type of command is followed by another type of command.
ctl_util.c, ctl_util.h: CTL utility functions, primarily designed to be used from userland. See ctladm for the primary consumer of these functions. These include CDB building functions.
scsi_ctl.c: CAM target peripheral driver and CTL frontend port. This is the path into CTL for commands from target-capable hardware/SIMs.
README.ctl.txt: CTL code features, roadmap, to-do list.
usr.sbin/Makefile: Add ctladm.
ctladm/Makefile, ctladm/ctladm.8, ctladm/ctladm.c, ctladm/ctladm.h, ctladm/util.c: ctladm(8) is the CTL management utility. It fills a role similar to camcontrol(8). It allow configuring LUNs, issuing commands, injecting errors and various other control functions.
usr.bin/Makefile: Add ctlstat.
ctlstat/Makefile ctlstat/ctlstat.8, ctlstat/ctlstat.c: ctlstat(8) fills a role similar to iostat(8). It reports I/O statistics for CTL.
sys/conf/files: Add CTL files.
sys/conf/NOTES: Add device ctl.
sys/cam/scsi_all.h: To conform to more recent specs, the inquiry CDB length field is now 2 bytes long.
Add several mode page definitions for CTL.
sys/cam/scsi_all.c: Handle the new 2 byte inquiry length.
sys/dev/ciss/ciss.c, sys/dev/ata/atapi-cam.c, sys/cam/scsi/scsi_targ_bh.c, scsi_target/scsi_cmds.c, mlxcontrol/interface.c: Update for 2 byte inquiry length field.
scsi_da.h: Add versions of the format and rigid disk pages that are in a more reasonable format for CTL.
amd64/conf/GENERIC, i386/conf/GENERIC, ia64/conf/GENERIC, sparc64/conf/GENERIC: Add device ctl.
i386/conf/PAE: The CTL frontend SIM at least does not compile cleanly on PAE.
Sponsored by: Copan Systems, SGI and Spectra Logic MFC after: 1 month
|