From: Adam Kwolek Date: Wed, 5 Oct 2011 02:30:50 +0000 (+1100) Subject: Add recovery blocked field to mdinfo X-Git-Tag: mdadm-3.2.3~140 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=commitdiff_plain;h=6e75048bc5121a3db33896b628683cdf7dc0d773 Add recovery blocked field to mdinfo When container is assembled while reshape is active on one of its member whole container can be required to be blocked from monitoring. For such purpose field recovery blocked is added to mdinfo structure. When metadata handler finds active reshape in container it should set recovery_blocked field to disable whole container monitoring during reshape. For arrays that doesn't use containers, recovery_blocked field has the same value as reshape_active field e.g. super0/1. In fact,recovery is blocked during reshape for such arrays. For ddf, metadata handler doesn't set reshape_active field, so recovery_blocked is not set also. Signed-off-by: Adam Kwolek Signed-off-by: NeilBrown --- diff --git a/Assemble.c b/Assemble.c index afca38e6..4511f4d4 100644 --- a/Assemble.c +++ b/Assemble.c @@ -1527,7 +1527,7 @@ int assemble_container_content(struct supertype *st, int mdfd, if (sysfs_set_array(content, md_get_version(mdfd)) != 0) return 1; - if (content->reshape_active) + if (st->ss->external && content->recovery_blocked) block_subarray(content); if (sra) diff --git a/mdadm.h b/mdadm.h index f219c959..c397045f 100644 --- a/mdadm.h +++ b/mdadm.h @@ -196,6 +196,13 @@ struct mdinfo { */ int reshape_active; unsigned long long reshape_progress; + int recovery_blocked; /* for external metadata it + * indicates that there is + * reshape in progress in + * container, + * for native metadata it is + * reshape_active field mirror + */ union { unsigned long long resync_start; /* per-array resync position */ unsigned long long recovery_start; /* per-device rebuild position */ diff --git a/super-ddf.c b/super-ddf.c index 7312ba4b..d3f8b293 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -1374,6 +1374,7 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info, char *m info->recovery_start = MaxSector; info->reshape_active = 0; + info->recovery_blocked = 0; info->name[0] = 0; info->array.major_version = -1; @@ -1449,6 +1450,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, cha info->recovery_start = MaxSector; info->resync_start = 0; info->reshape_active = 0; + info->recovery_blocked = 0; if (!(ddf->virt->entries[info->container_member].state & DDF_state_inconsistent) && (ddf->virt->entries[info->container_member].init_state diff --git a/super0.c b/super0.c index f791e9d7..3061ecfe 100644 --- a/super0.c +++ b/super0.c @@ -387,6 +387,8 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info, char *map) } else info->reshape_active = 0; + info->recovery_blocked = info->reshape_active; + sprintf(info->name, "%d", sb->md_minor); /* work_disks is calculated rather than read directly */ for (i=0; i < MD_SB_DISKS; i++) diff --git a/super1.c b/super1.c index 0cd41240..9a72681f 100644 --- a/super1.c +++ b/super1.c @@ -626,6 +626,8 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map) } else info->reshape_active = 0; + info->recovery_blocked = info->reshape_active; + if (map) for (i=0; i