summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2009-08-09 16:20:20 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2009-08-09 16:20:20 +0000
commit86f6288e61b53fef68471d14c6de60218a0d51d1 (patch)
tree4a2a6373d73c49ccca81875049b9797aa2c587bf
parent534d66cc66bf7453f06391910532a2c5803d383e (diff)
if a physical path to a device behind mpath goes away, remove the path. it
is worth noting that the device on mpath will persist even if all the paths behind it have gone away. returning the paths will allow operations to work against the device again.
-rw-r--r--sys/scsi/mpath.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/sys/scsi/mpath.c b/sys/scsi/mpath.c
index 7542777a68b..df0f3c2c620 100644
--- a/sys/scsi/mpath.c
+++ b/sys/scsi/mpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpath.c,v 1.1 2009/08/09 12:47:23 dlg Exp $ */
+/* $OpenBSD: mpath.c,v 1.2 2009/08/09 16:20:19 dlg Exp $ */
/*
* Copyright (c) 2009 David Gwynne <dlg@openbsd.org>
@@ -200,6 +200,8 @@ mpath_path_attach(struct scsi_link *link)
if (DEVID_CMP(&n->node_id, &link->id))
break;
+
+ n = NULL;
}
if (n == NULL) {
@@ -236,5 +238,30 @@ mpath_path_attach(struct scsi_link *link)
int
mpath_path_detach(struct scsi_link *link, int flags)
{
- return (0);
+ struct mpath_node *n;
+ struct mpath_path *p;
+ int target;
+
+ for (target = 0; target < MPATH_BUSWIDTH; target++) {
+ if ((n = mpath_nodes[target]) == NULL)
+ continue;
+
+ if (DEVID_CMP(&n->node_id, &link->id))
+ break;
+
+ n = NULL;
+ }
+
+ if (n == NULL)
+ panic("mpath: detaching a path from a nonexistant bus");
+
+ TAILQ_FOREACH(p, &n->node_paths, path_entry) {
+ if (p->path_link == link) {
+ TAILQ_REMOVE(&n->node_paths, p, path_entry);
+ free(p, M_DEVBUF);
+ return (0);
+ }
+ }
+
+ panic("mpath: unable to locate path for detach");
}