From eba2859f50bc0de6da7938a9ec6cfe4ceef43874 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 26 Mar 2014 14:19:43 +1100 Subject: [PATCH 4/6] DDF: report seq counter as events. Also don't treat two devices with different seq numbers as completely unrelated. This allows split-brain detection to work properly for ddf. Signed-off-by: NeilBrown --- super-ddf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- mdadm-3.3.orig/super-ddf.c +++ mdadm-3.3/super-ddf.c @@ -1929,6 +1929,8 @@ static void getinfo_super_ddf(struct sup info->disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE); else info->disk.state = 1 << MD_DISK_FAULTY; + + info->events = be32_to_cpu(ddf->active->seq); } else { info->disk.number = -1; info->disk.raid_disk = -1; @@ -2029,6 +2031,7 @@ static void getinfo_super_ddf_bvd(struct (be16_to_cpu(ddf->phys->entries[info->disk.number].state) & DDF_Online) && !(be16_to_cpu(ddf->phys->entries[info->disk.number].state) & DDF_Failed)) info->disk.state = (1<events = be32_to_cpu(ddf->active->seq); } info->container_member = ddf->currentconf->vcnum; @@ -3841,7 +3844,7 @@ static struct mdinfo *container_content_ dev->disk.state = (1<recovery_start = MaxSector; - dev->events = be32_to_cpu(ddf->primary.seq); + dev->events = be32_to_cpu(ddf->active->seq); dev->data_offset = be64_to_cpu(LBA_OFFSET(ddf, bvd)[iphys]); dev->component_size = be64_to_cpu(bvd->blocks); @@ -3928,12 +3931,6 @@ static int compare_super_ddf(struct supe if (memcmp(first->anchor.guid, second->anchor.guid, DDF_GUID_LEN) != 0) return 2; - if (!be32_eq(first->active->seq, second->active->seq)) { - dprintf("%s: sequence number mismatch %u<->%u\n", __func__, - be32_to_cpu(first->active->seq), - be32_to_cpu(second->active->seq)); - return 3; - } if (first->max_part != second->max_part || !be16_eq(first->phys->used_pdes, second->phys->used_pdes) || !be16_eq(first->virt->populated_vdes,