Assemble: fix --force assembly of v1.x arrays which are recovering.
1.x metadata allows a device to be a member of the array while it is still recoverying. So it is a working member, but is not completely in-sync. mdadm/assemble does not understand this distinction and assumes that a work member is fully in-sync for the purpose of determining if there are enough in-sync devices for the array to be functional. So collect the 'recovery_start' value from the metadata and use it in assemble when determining how useful a given device is. Reported-by: Mikael Abrahamsson <swmike@swm.pp.se> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
cc86f89c85
commit
921d9e164f
|
@ -800,7 +800,8 @@ int Assemble(struct supertype *st, char *mddev,
|
||||||
if (devices[j].i.events+event_margin >=
|
if (devices[j].i.events+event_margin >=
|
||||||
devices[most_recent].i.events) {
|
devices[most_recent].i.events) {
|
||||||
devices[j].uptodate = 1;
|
devices[j].uptodate = 1;
|
||||||
if (i < content->array.raid_disks) {
|
if (i < content->array.raid_disks &&
|
||||||
|
devices[j].i.recovery_start == MaxSector) {
|
||||||
okcnt++;
|
okcnt++;
|
||||||
avail[i]=1;
|
avail[i]=1;
|
||||||
} else
|
} else
|
||||||
|
@ -822,6 +823,7 @@ int Assemble(struct supertype *st, char *mddev,
|
||||||
int j = best[i];
|
int j = best[i];
|
||||||
if (j>=0 &&
|
if (j>=0 &&
|
||||||
!devices[j].uptodate &&
|
!devices[j].uptodate &&
|
||||||
|
devices[j].i.recovery_start == MaxSector &&
|
||||||
(chosen_drive < 0 ||
|
(chosen_drive < 0 ||
|
||||||
devices[j].i.events
|
devices[j].i.events
|
||||||
> devices[chosen_drive].i.events))
|
> devices[chosen_drive].i.events))
|
||||||
|
|
|
@ -1369,6 +1369,7 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info)
|
||||||
info->disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE);
|
info->disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE);
|
||||||
|
|
||||||
|
|
||||||
|
info->recovery_start = MaxSector;
|
||||||
info->reshape_active = 0;
|
info->reshape_active = 0;
|
||||||
info->name[0] = 0;
|
info->name[0] = 0;
|
||||||
|
|
||||||
|
@ -1427,6 +1428,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info)
|
||||||
|
|
||||||
info->container_member = ddf->currentconf->vcnum;
|
info->container_member = ddf->currentconf->vcnum;
|
||||||
|
|
||||||
|
info->recovery_start = MaxSector;
|
||||||
info->resync_start = 0;
|
info->resync_start = 0;
|
||||||
if (!(ddf->virt->entries[info->container_member].state
|
if (!(ddf->virt->entries[info->container_member].state
|
||||||
& DDF_state_inconsistent) &&
|
& DDF_state_inconsistent) &&
|
||||||
|
|
|
@ -1452,6 +1452,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info)
|
||||||
info->data_offset = __le32_to_cpu(map->pba_of_lba0);
|
info->data_offset = __le32_to_cpu(map->pba_of_lba0);
|
||||||
info->component_size = __le32_to_cpu(map->blocks_per_member);
|
info->component_size = __le32_to_cpu(map->blocks_per_member);
|
||||||
memset(info->uuid, 0, sizeof(info->uuid));
|
memset(info->uuid, 0, sizeof(info->uuid));
|
||||||
|
info->recovery_start = MaxSector;
|
||||||
|
|
||||||
if (map->map_state == IMSM_T_STATE_UNINITIALIZED || dev->vol.dirty) {
|
if (map->map_state == IMSM_T_STATE_UNINITIALIZED || dev->vol.dirty) {
|
||||||
info->resync_start = 0;
|
info->resync_start = 0;
|
||||||
|
@ -1559,6 +1560,7 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info)
|
||||||
info->disk.number = -1;
|
info->disk.number = -1;
|
||||||
info->disk.state = 0;
|
info->disk.state = 0;
|
||||||
info->name[0] = 0;
|
info->name[0] = 0;
|
||||||
|
info->recovery_start = MaxSector;
|
||||||
|
|
||||||
if (super->disks) {
|
if (super->disks) {
|
||||||
__u32 reserved = imsm_reserved_sectors(super, super->disks);
|
__u32 reserved = imsm_reserved_sectors(super, super->disks);
|
||||||
|
|
1
super0.c
1
super0.c
|
@ -372,6 +372,7 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info)
|
||||||
|
|
||||||
uuid_from_super0(st, info->uuid);
|
uuid_from_super0(st, info->uuid);
|
||||||
|
|
||||||
|
info->recovery_start = MaxSector;
|
||||||
if (sb->minor_version > 90 && (sb->reshape_position+1) != 0) {
|
if (sb->minor_version > 90 && (sb->reshape_position+1) != 0) {
|
||||||
info->reshape_active = 1;
|
info->reshape_active = 1;
|
||||||
info->reshape_progress = sb->reshape_position;
|
info->reshape_progress = sb->reshape_position;
|
||||||
|
|
5
super1.c
5
super1.c
|
@ -612,6 +612,11 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info)
|
||||||
strncpy(info->name, sb->set_name, 32);
|
strncpy(info->name, sb->set_name, 32);
|
||||||
info->name[32] = 0;
|
info->name[32] = 0;
|
||||||
|
|
||||||
|
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RECOVERY_OFFSET))
|
||||||
|
info->recovery_start = __le32_to_cpu(sb->recovery_offset);
|
||||||
|
else
|
||||||
|
info->recovery_start = MaxSector;
|
||||||
|
|
||||||
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE)) {
|
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE)) {
|
||||||
info->reshape_active = 1;
|
info->reshape_active = 1;
|
||||||
info->reshape_progress = __le64_to_cpu(sb->reshape_position);
|
info->reshape_progress = __le64_to_cpu(sb->reshape_position);
|
||||||
|
|
Loading…
Reference in New Issue