summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2011-04-17 23:18:02 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2011-04-17 23:18:02 +0000
commit65ebf3603c93ab7e8fd20f39d31e4d48c1cd584b (patch)
tree67f6fcb3cf9e7628cd84d756f13026f6ccbc9418 /sys/scsi
parentcae4ba1304b94cdf4ac037ea2afe02947c1a7cee (diff)
if mpath is disabled in config or ukc, then prevent path drivers from
attaching since theyre useless without mpath. the path drivers ask mpath if its ok to use the device before doing their own matches (this is so mpath can prevent paths attaching to itself), so im just adding this check there. this uses code from miod to walk cfdata for the mpath entry and then checks its state. this is ok because mpath is only attached in one place, so there arent multiple cfdata entries for it. ok krw@ deraadt@ miod@ matthew@
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/mpath.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/scsi/mpath.c b/sys/scsi/mpath.c
index 02389cb518b..86f379c45a5 100644
--- a/sys/scsi/mpath.c
+++ b/sys/scsi/mpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpath.c,v 1.19 2011/04/05 14:25:42 dlg Exp $ */
+/* $OpenBSD: mpath.c,v 1.20 2011/04/17 23:18:01 dlg Exp $ */
/*
* Copyright (c) 2009 David Gwynne <dlg@openbsd.org>
@@ -338,6 +338,21 @@ mpath_minphys(struct buf *bp, struct scsi_link *link)
int
mpath_path_probe(struct scsi_link *link)
{
+ static struct cfdata *cf = NULL;
+
+ if (cf == NULL) {
+ for (cf = cfdata; cf->cf_attach != (struct cfattach *)-1;
+ cf++) {
+ if (cf->cf_attach == NULL)
+ continue;
+ if (cf->cf_driver == &mpath_cd)
+ break;
+ }
+ }
+
+ if (cf->cf_fstate == FSTATE_DNOTFOUND || cf->cf_fstate == FSTATE_DSTAR)
+ return (ENXIO);
+
if (link->id == NULL)
return (EINVAL);