aboutsummaryrefslogtreecommitdiff
path: root/sys/geom
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2009-04-03 19:49:33 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2009-04-03 19:49:33 +0000
commit31da42bab245db4fdc0abf4d392d7b76a57bf266 (patch)
tree0976d91821464828b1352e8f198ba283b10ccff7 /sys/geom
parent626fc9fe3d995ec8666e92a1d01810f896e34ec1 (diff)
downloadsrc-31da42bab245db4fdc0abf4d392d7b76a57bf266.tar.gz
src-31da42bab245db4fdc0abf4d392d7b76a57bf266.zip
Add interleaving root hold tokens from the CAM probe to disk_create and geom
provider tasting. This is needed for disk attachments that happen after threads are running in the boot process. Tested by: rnoland
Notes
Notes: svn path=/head/; revision=190677
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom.h2
-rw-r--r--sys/geom/geom_disk.c2
-rw-r--r--sys/geom/geom_disk.h2
-rw-r--r--sys/geom/geom_subr.c5
4 files changed, 11 insertions, 0 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index a916ec515713..38c6c750dcca 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -193,6 +193,8 @@ struct g_provider {
/* Two fields for the implementing class to use */
void *private;
u_int index;
+
+ struct root_hold_token *roothold;
};
/* geom_dev.c */
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index 20998bdd4175..3b1e7489b3a4 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -381,6 +381,7 @@ g_disk_create(void *arg, int flag)
printf("GEOM: new disk %s\n", gp->name);
dp->d_geom = gp;
g_error_provider(pp, 0);
+ root_mount_rel(dp->d_roothold);
}
static void
@@ -467,6 +468,7 @@ disk_create(struct disk *dp, int version)
dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED,
DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
dp->d_geom = NULL;
+ dp->d_roothold = root_mount_hold(dp->d_name, M_WAITOK);
g_disk_ident_adjust(dp->d_ident, sizeof(dp->d_ident));
g_post_event(g_disk_create, dp, M_WAITOK, dp, NULL);
}
diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h
index 5e9d1aae6c2f..a3e1efb773f6 100644
--- a/sys/geom/geom_disk.h
+++ b/sys/geom/geom_disk.h
@@ -88,6 +88,8 @@ struct disk {
/* Fields private to the driver */
void *d_drv1;
+
+ struct root_hold_token *d_roothold;
};
#define DISKFLAG_NEEDSGIANT 0x1
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c
index b67c0d576656..85d8028bb4b1 100644
--- a/sys/geom/geom_subr.c
+++ b/sys/geom/geom_subr.c
@@ -545,6 +545,10 @@ g_new_provider_event(void *arg, int flag)
mp->taste(mp, pp, 0);
g_topology_assert();
}
+ if (pp->roothold != NULL) {
+ root_mount_rel(pp->roothold);
+ pp->roothold = NULL;
+ }
}
@@ -581,6 +585,7 @@ g_new_providerf(struct g_geom *gp, const char *fmt, ...)
pp->stat = devstat_new_entry(pp, -1, 0, DEVSTAT_ALL_SUPPORTED,
DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
LIST_INSERT_HEAD(&gp->provider, pp, provider);
+ pp->roothold = root_mount_hold(pp->name, M_WAITOK);
g_post_event(g_new_provider_event, pp, M_WAITOK, pp, gp, NULL);
return (pp);
}