From: Alexander Lyakas Date: Mon, 6 Feb 2012 23:15:20 +0000 (+1100) Subject: getinfo_super1: Use MaxSector in place of sb->size X-Git-Tag: mdadm-3.2.4~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d59770567cc6078f555663cbc1929ddffdcc2f2e;p=thirdparty%2Fmdadm.git getinfo_super1: Use MaxSector in place of sb->size when deciding whether the array is clean or dirty, compare sb->resync_offset against MaxSector and not against sb->size With RAID6 resyncing and subsequent drive failures, it is possible to reach the case, in which sb->resync_offset==sb->size. This happens when resync is aborted due to drive failures, and immediately a rebuild of a spare starts. In this case, mdadm was considered the array as clean, while kernel was considering the array as dirty. It is better for mdadm also to consider the array as dirty in this case. Signed-off-by: NeilBrown --- diff --git a/super1.c b/super1.c index 867aa58c..d23d6e8e 100644 --- a/super1.c +++ b/super1.c @@ -573,7 +573,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map) info->array.utime = __le64_to_cpu(sb->utime); info->array.chunk_size = __le32_to_cpu(sb->chunksize)*512; info->array.state = - (__le64_to_cpu(sb->resync_offset) >= __le64_to_cpu(sb->size)) + (__le64_to_cpu(sb->resync_offset) == MaxSector) ? 1 : 0; info->data_offset = __le64_to_cpu(sb->data_offset);