summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2008-11-25 22:48:23 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2008-11-25 22:48:23 +0000
commit0da18cdd63bc38f2717ba081b1f290c9a711bab0 (patch)
treee4e3442356b80f72476fe85df2c7b0916b9a39cc
parent73e92816f965abe7bed854402453e8a568f802c1 (diff)
Halt scanning by returning proper sense for illegal LUN.
-rw-r--r--sys/dev/softraid.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 3c13eebd4d1..03efd09cec8 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.123 2008/11/23 23:44:01 tedu Exp $ */
+/* $OpenBSD: softraid.c,v 1.124 2008/11/25 22:48:22 marco Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -1445,6 +1445,19 @@ sr_scsi_cmd(struct scsi_xfer *xs)
xs->error = XS_NOERROR;
wu->swu_xs = xs;
+ /* the midlayer will query LUNs so report sense to stop scanning */
+ if (link->target != 0 || link->lun != 0) {
+ DNPRINTF(SR_D_CMD, "%s: bad target:lun %d:%d\n",
+ DEVNAME(sc), link->target, link->lun);
+ sd->sd_scsi_sense.error_code = SSD_ERRCODE_CURRENT |
+ SSD_ERRCODE_VALID;
+ sd->sd_scsi_sense.flags = SKEY_ILLEGAL_REQUEST;
+ sd->sd_scsi_sense.add_sense_code = 0x25;
+ sd->sd_scsi_sense.add_sense_code_qual = 0x00;
+ sd->sd_scsi_sense.extra_len = 4;
+ goto stuffup;
+ }
+
switch (xs->cmd->opcode) {
case READ_COMMAND:
case READ_BIG: