summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_sunlabel.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-04-22 21:29:58 +0000
committerphk <phk@FreeBSD.org>2003-04-22 21:29:58 +0000
commit1e2ee18100884dabb6b87667b34ee8b59b4af1fb (patch)
treeabf36a5d4f76f4503e8790592364f8e402300b7c /sys/geom/geom_sunlabel.c
parent5d4dba626422518e9b0e4e90827dcdba2dc93840 (diff)
downloadFreeBSD-src-1e2ee18100884dabb6b87667b34ee8b59b4af1fb.zip
FreeBSD-src-1e2ee18100884dabb6b87667b34ee8b59b4af1fb.tar.gz
Change the locking so that the _modify function is called with topology
held. The only place where we want to not hold topology is when we read (or write) the label to disk: in the case of a disk error with a long recovery time, holding topology would prevent open/close of any disk device.
Diffstat (limited to 'sys/geom/geom_sunlabel.c')
-rw-r--r--sys/geom/geom_sunlabel.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c
index 1bd7627..478a4a8 100644
--- a/sys/geom/geom_sunlabel.c
+++ b/sys/geom/geom_sunlabel.c
@@ -75,26 +75,22 @@ g_sunlabel_modify(struct g_geom *gp, struct g_sunlabel_softc *ms, u_char *sec0)
for (i = 0; i < SUN_NPART; i++) {
v = sl.sl_part[i].sdkp_cyloffset;
u = sl.sl_part[i].sdkp_nsectors;
- g_topology_lock();
error = g_slice_config(gp, i, G_SLICE_CONFIG_CHECK,
((off_t)v * csize) << 9ULL,
((off_t)u) << 9ULL,
ms->sectorsize,
"%s%c", gp->name, 'a' + i);
- g_topology_unlock();
if (error)
return (error);
}
for (i = 0; i < SUN_NPART; i++) {
v = sl.sl_part[i].sdkp_cyloffset;
u = sl.sl_part[i].sdkp_nsectors;
- g_topology_lock();
g_slice_config(gp, i, G_SLICE_CONFIG_SET,
((off_t)v * csize) << 9ULL,
((off_t)u) << 9ULL,
ms->sectorsize,
"%s%c", gp->name, 'a' + i);
- g_topology_unlock();
}
ms->nalt = sl.sl_acylinders;
ms->nheads = sl.sl_ntracks;
@@ -128,9 +124,7 @@ g_sunlabel_hotwrite(void *arg, int flag)
*/
p = (u_char *)bp->bio_data - (bp->bio_offset + gsl->offset);
- g_topology_unlock();
error = g_sunlabel_modify(gp, ms, p);
- g_topology_lock();
if (error) {
g_io_deliver(bp, EPERM);
return;
@@ -173,7 +167,6 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags)
if (gp == NULL)
return (NULL);
gsp = gp->softc;
- g_topology_unlock();
gp->dumpconf = g_sunlabel_dumpconf;
npart = 0;
do {
@@ -183,7 +176,9 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags)
if (ms->sectorsize < 512)
break;
mediasize = cp->provider->mediasize;
+ g_topology_unlock();
buf = g_read_data(cp, 0, ms->sectorsize, &error);
+ g_topology_lock();
if (buf == NULL || error != 0)
break;
@@ -191,7 +186,6 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags)
break;
} while (0);
- g_topology_lock();
g_access_rel(cp, -1, 0, 0);
if (LIST_EMPTY(&gp->provider)) {
g_std_spoiled(cp);
OpenPOWER on IntegriCloud