From 885f984583a08bd64ea0e3e04abc0712828a1276 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 16 Dec 2010 09:07:51 +1100 Subject: Grow: be extra careful about races when freezing an array If any subarray has any spare devices, then something raced, and we should abort the reshape. Signed-off-by: NeilBrown --- msg.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'msg.c') diff --git a/msg.c b/msg.c index 5511ecdb..7bd85f81 100644 --- a/msg.c +++ b/msg.c @@ -348,8 +348,19 @@ int block_monitor(char *container, const int freeze) sysfs_get_str(sra, NULL, "sync_action", buf, 20) > 0 && strcmp(buf, "frozen\n") == 0)) /* pass */; - else + else { + unblock_subarray(sra, 0); break; + } + /* Double check against races - there should be no spares + * or part-spares + */ + sysfs_free(sra); + sra = sysfs_read(-1, e->devnum, GET_DEVS | GET_STATE); + if (sra && sra->array.spare_disks > 0) { + unblock_subarray(sra, freeze); + break; + } } if (e) { -- cgit v1.2.3