1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

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.
This commit is contained in:
Alexander Motin 2013-01-14 20:31:45 +00:00
parent c0e8ea253f
commit 4c10c25e33
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=245433

View File

@ -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 @@ g_raid_md_taste_intel(struct g_raid_md_object *md, struct g_class *mp,
} 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;