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 * SPC-3 and up require some UAs to be returned as fixed.
86 if (asc == 0x29 || (asc == 0x2A && ascq == 0x01))
87 sense_format = SSD_TYPE_FIXED;
90 * If the format isn't specified, we only return descriptor
91 * sense if the LUN exists and descriptor sense is turned
94 if ((lun != NULL) && (lun->MODE_CTRL.rlec & SCP_DSENSE))
95 sense_format = SSD_TYPE_DESC;
97 sense_format = SSD_TYPE_FIXED;
101 * Determine maximum sense data length to return.
103 if (*sense_len == 0) {
104 if ((lun != NULL) && (lun->MODE_CTRLE.max_sense != 0))
105 *sense_len = lun->MODE_CTRLE.max_sense;
107 *sense_len = SSD_FULL_SIZE;
110 scsi_set_sense_data_va(sense_data, sense_len, sense_format,
111 current_error, sense_key, asc, ascq, ap);
115 ctl_set_sense_data(struct scsi_sense_data *sense_data, u_int *sense_len,
116 void *lunptr, scsi_sense_data_type sense_format, int current_error,
117 int sense_key, int asc, int ascq, ...)
122 ctl_set_sense_data_va(sense_data, sense_len, lunptr, sense_format,
123 current_error, sense_key, asc, ascq, ap);
128 ctl_set_sense(struct ctl_scsiio *ctsio, int current_error, int sense_key,
129 int asc, int ascq, ...)
136 * The LUN can't go away until all of the commands have been
137 * completed. Therefore we can safely access the LUN structure and
138 * flags without the lock.
140 lun = CTL_LUN(ctsio);
144 ctl_set_sense_data_va(&ctsio->sense_data, &sense_len,
154 ctsio->scsi_status = SCSI_STATUS_CHECK_COND;
155 ctsio->sense_len = sense_len;
156 ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE;
160 * Transform fixed sense data into descriptor sense data.
162 * For simplicity's sake, we assume that both sense structures are
163 * SSD_FULL_SIZE. Otherwise, the logic gets more complicated.
166 ctl_sense_to_desc(struct scsi_sense_data_fixed *sense_src,
167 struct scsi_sense_data_desc *sense_dest)
169 struct scsi_sense_stream stream_sense;
174 bzero(sense_dest, sizeof(*sense_dest));
176 if ((sense_src->error_code & SSD_ERRCODE) == SSD_DEFERRED_ERROR)
181 bzero(&stream_sense, sizeof(stream_sense));
184 * Check to see whether any of the tape-specific bits are set. If
185 * so, we'll need a stream sense descriptor.
187 if (sense_src->flags & (SSD_ILI|SSD_EOM|SSD_FILEMARK))
188 stream_bits = sense_src->flags & ~SSD_KEY;
193 * Utilize our sense setting routine to do the transform. If a
194 * value is set in the fixed sense data, set it in the descriptor
195 * data. Otherwise, skip it.
197 sense_len = SSD_FULL_SIZE;
198 ctl_set_sense_data((struct scsi_sense_data *)sense_dest, &sense_len,
200 /*sense_format*/ SSD_TYPE_DESC,
202 /*sense_key*/ sense_src->flags & SSD_KEY,
203 /*asc*/ sense_src->add_sense_code,
204 /*ascq*/ sense_src->add_sense_code_qual,
206 /* Information Bytes */
207 (sense_src->error_code & SSD_ERRCODE_VALID) ?
208 SSD_ELEM_INFO : SSD_ELEM_SKIP,
209 sizeof(sense_src->info),
212 /* Command specific bytes */
213 (scsi_4btoul(sense_src->cmd_spec_info) != 0) ?
214 SSD_ELEM_COMMAND : SSD_ELEM_SKIP,
215 sizeof(sense_src->cmd_spec_info),
216 sense_src->cmd_spec_info,
219 (sense_src->fru != 0) ?
220 SSD_ELEM_FRU : SSD_ELEM_SKIP,
221 sizeof(sense_src->fru),
224 /* Sense Key Specific */
225 (sense_src->sense_key_spec[0] & SSD_SCS_VALID) ?
226 SSD_ELEM_SKS : SSD_ELEM_SKIP,
227 sizeof(sense_src->sense_key_spec),
228 sense_src->sense_key_spec,
232 SSD_ELEM_STREAM : SSD_ELEM_SKIP,
240 * Transform descriptor format sense data into fixed sense data.
242 * Some data may be lost in translation, because there are descriptors
243 * thant can't be represented as fixed sense data.
245 * For simplicity's sake, we assume that both sense structures are
246 * SSD_FULL_SIZE. Otherwise, the logic gets more complicated.
249 ctl_sense_to_fixed(struct scsi_sense_data_desc *sense_src,
250 struct scsi_sense_data_fixed *sense_dest)
253 uint8_t *info_ptr = NULL, *cmd_ptr = NULL, *fru_ptr = NULL;
254 uint8_t *sks_ptr = NULL, *stream_ptr = NULL;
255 int info_size = 0, cmd_size = 0, fru_size = 0;
256 int sks_size = 0, stream_size = 0;
260 if ((sense_src->error_code & SSD_ERRCODE) == SSD_DESC_CURRENT_ERROR)
265 for (pos = 0; pos < (int)(sense_src->extra_len - 1);) {
266 struct scsi_sense_desc_header *header;
268 header = (struct scsi_sense_desc_header *)
269 &sense_src->sense_desc[pos];
272 * See if this record goes past the end of the sense data.
273 * It shouldn't, but check just in case.
275 if ((pos + header->length + sizeof(*header)) >
276 sense_src->extra_len)
279 switch (sense_src->sense_desc[pos]) {
280 case SSD_DESC_INFO: {
281 struct scsi_sense_info *info;
283 info = (struct scsi_sense_info *)header;
285 info_ptr = info->info;
286 info_size = sizeof(info->info);
288 pos += info->length +
289 sizeof(struct scsi_sense_desc_header);
292 case SSD_DESC_COMMAND: {
293 struct scsi_sense_command *cmd;
295 cmd = (struct scsi_sense_command *)header;
296 cmd_ptr = cmd->command_info;
297 cmd_size = sizeof(cmd->command_info);
300 sizeof(struct scsi_sense_desc_header);
304 struct scsi_sense_fru *fru;
306 fru = (struct scsi_sense_fru *)header;
308 fru_size = sizeof(fru->fru);
310 sizeof(struct scsi_sense_desc_header);
314 struct scsi_sense_sks *sks;
316 sks = (struct scsi_sense_sks *)header;
317 sks_ptr = sks->sense_key_spec;
318 sks_size = sizeof(sks->sense_key_spec);
321 sizeof(struct scsi_sense_desc_header);
324 case SSD_DESC_STREAM: {
325 struct scsi_sense_stream *stream_sense;
327 stream_sense = (struct scsi_sense_stream *)header;
328 stream_ptr = &stream_sense->byte3;
329 stream_size = sizeof(stream_sense->byte3);
330 pos = stream_sense->length +
331 sizeof(struct scsi_sense_desc_header);
336 * We don't recognize this particular sense
337 * descriptor type, so just skip it.
339 pos += sizeof(*header) + header->length;
344 sense_len = SSD_FULL_SIZE;
345 ctl_set_sense_data((struct scsi_sense_data *)sense_dest, &sense_len,
347 /*sense_format*/ SSD_TYPE_FIXED,
349 /*sense_key*/ sense_src->sense_key & SSD_KEY,
350 /*asc*/ sense_src->add_sense_code,
351 /*ascq*/ sense_src->add_sense_code_qual,
353 /* Information Bytes */
354 (info_ptr != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP,
358 /* Command specific bytes */
359 (cmd_ptr != NULL) ? SSD_ELEM_COMMAND : SSD_ELEM_SKIP,
364 (fru_ptr != NULL) ? SSD_ELEM_FRU : SSD_ELEM_SKIP,
368 /* Sense Key Specific */
369 (sks_ptr != NULL) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
374 (stream_ptr != NULL) ? SSD_ELEM_STREAM : SSD_ELEM_SKIP,
382 ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq)
386 /*sense_key*/ SSD_KEY_UNIT_ATTENTION,
393 ctl_ua_to_ascq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc,
394 int *ascq, ctl_ua_type *ua_to_clear, uint8_t **info)
397 switch (ua_to_build) {
399 /* 29h/01h POWER ON OCCURRED */
404 case CTL_UA_BUS_RESET:
405 /* 29h/02h SCSI BUS RESET OCCURRED */
410 case CTL_UA_TARG_RESET:
411 /* 29h/03h BUS DEVICE RESET FUNCTION OCCURRED*/
416 case CTL_UA_I_T_NEXUS_LOSS:
417 /* 29h/07h I_T NEXUS LOSS OCCURRED */
422 case CTL_UA_LUN_RESET:
423 /* 29h/00h POWER ON, RESET, OR BUS DEVICE RESET OCCURRED */
425 * Since we don't have a specific ASC/ASCQ pair for a LUN
426 * reset, just return the generic reset code.
431 case CTL_UA_LUN_CHANGE:
432 /* 3Fh/0Eh REPORTED LUNS DATA HAS CHANGED */
436 case CTL_UA_MODE_CHANGE:
437 /* 2Ah/01h MODE PARAMETERS CHANGED */
441 case CTL_UA_LOG_CHANGE:
442 /* 2Ah/02h LOG PARAMETERS CHANGED */
446 case CTL_UA_INQ_CHANGE:
447 /* 3Fh/03h INQUIRY DATA HAS CHANGED */
451 case CTL_UA_RES_PREEMPT:
452 /* 2Ah/03h RESERVATIONS PREEMPTED */
456 case CTL_UA_RES_RELEASE:
457 /* 2Ah/04h RESERVATIONS RELEASED */
461 case CTL_UA_REG_PREEMPT:
462 /* 2Ah/05h REGISTRATIONS PREEMPTED */
466 case CTL_UA_ASYM_ACC_CHANGE:
467 /* 2Ah/06h ASYMMETRIC ACCESS STATE CHANGED */
471 case CTL_UA_CAPACITY_CHANGE:
472 /* 2Ah/09h CAPACITY DATA HAS CHANGED */
476 case CTL_UA_THIN_PROV_THRES:
477 /* 38h/07h THIN PROVISIONING SOFT THRESHOLD REACHED */
480 *info = lun->ua_tpt_info;
482 case CTL_UA_MEDIUM_CHANGE:
483 /* 28h/00h NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED */
488 /* Informational exception */
490 *ascq = lun->ie_ascq;
493 panic("%s: Unknown UA %x", __func__, ua_to_build);
498 ctl_build_qae(struct ctl_lun *lun, uint32_t initidx, uint8_t *resp)
501 ctl_ua_type ua_to_build, ua_to_clear;
506 mtx_assert(&lun->lun_lock, MA_OWNED);
507 p = initidx / CTL_MAX_INIT_PER_PORT;
508 i = initidx % CTL_MAX_INIT_PER_PORT;
509 if (lun->pending_ua[p] == NULL)
512 ua = lun->pending_ua[p][i];
513 if (ua == CTL_UA_NONE)
514 return (CTL_UA_NONE);
516 ua_to_build = (1 << (ffs(ua) - 1));
517 ua_to_clear = ua_to_build;
519 ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
521 resp[0] = SSD_KEY_UNIT_ATTENTION;
522 if (ua_to_build == ua)
528 return (ua_to_build);
532 ctl_build_ua(struct ctl_lun *lun, uint32_t initidx,
533 struct scsi_sense_data *sense, u_int *sense_len,
534 scsi_sense_data_type sense_format)
537 ctl_ua_type ua_to_build, ua_to_clear;
542 mtx_assert(&lun->lun_lock, MA_OWNED);
543 mtx_assert(&lun->ctl_softc->ctl_lock, MA_NOTOWNED);
544 p = initidx / CTL_MAX_INIT_PER_PORT;
545 if ((ua = lun->pending_ua[p]) == NULL) {
546 mtx_unlock(&lun->lun_lock);
547 ua = malloc(sizeof(ctl_ua_type) * CTL_MAX_INIT_PER_PORT,
549 mtx_lock(&lun->lun_lock);
550 if (lun->pending_ua[p] == NULL) {
551 lun->pending_ua[p] = ua;
552 for (i = 0; i < CTL_MAX_INIT_PER_PORT; i++)
553 ua[i] = CTL_UA_POWERON;
556 ua = lun->pending_ua[p];
559 i = initidx % CTL_MAX_INIT_PER_PORT;
560 if (ua[i] == CTL_UA_NONE)
561 return (CTL_UA_NONE);
563 ua_to_build = (1 << (ffs(ua[i]) - 1));
564 ua_to_clear = ua_to_build;
566 ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
568 ctl_set_sense_data(sense, sense_len, lun, sense_format, 1,
569 /*sense_key*/ SSD_KEY_UNIT_ATTENTION, asc, ascq,
570 ((info != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP), 8, info,
573 /* We're reporting this UA, so clear it */
574 ua[i] &= ~ua_to_clear;
576 if (ua_to_build == CTL_UA_LUN_CHANGE) {
577 mtx_unlock(&lun->lun_lock);
578 mtx_lock(&lun->ctl_softc->ctl_lock);
579 ctl_clr_ua_allluns(lun->ctl_softc, initidx, ua_to_build);
580 mtx_unlock(&lun->ctl_softc->ctl_lock);
581 mtx_lock(&lun->lun_lock);
582 } else if (ua_to_build == CTL_UA_THIN_PROV_THRES &&
583 (lun->MODE_LBP.main.flags & SLBPP_SITUA) != 0) {
584 ctl_clr_ua_all(lun, -1, ua_to_build);
587 return (ua_to_build);
591 ctl_set_overlapped_cmd(struct ctl_scsiio *ctsio)
593 /* OVERLAPPED COMMANDS ATTEMPTED */
596 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
603 ctl_set_overlapped_tag(struct ctl_scsiio *ctsio, uint8_t tag)
605 /* TAGGED OVERLAPPED COMMANDS (NN = QUEUE TAG) */
608 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
615 * Tell the user that there was a problem with the command or data he sent.
618 ctl_set_invalid_field(struct ctl_scsiio *ctsio, int sks_valid, int command,
619 int field, int bit_valid, int bit)
625 /* "Invalid field in CDB" */
628 /* "Invalid field in parameter list" */
633 sks[0] = SSD_SCS_VALID;
635 sks[0] |= SSD_FIELDPTR_CMD;
636 scsi_ulto2b(field, &sks[1]);
639 sks[0] |= SSD_BITPTR_VALID | bit;
644 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
647 /*type*/ (sks_valid != 0) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
648 /*size*/ sizeof(sks),
653 ctl_set_invalid_field_ciu(struct ctl_scsiio *ctsio)
656 /* "Invalid field in command information unit" */
659 /*sense_key*/ SSD_KEY_ABORTED_COMMAND,
666 ctl_set_invalid_opcode(struct ctl_scsiio *ctsio)
670 sks[0] = SSD_SCS_VALID | SSD_FIELDPTR_CMD;
671 scsi_ulto2b(0, &sks[1]);
673 /* "Invalid command operation code" */
676 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
679 /*type*/ SSD_ELEM_SKS,
680 /*size*/ sizeof(sks),
686 ctl_set_param_len_error(struct ctl_scsiio *ctsio)
688 /* "Parameter list length error" */
691 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
698 ctl_set_already_locked(struct ctl_scsiio *ctsio)
700 /* Vendor unique "Somebody already is locked" */
703 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
710 ctl_set_unsupported_lun(struct ctl_scsiio *ctsio)
712 /* "Logical unit not supported" */
715 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
722 ctl_set_internal_failure(struct ctl_scsiio *ctsio, int sks_valid,
723 uint16_t retry_count)
728 sks[0] = SSD_SCS_VALID;
729 sks[1] = (retry_count >> 8) & 0xff;
730 sks[2] = retry_count & 0xff;
733 /* "Internal target failure" */
736 /*sense_key*/ SSD_KEY_HARDWARE_ERROR,
739 /*type*/ (sks_valid != 0) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
740 /*size*/ sizeof(sks),
746 ctl_set_medium_error(struct ctl_scsiio *ctsio, int read)
749 /* "Unrecovered read error" */
752 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
757 /* "Write error - auto reallocation failed" */
760 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
768 ctl_set_aborted(struct ctl_scsiio *ctsio)
772 /*sense_key*/ SSD_KEY_ABORTED_COMMAND,
779 ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio, uint64_t lba)
783 scsi_u64to8b(lba, info);
785 /* "Logical block address out of range" */
788 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
791 /*type*/ (lba != 0) ? SSD_ELEM_INFO : SSD_ELEM_SKIP,
792 /*size*/ sizeof(info), /*data*/ &info,
797 ctl_set_lun_stopped(struct ctl_scsiio *ctsio)
799 /* "Logical unit not ready, initializing cmd. required" */
802 /*sense_key*/ SSD_KEY_NOT_READY,
809 ctl_set_lun_int_reqd(struct ctl_scsiio *ctsio)
811 /* "Logical unit not ready, manual intervention required" */
814 /*sense_key*/ SSD_KEY_NOT_READY,
821 ctl_set_lun_ejected(struct ctl_scsiio *ctsio)
823 /* "Medium not present - tray open" */
826 /*sense_key*/ SSD_KEY_NOT_READY,
833 ctl_set_lun_no_media(struct ctl_scsiio *ctsio)
835 /* "Medium not present - tray closed" */
838 /*sense_key*/ SSD_KEY_NOT_READY,
845 ctl_set_illegal_pr_release(struct ctl_scsiio *ctsio)
847 /* "Invalid release of persistent reservation" */
850 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
857 ctl_set_lun_transit(struct ctl_scsiio *ctsio)
859 /* "Logical unit not ready, asymmetric access state transition" */
862 /*sense_key*/ SSD_KEY_NOT_READY,
869 ctl_set_lun_standby(struct ctl_scsiio *ctsio)
871 /* "Logical unit not ready, target port in standby state" */
874 /*sense_key*/ SSD_KEY_NOT_READY,
881 ctl_set_lun_unavail(struct ctl_scsiio *ctsio)
883 /* "Logical unit not ready, target port in unavailable state" */
886 /*sense_key*/ SSD_KEY_NOT_READY,
893 ctl_set_medium_format_corrupted(struct ctl_scsiio *ctsio)
895 /* "Medium format corrupted" */
898 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
905 ctl_set_medium_magazine_inaccessible(struct ctl_scsiio *ctsio)
907 /* "Medium magazine not accessible" */
910 /*sense_key*/ SSD_KEY_NOT_READY,
917 ctl_set_data_phase_error(struct ctl_scsiio *ctsio)
919 /* "Data phase error" */
922 /*sense_key*/ SSD_KEY_NOT_READY,
929 ctl_set_reservation_conflict(struct ctl_scsiio *ctsio)
932 ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT;
933 ctsio->sense_len = 0;
934 ctsio->io_hdr.status = CTL_SCSI_ERROR;
938 ctl_set_queue_full(struct ctl_scsiio *ctsio)
941 ctsio->scsi_status = SCSI_STATUS_QUEUE_FULL;
942 ctsio->sense_len = 0;
943 ctsio->io_hdr.status = CTL_SCSI_ERROR;
947 ctl_set_busy(struct ctl_scsiio *ctsio)
950 ctsio->scsi_status = SCSI_STATUS_BUSY;
951 ctsio->sense_len = 0;
952 ctsio->io_hdr.status = CTL_SCSI_ERROR;
956 ctl_set_task_aborted(struct ctl_scsiio *ctsio)
959 ctsio->scsi_status = SCSI_STATUS_TASK_ABORTED;
960 ctsio->sense_len = 0;
961 ctsio->io_hdr.status = CTL_CMD_ABORTED;
965 ctl_set_hw_write_protected(struct ctl_scsiio *ctsio)
967 /* "Hardware write protected" */
970 /*sense_key*/ SSD_KEY_DATA_PROTECT,
977 ctl_set_space_alloc_fail(struct ctl_scsiio *ctsio)
979 /* "Space allocation failed write protect" */
982 /*sense_key*/ SSD_KEY_DATA_PROTECT,
989 ctl_set_success(struct ctl_scsiio *ctsio)
992 ctsio->scsi_status = SCSI_STATUS_OK;
993 ctsio->sense_len = 0;
994 ctsio->io_hdr.status = CTL_SUCCESS;