2 * Copyright (c) 2003-2009 Silicon Graphics International Corp.
3 * Copyright (c) 2011 Spectra Logic Corporation
4 * Copyright (c) 2014-2015 Alexander Motin <mav@FreeBSD.org>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification.
13 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14 * substantially similar to the "NO WARRANTY" disclaimer below
15 * ("Disclaimer") and any redistribution must be conditioned upon
16 * including a substantially similar Disclaimer requirement for further
17 * binary redistribution.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGES.
32 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_error.c#2 $
35 * CAM Target Layer error reporting routines.
37 * Author: Ken Merry <ken@FreeBSD.org>
40 #include <sys/cdefs.h>
41 __FBSDID("$FreeBSD$");
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/kernel.h>
46 #include <sys/types.h>
47 #include <sys/malloc.h>
49 #include <sys/mutex.h>
50 #include <sys/condvar.h>
51 #include <sys/stddef.h>
52 #include <sys/ctype.h>
53 #include <sys/sysctl.h>
54 #include <machine/stdarg.h>
56 #include <cam/scsi/scsi_all.h>
57 #include <cam/scsi/scsi_da.h>
58 #include <cam/ctl/ctl_io.h>
59 #include <cam/ctl/ctl.h>
60 #include <cam/ctl/ctl_frontend.h>
61 #include <cam/ctl/ctl_backend.h>
62 #include <cam/ctl/ctl_ioctl.h>
63 #include <cam/ctl/ctl_error.h>
64 #include <cam/ctl/ctl_ha.h>
65 #include <cam/ctl/ctl_private.h>
68 ctl_set_sense_data_va(struct scsi_sense_data *sense_data, u_int *sense_len,
69 void *lunptr, scsi_sense_data_type sense_format, int current_error,
70 int sense_key, int asc, int ascq, va_list ap)
74 lun = (struct ctl_lun *)lunptr;
77 * Determine whether to return fixed or descriptor format sense
80 if (sense_format == SSD_TYPE_NONE) {
82 * If the format isn't specified, we only return descriptor
83 * sense if the LUN exists and descriptor sense is turned
86 if ((lun != NULL) && (lun->MODE_CTRL.rlec & SCP_DSENSE))
87 sense_format = SSD_TYPE_DESC;
89 sense_format = SSD_TYPE_FIXED;
93 * Determine maximum sense data length to return.
95 if (*sense_len == 0) {
96 if ((lun != NULL) && (lun->MODE_CTRLE.max_sense != 0))
97 *sense_len = lun->MODE_CTRLE.max_sense;
99 *sense_len = SSD_FULL_SIZE;
102 scsi_set_sense_data_va(sense_data, sense_len, sense_format,
103 current_error, sense_key, asc, ascq, ap);
107 ctl_set_sense_data(struct scsi_sense_data *sense_data, u_int *sense_len,
108 void *lunptr, scsi_sense_data_type sense_format, int current_error,
109 int sense_key, int asc, int ascq, ...)
114 ctl_set_sense_data_va(sense_data, sense_len, lunptr, sense_format,
115 current_error, sense_key, asc, ascq, ap);
120 ctl_set_sense(struct ctl_scsiio *ctsio, int current_error, int sense_key,
121 int asc, int ascq, ...)
128 * The LUN can't go away until all of the commands have been
129 * completed. Therefore we can safely access the LUN structure and
130 * flags without the lock.
132 lun = CTL_LUN(ctsio);
136 ctl_set_sense_data_va(&ctsio->sense_data, &sense_len,
146 ctsio->scsi_status = SCSI_STATUS_CHECK_COND;
147 ctsio->sense_len = sense_len;
148 ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE;
152 * Transform fixed sense data into descriptor sense data.
154 * For simplicity's sake, we assume that both sense structures are
155 * SSD_FULL_SIZE. Otherwise, the logic gets more complicated.
158 ctl_sense_to_desc(struct scsi_sense_data_fixed *sense_src,
159 struct scsi_sense_data_desc *sense_dest)
161 struct scsi_sense_stream stream_sense;
166 bzero(sense_dest, sizeof(*sense_dest));
168 if ((sense_src->error_code & SSD_ERRCODE) == SSD_DEFERRED_ERROR)
173 bzero(&stream_sense, sizeof(stream_sense));
176 * Check to see whether any of the tape-specific bits are set. If
177 * so, we'll need a stream sense descriptor.
179 if (sense_src->flags & (SSD_ILI|SSD_EOM|SSD_FILEMARK))
180 stream_bits = sense_src->flags & ~SSD_KEY;
185 * Utilize our sense setting routine to do the transform. If a
186 * value is set in the fixed sense data, set it in the descriptor
187 * data. Otherwise, skip it.
189 sense_len = SSD_FULL_SIZE;
190 ctl_set_sense_data((struct scsi_sense_data *)sense_dest, &sense_len,
192 /*sense_format*/ SSD_TYPE_DESC,
194 /*sense_key*/ sense_src->flags & SSD_KEY,
195 /*asc*/ sense_src->add_sense_code,
196 /*ascq*/ sense_src->add_sense_code_qual,
198 /* Information Bytes */
199 (sense_src->error_code & SSD_ERRCODE_VALID) ?
200 SSD_ELEM_INFO : SSD_ELEM_SKIP,
201 sizeof(sense_src->info),
204 /* Command specific bytes */
205 (scsi_4btoul(sense_src->cmd_spec_info) != 0) ?
206 SSD_ELEM_COMMAND : SSD_ELEM_SKIP,
207 sizeof(sense_src->cmd_spec_info),
208 sense_src->cmd_spec_info,
211 (sense_src->fru != 0) ?
212 SSD_ELEM_FRU : SSD_ELEM_SKIP,
213 sizeof(sense_src->fru),
216 /* Sense Key Specific */
217 (sense_src->sense_key_spec[0] & SSD_SCS_VALID) ?
218 SSD_ELEM_SKS : SSD_ELEM_SKIP,
219 sizeof(sense_src->sense_key_spec),
220 sense_src->sense_key_spec,
224 SSD_ELEM_STREAM : SSD_ELEM_SKIP,
232 * Transform descriptor format sense data into fixed sense data.
234 * Some data may be lost in translation, because there are descriptors
235 * thant can't be represented as fixed sense data.
237 * For simplicity's sake, we assume that both sense structures are
238 * SSD_FULL_SIZE. Otherwise, the logic gets more complicated.
241 ctl_sense_to_fixed(struct scsi_sense_data_desc *sense_src,
242 struct scsi_sense_data_fixed *sense_dest)
245 uint8_t *info_ptr = NULL, *cmd_ptr = NULL, *fru_ptr = NULL;
246 uint8_t *sks_ptr = NULL, *stream_ptr = NULL;
247 int info_size = 0, cmd_size = 0, fru_size = 0;
248 int sks_size = 0, stream_size = 0;
252 if ((sense_src->error_code & SSD_ERRCODE) == SSD_DESC_CURRENT_ERROR)
257 for (pos = 0; pos < (int)(sense_src->extra_len - 1);) {
258 struct scsi_sense_desc_header *header;
260 header = (struct scsi_sense_desc_header *)
261 &sense_src->sense_desc[pos];
264 * See if this record goes past the end of the sense data.
265 * It shouldn't, but check just in case.
267 if ((pos + header->length + sizeof(*header)) >
268 sense_src->extra_len)
271 switch (sense_src->sense_desc[pos]) {
272 case SSD_DESC_INFO: {
273 struct scsi_sense_info *info;
275 info = (struct scsi_sense_info *)header;
277 info_ptr = info->info;
278 info_size = sizeof(info->info);
280 pos += info->length +
281 sizeof(struct scsi_sense_desc_header);
284 case SSD_DESC_COMMAND: {
285 struct scsi_sense_command *cmd;
287 cmd = (struct scsi_sense_command *)header;
288 cmd_ptr = cmd->command_info;
289 cmd_size = sizeof(cmd->command_info);
292 sizeof(struct scsi_sense_desc_header);
296 struct scsi_sense_fru *fru;
298 fru = (struct scsi_sense_fru *)header;
300 fru_size = sizeof(fru->fru);
302 sizeof(struct scsi_sense_desc_header);
306 struct scsi_sense_sks *sks;
308 sks = (struct scsi_sense_sks *)header;
309 sks_ptr = sks->sense_key_spec;
310 sks_size = sizeof(sks->sense_key_spec);
313 sizeof(struct scsi_sense_desc_header);
316 case SSD_DESC_STREAM: {
317 struct scsi_sense_stream *stream_sense;
319 stream_sense = (struct scsi_sense_stream *)header;
320 stream_ptr = &stream_sense->byte3;
321 stream_size = sizeof(stream_sense->byte3);
322 pos = stream_sense->length +
323 sizeof(struct scsi_sense_desc_header);
328 * We don't recognize this particular sense
329 * descriptor type, so just skip it.
331 pos += sizeof(*header) + header->length;
336 sense_len = SSD_FULL_SIZE;
337 ctl_set_sense_data((struct scsi_sense_data *)sense_dest, &sense_len,
339 /*sense_format*/ SSD_TYPE_FIXED,
341 /*sense_key*/ sense_src->sense_key & SSD_KEY,
342 /*asc*/ sense_src->add_sense_code,
343 /*ascq*/ sense_src->add_sense_code_qual,
345 /* Information Bytes */
346 (info_ptr != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP,
350 /* Command specific bytes */
351 (cmd_ptr != NULL) ? SSD_ELEM_COMMAND : SSD_ELEM_SKIP,
356 (fru_ptr != NULL) ? SSD_ELEM_FRU : SSD_ELEM_SKIP,
360 /* Sense Key Specific */
361 (sks_ptr != NULL) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
366 (stream_ptr != NULL) ? SSD_ELEM_STREAM : SSD_ELEM_SKIP,
374 ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq)
378 /*sense_key*/ SSD_KEY_UNIT_ATTENTION,
385 ctl_ua_to_ascq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc,
386 int *ascq, ctl_ua_type *ua_to_clear, uint8_t **info)
389 switch (ua_to_build) {
391 /* 29h/01h POWER ON OCCURRED */
396 case CTL_UA_BUS_RESET:
397 /* 29h/02h SCSI BUS RESET OCCURRED */
402 case CTL_UA_TARG_RESET:
403 /* 29h/03h BUS DEVICE RESET FUNCTION OCCURRED*/
408 case CTL_UA_I_T_NEXUS_LOSS:
409 /* 29h/07h I_T NEXUS LOSS OCCURRED */
414 case CTL_UA_LUN_RESET:
415 /* 29h/00h POWER ON, RESET, OR BUS DEVICE RESET OCCURRED */
417 * Since we don't have a specific ASC/ASCQ pair for a LUN
418 * reset, just return the generic reset code.
423 case CTL_UA_LUN_CHANGE:
424 /* 3Fh/0Eh REPORTED LUNS DATA HAS CHANGED */
428 case CTL_UA_MODE_CHANGE:
429 /* 2Ah/01h MODE PARAMETERS CHANGED */
433 case CTL_UA_LOG_CHANGE:
434 /* 2Ah/02h LOG PARAMETERS CHANGED */
438 case CTL_UA_INQ_CHANGE:
439 /* 3Fh/03h INQUIRY DATA HAS CHANGED */
443 case CTL_UA_RES_PREEMPT:
444 /* 2Ah/03h RESERVATIONS PREEMPTED */
448 case CTL_UA_RES_RELEASE:
449 /* 2Ah/04h RESERVATIONS RELEASED */
453 case CTL_UA_REG_PREEMPT:
454 /* 2Ah/05h REGISTRATIONS PREEMPTED */
458 case CTL_UA_ASYM_ACC_CHANGE:
459 /* 2Ah/06h ASYMMETRIC ACCESS STATE CHANGED */
463 case CTL_UA_CAPACITY_CHANGE:
464 /* 2Ah/09h CAPACITY DATA HAS CHANGED */
468 case CTL_UA_THIN_PROV_THRES:
469 /* 38h/07h THIN PROVISIONING SOFT THRESHOLD REACHED */
472 *info = lun->ua_tpt_info;
474 case CTL_UA_MEDIUM_CHANGE:
475 /* 28h/00h NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED */
480 /* Informational exception */
482 *ascq = lun->ie_ascq;
485 panic("%s: Unknown UA %x", __func__, ua_to_build);
490 ctl_build_qae(struct ctl_lun *lun, uint32_t initidx, uint8_t *resp)
493 ctl_ua_type ua_to_build, ua_to_clear;
498 mtx_assert(&lun->lun_lock, MA_OWNED);
499 p = initidx / CTL_MAX_INIT_PER_PORT;
500 i = initidx % CTL_MAX_INIT_PER_PORT;
501 if (lun->pending_ua[p] == NULL)
504 ua = lun->pending_ua[p][i];
505 if (ua == CTL_UA_NONE)
506 return (CTL_UA_NONE);
508 ua_to_build = (1 << (ffs(ua) - 1));
509 ua_to_clear = ua_to_build;
511 ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
513 resp[0] = SSD_KEY_UNIT_ATTENTION;
514 if (ua_to_build == ua)
520 return (ua_to_build);
524 ctl_build_ua(struct ctl_lun *lun, uint32_t initidx,
525 struct scsi_sense_data *sense, u_int *sense_len,
526 scsi_sense_data_type sense_format)
529 ctl_ua_type ua_to_build, ua_to_clear;
534 mtx_assert(&lun->lun_lock, MA_OWNED);
535 mtx_assert(&lun->ctl_softc->ctl_lock, MA_NOTOWNED);
536 p = initidx / CTL_MAX_INIT_PER_PORT;
537 if ((ua = lun->pending_ua[p]) == NULL) {
538 mtx_unlock(&lun->lun_lock);
539 ua = malloc(sizeof(ctl_ua_type) * CTL_MAX_INIT_PER_PORT,
541 mtx_lock(&lun->lun_lock);
542 if (lun->pending_ua[p] == NULL) {
543 lun->pending_ua[p] = ua;
544 for (i = 0; i < CTL_MAX_INIT_PER_PORT; i++)
545 ua[i] = CTL_UA_POWERON;
548 ua = lun->pending_ua[p];
551 i = initidx % CTL_MAX_INIT_PER_PORT;
552 if (ua[i] == CTL_UA_NONE)
553 return (CTL_UA_NONE);
555 ua_to_build = (1 << (ffs(ua[i]) - 1));
556 ua_to_clear = ua_to_build;
558 ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
560 ctl_set_sense_data(sense, sense_len, lun, sense_format, 1,
561 /*sense_key*/ SSD_KEY_UNIT_ATTENTION, asc, ascq,
562 ((info != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP), 8, info,
565 /* We're reporting this UA, so clear it */
566 ua[i] &= ~ua_to_clear;
568 if (ua_to_build == CTL_UA_LUN_CHANGE) {
569 mtx_unlock(&lun->lun_lock);
570 mtx_lock(&lun->ctl_softc->ctl_lock);
571 ctl_clr_ua_allluns(lun->ctl_softc, initidx, ua_to_build);
572 mtx_unlock(&lun->ctl_softc->ctl_lock);
573 mtx_lock(&lun->lun_lock);
574 } else if (ua_to_build == CTL_UA_THIN_PROV_THRES &&
575 (lun->MODE_LBP.main.flags & SLBPP_SITUA) != 0) {
576 ctl_clr_ua_all(lun, -1, ua_to_build);
579 return (ua_to_build);
583 ctl_set_overlapped_cmd(struct ctl_scsiio *ctsio)
585 /* OVERLAPPED COMMANDS ATTEMPTED */
588 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
595 ctl_set_overlapped_tag(struct ctl_scsiio *ctsio, uint8_t tag)
597 /* TAGGED OVERLAPPED COMMANDS (NN = QUEUE TAG) */
600 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
607 * Tell the user that there was a problem with the command or data he sent.
610 ctl_set_invalid_field(struct ctl_scsiio *ctsio, int sks_valid, int command,
611 int field, int bit_valid, int bit)
617 /* "Invalid field in CDB" */
620 /* "Invalid field in parameter list" */
625 sks[0] = SSD_SCS_VALID;
627 sks[0] |= SSD_FIELDPTR_CMD;
628 scsi_ulto2b(field, &sks[1]);
631 sks[0] |= SSD_BITPTR_VALID | bit;
636 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
639 /*type*/ (sks_valid != 0) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
640 /*size*/ sizeof(sks),
645 ctl_set_invalid_field_ciu(struct ctl_scsiio *ctsio)
648 /* "Invalid field in command information unit" */
651 /*sense_key*/ SSD_KEY_ABORTED_COMMAND,
658 ctl_set_invalid_opcode(struct ctl_scsiio *ctsio)
662 sks[0] = SSD_SCS_VALID | SSD_FIELDPTR_CMD;
663 scsi_ulto2b(0, &sks[1]);
665 /* "Invalid command operation code" */
668 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
671 /*type*/ SSD_ELEM_SKS,
672 /*size*/ sizeof(sks),
678 ctl_set_param_len_error(struct ctl_scsiio *ctsio)
680 /* "Parameter list length error" */
683 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
690 ctl_set_already_locked(struct ctl_scsiio *ctsio)
692 /* Vendor unique "Somebody already is locked" */
695 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
702 ctl_set_unsupported_lun(struct ctl_scsiio *ctsio)
704 /* "Logical unit not supported" */
707 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
714 ctl_set_internal_failure(struct ctl_scsiio *ctsio, int sks_valid,
715 uint16_t retry_count)
720 sks[0] = SSD_SCS_VALID;
721 sks[1] = (retry_count >> 8) & 0xff;
722 sks[2] = retry_count & 0xff;
725 /* "Internal target failure" */
728 /*sense_key*/ SSD_KEY_HARDWARE_ERROR,
731 /*type*/ (sks_valid != 0) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
732 /*size*/ sizeof(sks),
738 ctl_set_medium_error(struct ctl_scsiio *ctsio, int read)
741 /* "Unrecovered read error" */
744 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
749 /* "Write error - auto reallocation failed" */
752 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
760 ctl_set_aborted(struct ctl_scsiio *ctsio)
764 /*sense_key*/ SSD_KEY_ABORTED_COMMAND,
771 ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio, uint64_t lba)
775 scsi_u64to8b(lba, info);
777 /* "Logical block address out of range" */
780 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
783 /*type*/ (lba != 0) ? SSD_ELEM_INFO : SSD_ELEM_SKIP,
784 /*size*/ sizeof(info), /*data*/ &info,
789 ctl_set_lun_stopped(struct ctl_scsiio *ctsio)
791 /* "Logical unit not ready, initializing cmd. required" */
794 /*sense_key*/ SSD_KEY_NOT_READY,
801 ctl_set_lun_int_reqd(struct ctl_scsiio *ctsio)
803 /* "Logical unit not ready, manual intervention required" */
806 /*sense_key*/ SSD_KEY_NOT_READY,
813 ctl_set_lun_ejected(struct ctl_scsiio *ctsio)
815 /* "Medium not present - tray open" */
818 /*sense_key*/ SSD_KEY_NOT_READY,
825 ctl_set_lun_no_media(struct ctl_scsiio *ctsio)
827 /* "Medium not present - tray closed" */
830 /*sense_key*/ SSD_KEY_NOT_READY,
837 ctl_set_illegal_pr_release(struct ctl_scsiio *ctsio)
839 /* "Invalid release of persistent reservation" */
842 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
849 ctl_set_lun_transit(struct ctl_scsiio *ctsio)
851 /* "Logical unit not ready, asymmetric access state transition" */
854 /*sense_key*/ SSD_KEY_NOT_READY,
861 ctl_set_lun_standby(struct ctl_scsiio *ctsio)
863 /* "Logical unit not ready, target port in standby state" */
866 /*sense_key*/ SSD_KEY_NOT_READY,
873 ctl_set_lun_unavail(struct ctl_scsiio *ctsio)
875 /* "Logical unit not ready, target port in unavailable state" */
878 /*sense_key*/ SSD_KEY_NOT_READY,
885 ctl_set_medium_format_corrupted(struct ctl_scsiio *ctsio)
887 /* "Medium format corrupted" */
890 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
897 ctl_set_medium_magazine_inaccessible(struct ctl_scsiio *ctsio)
899 /* "Medium magazine not accessible" */
902 /*sense_key*/ SSD_KEY_NOT_READY,
909 ctl_set_data_phase_error(struct ctl_scsiio *ctsio)
911 /* "Data phase error" */
914 /*sense_key*/ SSD_KEY_NOT_READY,
921 ctl_set_reservation_conflict(struct ctl_scsiio *ctsio)
924 ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT;
925 ctsio->sense_len = 0;
926 ctsio->io_hdr.status = CTL_SCSI_ERROR;
930 ctl_set_queue_full(struct ctl_scsiio *ctsio)
933 ctsio->scsi_status = SCSI_STATUS_QUEUE_FULL;
934 ctsio->sense_len = 0;
935 ctsio->io_hdr.status = CTL_SCSI_ERROR;
939 ctl_set_busy(struct ctl_scsiio *ctsio)
942 ctsio->scsi_status = SCSI_STATUS_BUSY;
943 ctsio->sense_len = 0;
944 ctsio->io_hdr.status = CTL_SCSI_ERROR;
948 ctl_set_task_aborted(struct ctl_scsiio *ctsio)
951 ctsio->scsi_status = SCSI_STATUS_TASK_ABORTED;
952 ctsio->sense_len = 0;
953 ctsio->io_hdr.status = CTL_CMD_ABORTED;
957 ctl_set_hw_write_protected(struct ctl_scsiio *ctsio)
959 /* "Hardware write protected" */
962 /*sense_key*/ SSD_KEY_DATA_PROTECT,
969 ctl_set_space_alloc_fail(struct ctl_scsiio *ctsio)
971 /* "Space allocation failed write protect" */
974 /*sense_key*/ SSD_KEY_DATA_PROTECT,
981 ctl_set_success(struct ctl_scsiio *ctsio)
984 ctsio->scsi_status = SCSI_STATUS_OK;
985 ctsio->sense_len = 0;
986 ctsio->io_hdr.status = CTL_SUCCESS;