summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-01-14 20:31:45 +0000
committermav <mav@FreeBSD.org>2013-01-14 20:31:45 +0000
commit1d08afc7e3c4418caf298c2e7e24eeb324d10811 (patch)
tree97585b2a0fa86f4eaab1016f4703cccfe9f4a0be /sys/geom
parente8cf8aab231fe1b1ae82eff6e64af146514eea71 (diff)
downloadFreeBSD-src-1d08afc7e3c4418caf298c2e7e24eeb324d10811.zip
FreeBSD-src-1d08afc7e3c4418caf298c2e7e24eeb324d10811.tar.gz
Keep value of orig_config_id metadata field. Windows driver writes there
previous value of config_id when it is changed in some cases. I guess it may be used do avoid some split-brain conditions.
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/raid/md_intel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/geom/raid/md_intel.c b/sys/geom/raid/md_intel.c
index 2d92b0e..eeb42d5 100644
--- a/sys/geom/raid/md_intel.c
+++ b/sys/geom/raid/md_intel.c
@@ -216,6 +216,7 @@ struct g_raid_md_intel_pervolume {
struct g_raid_md_intel_object {
struct g_raid_md_object mdio_base;
uint32_t mdio_config_id;
+ uint32_t mdio_orig_config_id;
uint32_t mdio_generation;
struct intel_raid_conf *mdio_meta;
struct callout mdio_start_co; /* STARTING state timer. */
@@ -717,7 +718,7 @@ intel_meta_write_spare(struct g_consumer *cp, struct intel_raid_disk *d)
memcpy(&meta->version[0], INTEL_VERSION_1000,
sizeof(INTEL_VERSION_1000) - 1);
meta->config_size = INTEL_MAX_MD_SIZE(1);
- meta->config_id = arc4random();
+ meta->config_id = meta->orig_config_id = arc4random();
meta->generation = 1;
meta->total_disks = 1;
meta->disk[0] = *d;
@@ -1318,7 +1319,7 @@ g_raid_md_create_intel(struct g_raid_md_object *md, struct g_class *mp,
char name[16];
mdi = (struct g_raid_md_intel_object *)md;
- mdi->mdio_config_id = arc4random();
+ mdi->mdio_config_id = mdi->mdio_orig_config_id = arc4random();
mdi->mdio_generation = 0;
snprintf(name, sizeof(name), "Intel-%08x", mdi->mdio_config_id);
sc = g_raid_create_node(mp, name, md);
@@ -1463,6 +1464,7 @@ search:
} else { /* Not found matching node -- create one. */
result = G_RAID_MD_TASTE_NEW;
mdi->mdio_config_id = meta->config_id;
+ mdi->mdio_orig_config_id = meta->orig_config_id;
snprintf(name, sizeof(name), "Intel-%08x", meta->config_id);
sc = g_raid_create_node(mp, name, md);
md->mdo_softc = sc;
@@ -2292,6 +2294,7 @@ g_raid_md_write_intel(struct g_raid_md_object *md, struct g_raid_volume *tvol,
memcpy(&meta->intel_id[0], INTEL_MAGIC, sizeof(INTEL_MAGIC) - 1);
meta->config_size = INTEL_MAX_MD_SIZE(numdisks);
meta->config_id = mdi->mdio_config_id;
+ meta->orig_config_id = mdi->mdio_orig_config_id;
meta->generation = mdi->mdio_generation;
meta->attributes = INTEL_ATTR_CHECKSUM;
meta->total_disks = numdisks;
OpenPOWER on IntegriCloud