2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2003-2009 Silicon Graphics International Corp.
5 * Copyright (c) 2011 Spectra Logic Corporation
6 * Copyright (c) 2014-2015 Alexander Motin <mav@FreeBSD.org>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions, and the following disclaimer,
14 * without modification.
15 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
16 * substantially similar to the "NO WARRANTY" disclaimer below
17 * ("Disclaimer") and any redistribution must be conditioned upon
18 * including a substantially similar Disclaimer requirement for further
19 * binary redistribution.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
31 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGES.
34 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_error.c#2 $
37 * CAM Target Layer error reporting routines.
39 * Author: Ken Merry <ken@FreeBSD.org>
42 #include <sys/cdefs.h>
43 __FBSDID("$FreeBSD$");
45 #include <sys/param.h>
46 #include <sys/systm.h>
47 #include <sys/kernel.h>
48 #include <sys/types.h>
49 #include <sys/malloc.h>
51 #include <sys/mutex.h>
52 #include <sys/condvar.h>
53 #include <sys/stddef.h>
54 #include <sys/ctype.h>
55 #include <sys/sysctl.h>
56 #include <machine/stdarg.h>
58 #include <cam/scsi/scsi_all.h>
59 #include <cam/scsi/scsi_da.h>
60 #include <cam/ctl/ctl_io.h>
61 #include <cam/ctl/ctl.h>
62 #include <cam/ctl/ctl_frontend.h>
63 #include <cam/ctl/ctl_backend.h>
64 #include <cam/ctl/ctl_ioctl.h>
65 #include <cam/ctl/ctl_error.h>
66 #include <cam/ctl/ctl_ha.h>
67 #include <cam/ctl/ctl_private.h>
70 ctl_set_sense_data_va(struct scsi_sense_data *sense_data, u_int *sense_len,
71 void *lunptr, scsi_sense_data_type sense_format, int current_error,
72 int sense_key, int asc, int ascq, va_list ap)
76 lun = (struct ctl_lun *)lunptr;
79 * Determine whether to return fixed or descriptor format sense
82 if (sense_format == SSD_TYPE_NONE) {
84 * If the format isn't specified, we only return descriptor
85 * sense if the LUN exists and descriptor sense is turned
88 if ((lun != NULL) && (lun->MODE_CTRL.rlec & SCP_DSENSE))
89 sense_format = SSD_TYPE_DESC;
91 sense_format = SSD_TYPE_FIXED;
95 * Determine maximum sense data length to return.
97 if (*sense_len == 0) {
98 if ((lun != NULL) && (lun->MODE_CTRLE.max_sense != 0))
99 *sense_len = lun->MODE_CTRLE.max_sense;
101 *sense_len = SSD_FULL_SIZE;
104 scsi_set_sense_data_va(sense_data, sense_len, sense_format,
105 current_error, sense_key, asc, ascq, ap);
109 ctl_set_sense_data(struct scsi_sense_data *sense_data, u_int *sense_len,
110 void *lunptr, scsi_sense_data_type sense_format, int current_error,
111 int sense_key, int asc, int ascq, ...)
116 ctl_set_sense_data_va(sense_data, sense_len, lunptr, sense_format,
117 current_error, sense_key, asc, ascq, ap);
122 ctl_set_sense(struct ctl_scsiio *ctsio, int current_error, int sense_key,
123 int asc, int ascq, ...)
130 * The LUN can't go away until all of the commands have been
131 * completed. Therefore we can safely access the LUN structure and
132 * flags without the lock.
134 lun = CTL_LUN(ctsio);
138 ctl_set_sense_data_va(&ctsio->sense_data, &sense_len,
148 ctsio->scsi_status = SCSI_STATUS_CHECK_COND;
149 ctsio->sense_len = sense_len;
150 ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE;
154 * Transform fixed sense data into descriptor sense data.
156 * For simplicity's sake, we assume that both sense structures are
157 * SSD_FULL_SIZE. Otherwise, the logic gets more complicated.
160 ctl_sense_to_desc(struct scsi_sense_data_fixed *sense_src,
161 struct scsi_sense_data_desc *sense_dest)
163 struct scsi_sense_stream stream_sense;
168 bzero(sense_dest, sizeof(*sense_dest));
170 if ((sense_src->error_code & SSD_ERRCODE) == SSD_DEFERRED_ERROR)
175 bzero(&stream_sense, sizeof(stream_sense));
178 * Check to see whether any of the tape-specific bits are set. If
179 * so, we'll need a stream sense descriptor.
181 if (sense_src->flags & (SSD_ILI|SSD_EOM|SSD_FILEMARK))
182 stream_bits = sense_src->flags & ~SSD_KEY;
187 * Utilize our sense setting routine to do the transform. If a
188 * value is set in the fixed sense data, set it in the descriptor
189 * data. Otherwise, skip it.
191 sense_len = SSD_FULL_SIZE;
192 ctl_set_sense_data((struct scsi_sense_data *)sense_dest, &sense_len,
194 /*sense_format*/ SSD_TYPE_DESC,
196 /*sense_key*/ sense_src->flags & SSD_KEY,
197 /*asc*/ sense_src->add_sense_code,
198 /*ascq*/ sense_src->add_sense_code_qual,
200 /* Information Bytes */
201 (sense_src->error_code & SSD_ERRCODE_VALID) ?
202 SSD_ELEM_INFO : SSD_ELEM_SKIP,
203 sizeof(sense_src->info),
206 /* Command specific bytes */
207 (scsi_4btoul(sense_src->cmd_spec_info) != 0) ?
208 SSD_ELEM_COMMAND : SSD_ELEM_SKIP,
209 sizeof(sense_src->cmd_spec_info),
210 sense_src->cmd_spec_info,
213 (sense_src->fru != 0) ?
214 SSD_ELEM_FRU : SSD_ELEM_SKIP,
215 sizeof(sense_src->fru),
218 /* Sense Key Specific */
219 (sense_src->sense_key_spec[0] & SSD_SCS_VALID) ?
220 SSD_ELEM_SKS : SSD_ELEM_SKIP,
221 sizeof(sense_src->sense_key_spec),
222 sense_src->sense_key_spec,
226 SSD_ELEM_STREAM : SSD_ELEM_SKIP,
234 * Transform descriptor format sense data into fixed sense data.
236 * Some data may be lost in translation, because there are descriptors
237 * thant can't be represented as fixed sense data.
239 * For simplicity's sake, we assume that both sense structures are
240 * SSD_FULL_SIZE. Otherwise, the logic gets more complicated.
243 ctl_sense_to_fixed(struct scsi_sense_data_desc *sense_src,
244 struct scsi_sense_data_fixed *sense_dest)
247 uint8_t *info_ptr = NULL, *cmd_ptr = NULL, *fru_ptr = NULL;
248 uint8_t *sks_ptr = NULL, *stream_ptr = NULL;
249 int info_size = 0, cmd_size = 0, fru_size = 0;
250 int sks_size = 0, stream_size = 0;
254 if ((sense_src->error_code & SSD_ERRCODE) == SSD_DESC_CURRENT_ERROR)
259 for (pos = 0; pos < (int)(sense_src->extra_len - 1);) {
260 struct scsi_sense_desc_header *header;
262 header = (struct scsi_sense_desc_header *)
263 &sense_src->sense_desc[pos];
266 * See if this record goes past the end of the sense data.
267 * It shouldn't, but check just in case.
269 if ((pos + header->length + sizeof(*header)) >
270 sense_src->extra_len)
273 switch (sense_src->sense_desc[pos]) {
274 case SSD_DESC_INFO: {
275 struct scsi_sense_info *info;
277 info = (struct scsi_sense_info *)header;
279 info_ptr = info->info;
280 info_size = sizeof(info->info);
282 pos += info->length +
283 sizeof(struct scsi_sense_desc_header);
286 case SSD_DESC_COMMAND: {
287 struct scsi_sense_command *cmd;
289 cmd = (struct scsi_sense_command *)header;
290 cmd_ptr = cmd->command_info;
291 cmd_size = sizeof(cmd->command_info);
294 sizeof(struct scsi_sense_desc_header);
298 struct scsi_sense_fru *fru;
300 fru = (struct scsi_sense_fru *)header;
302 fru_size = sizeof(fru->fru);
304 sizeof(struct scsi_sense_desc_header);
308 struct scsi_sense_sks *sks;
310 sks = (struct scsi_sense_sks *)header;
311 sks_ptr = sks->sense_key_spec;
312 sks_size = sizeof(sks->sense_key_spec);
315 sizeof(struct scsi_sense_desc_header);
318 case SSD_DESC_STREAM: {
319 struct scsi_sense_stream *stream_sense;
321 stream_sense = (struct scsi_sense_stream *)header;
322 stream_ptr = &stream_sense->byte3;
323 stream_size = sizeof(stream_sense->byte3);
324 pos = stream_sense->length +
325 sizeof(struct scsi_sense_desc_header);
330 * We don't recognize this particular sense
331 * descriptor type, so just skip it.
333 pos += sizeof(*header) + header->length;
338 sense_len = SSD_FULL_SIZE;
339 ctl_set_sense_data((struct scsi_sense_data *)sense_dest, &sense_len,
341 /*sense_format*/ SSD_TYPE_FIXED,
343 /*sense_key*/ sense_src->sense_key & SSD_KEY,
344 /*asc*/ sense_src->add_sense_code,
345 /*ascq*/ sense_src->add_sense_code_qual,
347 /* Information Bytes */
348 (info_ptr != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP,
352 /* Command specific bytes */
353 (cmd_ptr != NULL) ? SSD_ELEM_COMMAND : SSD_ELEM_SKIP,
358 (fru_ptr != NULL) ? SSD_ELEM_FRU : SSD_ELEM_SKIP,
362 /* Sense Key Specific */
363 (sks_ptr != NULL) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
368 (stream_ptr != NULL) ? SSD_ELEM_STREAM : SSD_ELEM_SKIP,
376 ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq)
380 /*sense_key*/ SSD_KEY_UNIT_ATTENTION,
387 ctl_ua_to_ascq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc,
388 int *ascq, ctl_ua_type *ua_to_clear, uint8_t **info)
391 switch (ua_to_build) {
393 /* 29h/01h POWER ON OCCURRED */
398 case CTL_UA_BUS_RESET:
399 /* 29h/02h SCSI BUS RESET OCCURRED */
404 case CTL_UA_TARG_RESET:
405 /* 29h/03h BUS DEVICE RESET FUNCTION OCCURRED*/
410 case CTL_UA_I_T_NEXUS_LOSS:
411 /* 29h/07h I_T NEXUS LOSS OCCURRED */
416 case CTL_UA_LUN_RESET:
417 /* 29h/00h POWER ON, RESET, OR BUS DEVICE RESET OCCURRED */
419 * Since we don't have a specific ASC/ASCQ pair for a LUN
420 * reset, just return the generic reset code.
425 case CTL_UA_LUN_CHANGE:
426 /* 3Fh/0Eh REPORTED LUNS DATA HAS CHANGED */
430 case CTL_UA_MODE_CHANGE:
431 /* 2Ah/01h MODE PARAMETERS CHANGED */
435 case CTL_UA_LOG_CHANGE:
436 /* 2Ah/02h LOG PARAMETERS CHANGED */
440 case CTL_UA_INQ_CHANGE:
441 /* 3Fh/03h INQUIRY DATA HAS CHANGED */
445 case CTL_UA_RES_PREEMPT:
446 /* 2Ah/03h RESERVATIONS PREEMPTED */
450 case CTL_UA_RES_RELEASE:
451 /* 2Ah/04h RESERVATIONS RELEASED */
455 case CTL_UA_REG_PREEMPT:
456 /* 2Ah/05h REGISTRATIONS PREEMPTED */
460 case CTL_UA_ASYM_ACC_CHANGE:
461 /* 2Ah/06h ASYMMETRIC ACCESS STATE CHANGED */
465 case CTL_UA_CAPACITY_CHANGE:
466 /* 2Ah/09h CAPACITY DATA HAS CHANGED */
470 case CTL_UA_THIN_PROV_THRES:
471 /* 38h/07h THIN PROVISIONING SOFT THRESHOLD REACHED */
474 *info = lun->ua_tpt_info;
476 case CTL_UA_MEDIUM_CHANGE:
477 /* 28h/00h NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED */
482 /* Informational exception */
484 *ascq = lun->ie_ascq;
487 panic("%s: Unknown UA %x", __func__, ua_to_build);
492 ctl_build_qae(struct ctl_lun *lun, uint32_t initidx, uint8_t *resp)
495 ctl_ua_type ua_to_build, ua_to_clear;
500 mtx_assert(&lun->lun_lock, MA_OWNED);
501 p = initidx / CTL_MAX_INIT_PER_PORT;
502 i = initidx % CTL_MAX_INIT_PER_PORT;
503 if (lun->pending_ua[p] == NULL)
506 ua = lun->pending_ua[p][i];
507 if (ua == CTL_UA_NONE)
508 return (CTL_UA_NONE);
510 ua_to_build = (1 << (ffs(ua) - 1));
511 ua_to_clear = ua_to_build;
513 ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
515 resp[0] = SSD_KEY_UNIT_ATTENTION;
516 if (ua_to_build == ua)
522 return (ua_to_build);
526 ctl_build_ua(struct ctl_lun *lun, uint32_t initidx,
527 struct scsi_sense_data *sense, u_int *sense_len,
528 scsi_sense_data_type sense_format)
531 ctl_ua_type ua_to_build, ua_to_clear;
536 mtx_assert(&lun->lun_lock, MA_OWNED);
537 mtx_assert(&lun->ctl_softc->ctl_lock, MA_NOTOWNED);
538 p = initidx / CTL_MAX_INIT_PER_PORT;
539 if ((ua = lun->pending_ua[p]) == NULL) {
540 mtx_unlock(&lun->lun_lock);
541 ua = malloc(sizeof(ctl_ua_type) * CTL_MAX_INIT_PER_PORT,
543 mtx_lock(&lun->lun_lock);
544 if (lun->pending_ua[p] == NULL) {
545 lun->pending_ua[p] = ua;
546 for (i = 0; i < CTL_MAX_INIT_PER_PORT; i++)
547 ua[i] = CTL_UA_POWERON;
550 ua = lun->pending_ua[p];
553 i = initidx % CTL_MAX_INIT_PER_PORT;
554 if (ua[i] == CTL_UA_NONE)
555 return (CTL_UA_NONE);
557 ua_to_build = (1 << (ffs(ua[i]) - 1));
558 ua_to_clear = ua_to_build;
560 ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
562 ctl_set_sense_data(sense, sense_len, lun, sense_format, 1,
563 /*sense_key*/ SSD_KEY_UNIT_ATTENTION, asc, ascq,
564 ((info != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP), 8, info,
567 /* We're reporting this UA, so clear it */
568 ua[i] &= ~ua_to_clear;
570 if (ua_to_build == CTL_UA_LUN_CHANGE) {
571 mtx_unlock(&lun->lun_lock);
572 mtx_lock(&lun->ctl_softc->ctl_lock);
573 ctl_clr_ua_allluns(lun->ctl_softc, initidx, ua_to_build);
574 mtx_unlock(&lun->ctl_softc->ctl_lock);
575 mtx_lock(&lun->lun_lock);
576 } else if (ua_to_build == CTL_UA_THIN_PROV_THRES &&
577 (lun->MODE_LBP.main.flags & SLBPP_SITUA) != 0) {
578 ctl_clr_ua_all(lun, -1, ua_to_build);
581 return (ua_to_build);
585 ctl_set_overlapped_cmd(struct ctl_scsiio *ctsio)
587 /* OVERLAPPED COMMANDS ATTEMPTED */
590 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
597 ctl_set_overlapped_tag(struct ctl_scsiio *ctsio, uint8_t tag)
599 /* TAGGED OVERLAPPED COMMANDS (NN = QUEUE TAG) */
602 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
609 * Tell the user that there was a problem with the command or data he sent.
612 ctl_set_invalid_field(struct ctl_scsiio *ctsio, int sks_valid, int command,
613 int field, int bit_valid, int bit)
619 /* "Invalid field in CDB" */
622 /* "Invalid field in parameter list" */
627 sks[0] = SSD_SCS_VALID;
629 sks[0] |= SSD_FIELDPTR_CMD;
630 scsi_ulto2b(field, &sks[1]);
633 sks[0] |= SSD_BITPTR_VALID | bit;
638 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
641 /*type*/ (sks_valid != 0) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
642 /*size*/ sizeof(sks),
647 ctl_set_invalid_field_ciu(struct ctl_scsiio *ctsio)
650 /* "Invalid field in command information unit" */
653 /*sense_key*/ SSD_KEY_ABORTED_COMMAND,
660 ctl_set_invalid_opcode(struct ctl_scsiio *ctsio)
664 sks[0] = SSD_SCS_VALID | SSD_FIELDPTR_CMD;
665 scsi_ulto2b(0, &sks[1]);
667 /* "Invalid command operation code" */
670 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
673 /*type*/ SSD_ELEM_SKS,
674 /*size*/ sizeof(sks),
680 ctl_set_param_len_error(struct ctl_scsiio *ctsio)
682 /* "Parameter list length error" */
685 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
692 ctl_set_already_locked(struct ctl_scsiio *ctsio)
694 /* Vendor unique "Somebody already is locked" */
697 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
704 ctl_set_unsupported_lun(struct ctl_scsiio *ctsio)
706 /* "Logical unit not supported" */
709 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
716 ctl_set_internal_failure(struct ctl_scsiio *ctsio, int sks_valid,
717 uint16_t retry_count)
722 sks[0] = SSD_SCS_VALID;
723 sks[1] = (retry_count >> 8) & 0xff;
724 sks[2] = retry_count & 0xff;
727 /* "Internal target failure" */
730 /*sense_key*/ SSD_KEY_HARDWARE_ERROR,
733 /*type*/ (sks_valid != 0) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
734 /*size*/ sizeof(sks),
740 ctl_set_medium_error(struct ctl_scsiio *ctsio, int read)
743 /* "Unrecovered read error" */
746 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
751 /* "Write error - auto reallocation failed" */
754 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
762 ctl_set_aborted(struct ctl_scsiio *ctsio)
766 /*sense_key*/ SSD_KEY_ABORTED_COMMAND,
773 ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio, uint64_t lba)
777 scsi_u64to8b(lba, info);
779 /* "Logical block address out of range" */
782 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
785 /*type*/ (lba != 0) ? SSD_ELEM_INFO : SSD_ELEM_SKIP,
786 /*size*/ sizeof(info), /*data*/ &info,
791 ctl_set_lun_stopped(struct ctl_scsiio *ctsio)
793 /* "Logical unit not ready, initializing cmd. required" */
796 /*sense_key*/ SSD_KEY_NOT_READY,
803 ctl_set_lun_int_reqd(struct ctl_scsiio *ctsio)
805 /* "Logical unit not ready, manual intervention required" */
808 /*sense_key*/ SSD_KEY_NOT_READY,
815 ctl_set_lun_ejected(struct ctl_scsiio *ctsio)
817 /* "Medium not present - tray open" */
820 /*sense_key*/ SSD_KEY_NOT_READY,
827 ctl_set_lun_no_media(struct ctl_scsiio *ctsio)
829 /* "Medium not present - tray closed" */
832 /*sense_key*/ SSD_KEY_NOT_READY,
839 ctl_set_illegal_pr_release(struct ctl_scsiio *ctsio)
841 /* "Invalid release of persistent reservation" */
844 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
851 ctl_set_lun_transit(struct ctl_scsiio *ctsio)
853 /* "Logical unit not ready, asymmetric access state transition" */
856 /*sense_key*/ SSD_KEY_NOT_READY,
863 ctl_set_lun_standby(struct ctl_scsiio *ctsio)
865 /* "Logical unit not ready, target port in standby state" */
868 /*sense_key*/ SSD_KEY_NOT_READY,
875 ctl_set_lun_unavail(struct ctl_scsiio *ctsio)
877 /* "Logical unit not ready, target port in unavailable state" */
880 /*sense_key*/ SSD_KEY_NOT_READY,
887 ctl_set_medium_format_corrupted(struct ctl_scsiio *ctsio)
889 /* "Medium format corrupted" */
892 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
899 ctl_set_medium_magazine_inaccessible(struct ctl_scsiio *ctsio)
901 /* "Medium magazine not accessible" */
904 /*sense_key*/ SSD_KEY_NOT_READY,
911 ctl_set_data_phase_error(struct ctl_scsiio *ctsio)
913 /* "Data phase error" */
916 /*sense_key*/ SSD_KEY_NOT_READY,
923 ctl_set_reservation_conflict(struct ctl_scsiio *ctsio)
926 ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT;
927 ctsio->sense_len = 0;
928 ctsio->io_hdr.status = CTL_SCSI_ERROR;
932 ctl_set_queue_full(struct ctl_scsiio *ctsio)
935 ctsio->scsi_status = SCSI_STATUS_QUEUE_FULL;
936 ctsio->sense_len = 0;
937 ctsio->io_hdr.status = CTL_SCSI_ERROR;
941 ctl_set_busy(struct ctl_scsiio *ctsio)
944 ctsio->scsi_status = SCSI_STATUS_BUSY;
945 ctsio->sense_len = 0;
946 ctsio->io_hdr.status = CTL_SCSI_ERROR;
950 ctl_set_task_aborted(struct ctl_scsiio *ctsio)
953 ctsio->scsi_status = SCSI_STATUS_TASK_ABORTED;
954 ctsio->sense_len = 0;
955 ctsio->io_hdr.status = CTL_CMD_ABORTED;
959 ctl_set_hw_write_protected(struct ctl_scsiio *ctsio)
961 /* "Hardware write protected" */
964 /*sense_key*/ SSD_KEY_DATA_PROTECT,
971 ctl_set_space_alloc_fail(struct ctl_scsiio *ctsio)
973 /* "Space allocation failed write protect" */
976 /*sense_key*/ SSD_KEY_DATA_PROTECT,
983 ctl_set_success(struct ctl_scsiio *ctsio)
986 ctsio->scsi_status = SCSI_STATUS_OK;
987 ctsio->sense_len = 0;
988 ctsio->io_hdr.status = CTL_SUCCESS;