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, void *lunptr,
69 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;
92 scsi_set_sense_data_va(sense_data, sense_format, current_error,
93 sense_key, asc, ascq, ap);
97 ctl_set_sense_data(struct scsi_sense_data *sense_data, void *lunptr,
98 scsi_sense_data_type sense_format, int current_error,
99 int sense_key, int asc, int ascq, ...)
104 ctl_set_sense_data_va(sense_data, lunptr, sense_format, current_error,
105 sense_key, asc, ascq, ap);
110 ctl_set_sense(struct ctl_scsiio *ctsio, int current_error, int sense_key,
111 int asc, int ascq, ...)
117 * The LUN can't go away until all of the commands have been
118 * completed. Therefore we can safely access the LUN structure and
119 * flags without the lock.
121 lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
124 ctl_set_sense_data_va(&ctsio->sense_data,
134 ctsio->scsi_status = SCSI_STATUS_CHECK_COND;
135 ctsio->sense_len = SSD_FULL_SIZE;
136 ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE;
140 * Transform fixed sense data into descriptor sense data.
142 * For simplicity's sake, we assume that both sense structures are
143 * SSD_FULL_SIZE. Otherwise, the logic gets more complicated.
146 ctl_sense_to_desc(struct scsi_sense_data_fixed *sense_src,
147 struct scsi_sense_data_desc *sense_dest)
149 struct scsi_sense_stream stream_sense;
153 bzero(sense_dest, sizeof(*sense_dest));
155 if ((sense_src->error_code & SSD_ERRCODE) == SSD_DEFERRED_ERROR)
160 bzero(&stream_sense, sizeof(stream_sense));
163 * Check to see whether any of the tape-specific bits are set. If
164 * so, we'll need a stream sense descriptor.
166 if (sense_src->flags & (SSD_ILI|SSD_EOM|SSD_FILEMARK))
167 stream_bits = sense_src->flags & ~SSD_KEY;
172 * Utilize our sense setting routine to do the transform. If a
173 * value is set in the fixed sense data, set it in the descriptor
174 * data. Otherwise, skip it.
176 ctl_set_sense_data((struct scsi_sense_data *)sense_dest,
178 /*sense_format*/ SSD_TYPE_DESC,
180 /*sense_key*/ sense_src->flags & SSD_KEY,
181 /*asc*/ sense_src->add_sense_code,
182 /*ascq*/ sense_src->add_sense_code_qual,
184 /* Information Bytes */
185 (sense_src->error_code & SSD_ERRCODE_VALID) ?
186 SSD_ELEM_INFO : SSD_ELEM_SKIP,
187 sizeof(sense_src->info),
190 /* Command specific bytes */
191 (scsi_4btoul(sense_src->cmd_spec_info) != 0) ?
192 SSD_ELEM_COMMAND : SSD_ELEM_SKIP,
193 sizeof(sense_src->cmd_spec_info),
194 sense_src->cmd_spec_info,
197 (sense_src->fru != 0) ?
198 SSD_ELEM_FRU : SSD_ELEM_SKIP,
199 sizeof(sense_src->fru),
202 /* Sense Key Specific */
203 (sense_src->sense_key_spec[0] & SSD_SCS_VALID) ?
204 SSD_ELEM_SKS : SSD_ELEM_SKIP,
205 sizeof(sense_src->sense_key_spec),
206 sense_src->sense_key_spec,
210 SSD_ELEM_STREAM : SSD_ELEM_SKIP,
218 * Transform descriptor format sense data into fixed sense data.
220 * Some data may be lost in translation, because there are descriptors
221 * thant can't be represented as fixed sense data.
223 * For simplicity's sake, we assume that both sense structures are
224 * SSD_FULL_SIZE. Otherwise, the logic gets more complicated.
227 ctl_sense_to_fixed(struct scsi_sense_data_desc *sense_src,
228 struct scsi_sense_data_fixed *sense_dest)
231 uint8_t *info_ptr = NULL, *cmd_ptr = NULL, *fru_ptr = NULL;
232 uint8_t *sks_ptr = NULL, *stream_ptr = NULL;
233 int info_size = 0, cmd_size = 0, fru_size = 0;
234 int sks_size = 0, stream_size = 0;
237 if ((sense_src->error_code & SSD_ERRCODE) == SSD_DESC_CURRENT_ERROR)
242 for (pos = 0; pos < (int)(sense_src->extra_len - 1);) {
243 struct scsi_sense_desc_header *header;
245 header = (struct scsi_sense_desc_header *)
246 &sense_src->sense_desc[pos];
249 * See if this record goes past the end of the sense data.
250 * It shouldn't, but check just in case.
252 if ((pos + header->length + sizeof(*header)) >
253 sense_src->extra_len)
256 switch (sense_src->sense_desc[pos]) {
257 case SSD_DESC_INFO: {
258 struct scsi_sense_info *info;
260 info = (struct scsi_sense_info *)header;
262 info_ptr = info->info;
263 info_size = sizeof(info->info);
265 pos += info->length +
266 sizeof(struct scsi_sense_desc_header);
269 case SSD_DESC_COMMAND: {
270 struct scsi_sense_command *cmd;
272 cmd = (struct scsi_sense_command *)header;
273 cmd_ptr = cmd->command_info;
274 cmd_size = sizeof(cmd->command_info);
277 sizeof(struct scsi_sense_desc_header);
281 struct scsi_sense_fru *fru;
283 fru = (struct scsi_sense_fru *)header;
285 fru_size = sizeof(fru->fru);
287 sizeof(struct scsi_sense_desc_header);
291 struct scsi_sense_sks *sks;
293 sks = (struct scsi_sense_sks *)header;
294 sks_ptr = sks->sense_key_spec;
295 sks_size = sizeof(sks->sense_key_spec);
298 sizeof(struct scsi_sense_desc_header);
301 case SSD_DESC_STREAM: {
302 struct scsi_sense_stream *stream_sense;
304 stream_sense = (struct scsi_sense_stream *)header;
305 stream_ptr = &stream_sense->byte3;
306 stream_size = sizeof(stream_sense->byte3);
307 pos = stream_sense->length +
308 sizeof(struct scsi_sense_desc_header);
313 * We don't recognize this particular sense
314 * descriptor type, so just skip it.
316 pos += sizeof(*header) + header->length;
321 ctl_set_sense_data((struct scsi_sense_data *)sense_dest,
323 /*sense_format*/ SSD_TYPE_FIXED,
325 /*sense_key*/ sense_src->sense_key & SSD_KEY,
326 /*asc*/ sense_src->add_sense_code,
327 /*ascq*/ sense_src->add_sense_code_qual,
329 /* Information Bytes */
330 (info_ptr != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP,
334 /* Command specific bytes */
335 (cmd_ptr != NULL) ? SSD_ELEM_COMMAND : SSD_ELEM_SKIP,
340 (fru_ptr != NULL) ? SSD_ELEM_FRU : SSD_ELEM_SKIP,
344 /* Sense Key Specific */
345 (sks_ptr != NULL) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
350 (stream_ptr != NULL) ? SSD_ELEM_STREAM : SSD_ELEM_SKIP,
358 ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq)
362 /*sense_key*/ SSD_KEY_UNIT_ATTENTION,
369 ctl_ua_to_ascq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc,
370 int *ascq, ctl_ua_type *ua_to_clear, uint8_t **info)
373 switch (ua_to_build) {
375 /* 29h/01h POWER ON OCCURRED */
380 case CTL_UA_BUS_RESET:
381 /* 29h/02h SCSI BUS RESET OCCURRED */
386 case CTL_UA_TARG_RESET:
387 /* 29h/03h BUS DEVICE RESET FUNCTION OCCURRED*/
392 case CTL_UA_I_T_NEXUS_LOSS:
393 /* 29h/07h I_T NEXUS LOSS OCCURRED */
398 case CTL_UA_LUN_RESET:
399 /* 29h/00h POWER ON, RESET, OR BUS DEVICE RESET OCCURRED */
401 * Since we don't have a specific ASC/ASCQ pair for a LUN
402 * reset, just return the generic reset code.
407 case CTL_UA_LUN_CHANGE:
408 /* 3Fh/0Eh REPORTED LUNS DATA HAS CHANGED */
412 case CTL_UA_MODE_CHANGE:
413 /* 2Ah/01h MODE PARAMETERS CHANGED */
417 case CTL_UA_LOG_CHANGE:
418 /* 2Ah/02h LOG PARAMETERS CHANGED */
422 case CTL_UA_INQ_CHANGE:
423 /* 3Fh/03h INQUIRY DATA HAS CHANGED */
427 case CTL_UA_RES_PREEMPT:
428 /* 2Ah/03h RESERVATIONS PREEMPTED */
432 case CTL_UA_RES_RELEASE:
433 /* 2Ah/04h RESERVATIONS RELEASED */
437 case CTL_UA_REG_PREEMPT:
438 /* 2Ah/05h REGISTRATIONS PREEMPTED */
442 case CTL_UA_ASYM_ACC_CHANGE:
443 /* 2Ah/06h ASYMMETRIC ACCESS STATE CHANGED */
447 case CTL_UA_CAPACITY_CHANGE:
448 /* 2Ah/09h CAPACITY DATA HAS CHANGED */
452 case CTL_UA_THIN_PROV_THRES:
453 /* 38h/07h THIN PROVISIONING SOFT THRESHOLD REACHED */
456 *info = lun->ua_tpt_info;
458 case CTL_UA_MEDIUM_CHANGE:
459 /* 28h/00h NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED */
464 /* Informational exception */
466 *ascq = lun->ie_ascq;
469 panic("%s: Unknown UA %x", __func__, ua_to_build);
474 ctl_build_qae(struct ctl_lun *lun, uint32_t initidx, uint8_t *resp)
477 ctl_ua_type ua_to_build, ua_to_clear;
482 mtx_assert(&lun->lun_lock, MA_OWNED);
483 p = initidx / CTL_MAX_INIT_PER_PORT;
484 i = initidx % CTL_MAX_INIT_PER_PORT;
485 if (lun->pending_ua[p] == NULL)
488 ua = lun->pending_ua[p][i];
489 if (ua == CTL_UA_NONE)
490 return (CTL_UA_NONE);
492 ua_to_build = (1 << (ffs(ua) - 1));
493 ua_to_clear = ua_to_build;
495 ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
497 resp[0] = SSD_KEY_UNIT_ATTENTION;
498 if (ua_to_build == ua)
508 ctl_build_ua(struct ctl_lun *lun, uint32_t initidx,
509 struct scsi_sense_data *sense, scsi_sense_data_type sense_format)
512 ctl_ua_type ua_to_build, ua_to_clear;
517 mtx_assert(&lun->lun_lock, MA_OWNED);
518 mtx_assert(&lun->ctl_softc->ctl_lock, MA_NOTOWNED);
519 p = initidx / CTL_MAX_INIT_PER_PORT;
520 if ((ua = lun->pending_ua[p]) == NULL) {
521 mtx_unlock(&lun->lun_lock);
522 ua = malloc(sizeof(ctl_ua_type) * CTL_MAX_INIT_PER_PORT,
524 mtx_lock(&lun->lun_lock);
525 if (lun->pending_ua[p] == NULL) {
526 lun->pending_ua[p] = ua;
527 for (i = 0; i < CTL_MAX_INIT_PER_PORT; i++)
528 ua[i] = CTL_UA_POWERON;
531 ua = lun->pending_ua[p];
534 i = initidx % CTL_MAX_INIT_PER_PORT;
535 if (ua[i] == CTL_UA_NONE)
536 return (CTL_UA_NONE);
538 ua_to_build = (1 << (ffs(ua[i]) - 1));
539 ua_to_clear = ua_to_build;
541 ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info);
543 ctl_set_sense_data(sense, lun, sense_format, /*current_error*/ 1,
544 /*sense_key*/ SSD_KEY_UNIT_ATTENTION, asc, ascq,
545 ((info != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP), 8, info,
548 /* We're reporting this UA, so clear it */
549 ua[i] &= ~ua_to_clear;
551 if (ua_to_build == CTL_UA_LUN_CHANGE) {
552 mtx_unlock(&lun->lun_lock);
553 mtx_lock(&lun->ctl_softc->ctl_lock);
554 ctl_clr_ua_allluns(lun->ctl_softc, initidx, ua_to_build);
555 mtx_unlock(&lun->ctl_softc->ctl_lock);
556 mtx_lock(&lun->lun_lock);
557 } else if (ua_to_build == CTL_UA_THIN_PROV_THRES &&
558 (lun->MODE_LBP.main.flags & SLBPP_SITUA) != 0) {
559 ctl_clr_ua_all(lun, -1, ua_to_build);
562 return (ua_to_build);
566 ctl_set_overlapped_cmd(struct ctl_scsiio *ctsio)
568 /* OVERLAPPED COMMANDS ATTEMPTED */
571 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
578 ctl_set_overlapped_tag(struct ctl_scsiio *ctsio, uint8_t tag)
580 /* TAGGED OVERLAPPED COMMANDS (NN = QUEUE TAG) */
583 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
590 * Tell the user that there was a problem with the command or data he sent.
593 ctl_set_invalid_field(struct ctl_scsiio *ctsio, int sks_valid, int command,
594 int field, int bit_valid, int bit)
600 /* "Invalid field in CDB" */
603 /* "Invalid field in parameter list" */
608 sks[0] = SSD_SCS_VALID;
610 sks[0] |= SSD_FIELDPTR_CMD;
611 scsi_ulto2b(field, &sks[1]);
614 sks[0] |= SSD_BITPTR_VALID | bit;
619 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
622 /*type*/ (sks_valid != 0) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
623 /*size*/ sizeof(sks),
629 ctl_set_invalid_opcode(struct ctl_scsiio *ctsio)
633 sks[0] = SSD_SCS_VALID | SSD_FIELDPTR_CMD;
634 scsi_ulto2b(0, &sks[1]);
636 /* "Invalid command operation code" */
639 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
642 /*type*/ SSD_ELEM_SKS,
643 /*size*/ sizeof(sks),
649 ctl_set_param_len_error(struct ctl_scsiio *ctsio)
651 /* "Parameter list length error" */
654 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
661 ctl_set_already_locked(struct ctl_scsiio *ctsio)
663 /* Vendor unique "Somebody already is locked" */
666 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
673 ctl_set_unsupported_lun(struct ctl_scsiio *ctsio)
675 /* "Logical unit not supported" */
678 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
685 ctl_set_internal_failure(struct ctl_scsiio *ctsio, int sks_valid,
686 uint16_t retry_count)
691 sks[0] = SSD_SCS_VALID;
692 sks[1] = (retry_count >> 8) & 0xff;
693 sks[2] = retry_count & 0xff;
696 /* "Internal target failure" */
699 /*sense_key*/ SSD_KEY_HARDWARE_ERROR,
702 /*type*/ (sks_valid != 0) ? SSD_ELEM_SKS : SSD_ELEM_SKIP,
703 /*size*/ sizeof(sks),
709 ctl_set_medium_error(struct ctl_scsiio *ctsio, int read)
712 /* "Unrecovered read error" */
715 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
720 /* "Write error - auto reallocation failed" */
723 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
731 ctl_set_aborted(struct ctl_scsiio *ctsio)
735 /*sense_key*/ SSD_KEY_ABORTED_COMMAND,
742 ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio, uint64_t lba)
746 scsi_u64to8b(lba, info);
748 /* "Logical block address out of range" */
751 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
754 /*type*/ (lba != 0) ? SSD_ELEM_INFO : SSD_ELEM_SKIP,
755 /*size*/ sizeof(info), /*data*/ &info,
760 ctl_set_lun_stopped(struct ctl_scsiio *ctsio)
762 /* "Logical unit not ready, initializing cmd. required" */
765 /*sense_key*/ SSD_KEY_NOT_READY,
772 ctl_set_lun_int_reqd(struct ctl_scsiio *ctsio)
774 /* "Logical unit not ready, manual intervention required" */
777 /*sense_key*/ SSD_KEY_NOT_READY,
784 ctl_set_lun_ejected(struct ctl_scsiio *ctsio)
786 /* "Medium not present - tray open" */
789 /*sense_key*/ SSD_KEY_NOT_READY,
796 ctl_set_lun_no_media(struct ctl_scsiio *ctsio)
798 /* "Medium not present - tray closed" */
801 /*sense_key*/ SSD_KEY_NOT_READY,
808 ctl_set_illegal_pr_release(struct ctl_scsiio *ctsio)
810 /* "Invalid release of persistent reservation" */
813 /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
820 ctl_set_lun_transit(struct ctl_scsiio *ctsio)
822 /* "Logical unit not ready, asymmetric access state transition" */
825 /*sense_key*/ SSD_KEY_NOT_READY,
832 ctl_set_lun_standby(struct ctl_scsiio *ctsio)
834 /* "Logical unit not ready, target port in standby state" */
837 /*sense_key*/ SSD_KEY_NOT_READY,
844 ctl_set_lun_unavail(struct ctl_scsiio *ctsio)
846 /* "Logical unit not ready, target port in unavailable state" */
849 /*sense_key*/ SSD_KEY_NOT_READY,
856 ctl_set_medium_format_corrupted(struct ctl_scsiio *ctsio)
858 /* "Medium format corrupted" */
861 /*sense_key*/ SSD_KEY_MEDIUM_ERROR,
868 ctl_set_medium_magazine_inaccessible(struct ctl_scsiio *ctsio)
870 /* "Medium magazine not accessible" */
873 /*sense_key*/ SSD_KEY_NOT_READY,
880 ctl_set_data_phase_error(struct ctl_scsiio *ctsio)
882 /* "Data phase error" */
885 /*sense_key*/ SSD_KEY_NOT_READY,
892 ctl_set_reservation_conflict(struct ctl_scsiio *ctsio)
894 struct scsi_sense_data *sense;
896 sense = &ctsio->sense_data;
897 memset(sense, 0, sizeof(*sense));
898 ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT;
899 ctsio->sense_len = 0;
900 ctsio->io_hdr.status = CTL_SCSI_ERROR;
904 ctl_set_queue_full(struct ctl_scsiio *ctsio)
906 struct scsi_sense_data *sense;
908 sense = &ctsio->sense_data;
909 memset(sense, 0, sizeof(*sense));
910 ctsio->scsi_status = SCSI_STATUS_QUEUE_FULL;
911 ctsio->sense_len = 0;
912 ctsio->io_hdr.status = CTL_SCSI_ERROR;
916 ctl_set_busy(struct ctl_scsiio *ctsio)
918 struct scsi_sense_data *sense;
920 sense = &ctsio->sense_data;
921 memset(sense, 0, sizeof(*sense));
922 ctsio->scsi_status = SCSI_STATUS_BUSY;
923 ctsio->sense_len = 0;
924 ctsio->io_hdr.status = CTL_SCSI_ERROR;
928 ctl_set_task_aborted(struct ctl_scsiio *ctsio)
930 struct scsi_sense_data *sense;
932 sense = &ctsio->sense_data;
933 memset(sense, 0, sizeof(*sense));
934 ctsio->scsi_status = SCSI_STATUS_TASK_ABORTED;
935 ctsio->sense_len = 0;
936 ctsio->io_hdr.status = CTL_CMD_ABORTED;
940 ctl_set_hw_write_protected(struct ctl_scsiio *ctsio)
942 /* "Hardware write protected" */
945 /*sense_key*/ SSD_KEY_DATA_PROTECT,
952 ctl_set_space_alloc_fail(struct ctl_scsiio *ctsio)
954 /* "Space allocation failed write protect" */
957 /*sense_key*/ SSD_KEY_DATA_PROTECT,
964 ctl_set_success(struct ctl_scsiio *ctsio)
966 struct scsi_sense_data *sense;
968 sense = &ctsio->sense_data;
969 memset(sense, 0, sizeof(*sense));
970 ctsio->scsi_status = SCSI_STATUS_OK;
971 ctsio->sense_len = 0;
972 ctsio->io_hdr.status = CTL_SUCCESS;