diff options
author | le <le@FreeBSD.org> | 2005-03-04 16:43:40 +0000 |
---|---|---|
committer | le <le@FreeBSD.org> | 2005-03-04 16:43:40 +0000 |
commit | af31e4b0b53583946ba7c6313d1cb89eaae260c2 (patch) | |
tree | 90fdbf0ac6583aeaa7994651507ab2628e295f28 /sys/geom/vinum | |
parent | 9b0e528ff81596f475a663de95cab5058102a540 (diff) | |
download | FreeBSD-src-af31e4b0b53583946ba7c6313d1cb89eaae260c2.zip FreeBSD-src-af31e4b0b53583946ba7c6313d1cb89eaae260c2.tar.gz |
Don't allow to synchronize a plex that is already sychronizing.
Reset the 'syncing' flag in case of errors, too.
Some cosmetics.
Diffstat (limited to 'sys/geom/vinum')
-rw-r--r-- | sys/geom/vinum/geom_vinum_init.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/sys/geom/vinum/geom_vinum_init.c b/sys/geom/vinum/geom_vinum_init.c index 963b98b..b60a743 100644 --- a/sys/geom/vinum/geom_vinum_init.c +++ b/sys/geom/vinum/geom_vinum_init.c @@ -473,6 +473,13 @@ gv_sync_td(void *arg) to = sync->to->consumer; p = sync->to; + + if (p->flags & GV_PLEX_SYNCING) { + printf("GEOM_VINUM: plex '%s' is already syncing.\n", p->name); + g_free(sync); + kthread_exit(0); + } + p->synced = 0; p->flags |= GV_PLEX_SYNCING; @@ -482,16 +489,18 @@ gv_sync_td(void *arg) error = g_access(from, 1, 0, 0); if (error) { g_topology_unlock(); - printf("gvinum: sync from '%s' failed to access consumer: %d\n", - sync->from->name, error); + printf("GEOM_VINUM: sync from '%s' failed to access " + "consumer: %d\n", sync->from->name, error); + g_free(sync); kthread_exit(error); } error = g_access(to, 0, 1, 0); if (error) { g_access(from, -1, 0, 0); g_topology_unlock(); - printf("gvinum: sync to '%s' failed to access consumer: %d\n", - p->name, error); + printf("GEOM_VINUM: sync to '%s' failed to access " + "consumer: %d\n", p->name, error); + g_free(sync); kthread_exit(error); } g_topology_unlock(); @@ -502,8 +511,9 @@ gv_sync_td(void *arg) /* Read some bits from the good plex. */ buf = g_read_data(from, i, sync->syncsize, &error); if (buf == NULL) { - printf("gvinum: sync read from '%s' failed at offset " - "%jd, errno: %d\n", sync->from->name, i, error); + printf("GEOM_VINUM: sync read from '%s' failed at " + "offset %jd; errno: %d\n", sync->from->name, i, + error); break; } @@ -515,8 +525,8 @@ gv_sync_td(void *arg) */ bp = g_new_bio(); if (bp == NULL) { - printf("gvinum: sync write to '%s' failed at offset " - "%jd, out of memory\n", p->name, i); + printf("GEOM_VINUM: sync write to '%s' failed at " + "offset %jd; out of memory\n", p->name, i); g_free(buf); break; } @@ -540,8 +550,8 @@ gv_sync_td(void *arg) g_destroy_bio(bp); g_free(buf); if (error) { - printf("gvinum: sync write to '%s' failed at offset " - "%jd, errno: %d\n", p->name, i, error); + printf("GEOM_VINUM: sync write to '%s' failed at " + "offset %jd; errno: %d\n", p->name, i, error); break; } @@ -556,11 +566,12 @@ gv_sync_td(void *arg) g_topology_unlock(); /* Successful initialization. */ - if (!error) { - p->flags &= ~GV_PLEX_SYNCING; + if (!error) printf("GEOM_VINUM: plex sync %s -> %s finished\n", sync->from->name, sync->to->name); - } + + p->flags &= ~GV_PLEX_SYNCING; + p->synced = 0; g_free(sync); kthread_exit(error); |