diff options
author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2004-07-31 21:08:17 +0000 |
---|---|---|
committer | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2004-07-31 21:08:17 +0000 |
commit | 4b2e596e389eed26811ed9e78e2bdf308ca6644c (patch) | |
tree | e708c2edd8e710b70edfed4eab5b8329e807850b /sys/geom/mirror/g_mirror.c | |
parent | 8fc406a66443dcaf701110f0950dd86d22531d7c (diff) | |
download | src-4b2e596e389eed26811ed9e78e2bdf308ca6644c.tar.gz src-4b2e596e389eed26811ed9e78e2bdf308ca6644c.zip |
Handle spoil event in dedicated function: g_mirror_spoiled().
The different between the new function and g_mirror_orphan() (which was
used previously) is that syncid is bumped immediately, instead of on
first write, because when consumer was spoiled, it means, that its
provider was opened for writing, so we can't trust that its data
will be valid when it will be connected again.
Notes
Notes:
svn path=/head/; revision=132938
Diffstat (limited to 'sys/geom/mirror/g_mirror.c')
-rw-r--r-- | sys/geom/mirror/g_mirror.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 06f8ade16199..354697101d7f 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -502,6 +502,21 @@ g_mirror_orphan(struct g_consumer *cp) G_MIRROR_EVENT_DONTWAIT); } +static void +g_mirror_spoiled(struct g_consumer *cp) +{ + struct g_mirror_disk *disk; + + g_topology_assert(); + + disk = cp->private; + if (disk == NULL) + return; + disk->d_softc->sc_bump_syncid = G_MIRROR_BUMP_IMMEDIATELY; + g_mirror_event_send(disk, G_MIRROR_DISK_STATE_DISCONNECTED, + G_MIRROR_EVENT_DONTWAIT); +} + /* * Function should return the next active disk on the list. * It is possible that it will be the same disk as given. @@ -2298,7 +2313,7 @@ g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md) gp = g_new_geomf(mp, "%s", md->md_name); sc = malloc(sizeof(*sc), M_MIRROR, M_WAITOK | M_ZERO); gp->start = g_mirror_start; - gp->spoiled = g_mirror_orphan; + gp->spoiled = g_mirror_spoiled; gp->orphan = g_mirror_orphan; gp->access = g_mirror_access; gp->dumpconf = g_mirror_dumpconf; @@ -2326,7 +2341,7 @@ g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md) */ gp = g_new_geomf(mp, "%s.sync", md->md_name); gp->softc = sc; - gp->spoiled = g_mirror_orphan; + gp->spoiled = g_mirror_spoiled; gp->orphan = g_mirror_orphan; sc->sc_sync.ds_geom = gp; sc->sc_sync.ds_block = atomic_load_acq_int(&g_mirror_sync_block_size); |