summaryrefslogtreecommitdiffstats
path: root/sysfs.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-03-28 08:29:37 +0200
committerNeilBrown <neilb@suse.de>2012-03-28 08:29:37 +0200
commitfd324b08dbfa8404558534dd0a2321213ffb7257 (patch)
tree12560243fa455d195c85340176b99a22f2d8a632 /sysfs.c
parentFix the new ROUND_UP macro. (diff)
downloadmdadm-fd324b08dbfa8404558534dd0a2321213ffb7257.tar.xz
mdadm-fd324b08dbfa8404558534dd0a2321213ffb7257.zip
sysfs: fixed sysfs_freeze_array array to work properly with Manage_subdevs.
If the array is already frozen when Manage_subdevs is called we don't want it to unfreeze the array. This is because Grow calls Manage_subdevs to add devices to an array being reshaped, and the array must stay frozen over this call. So if sysfs_freeze_array find the array to be frozen it returns '0', meaning that it didn't and cannot freeze it. Then the caller will not try to unfreeze, which is good. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'sysfs.c')
-rw-r--r--sysfs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sysfs.c b/sysfs.c
index e32ececa..cddabaee 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -837,7 +837,6 @@ int sysfs_freeze_array(struct mdinfo *sra)
{
/* Try to freeze resync/rebuild on this array/container.
* Return -1 if the array is busy,
- * return -2 container cannot be frozen,
* return 0 if this kernel doesn't support 'frozen'
* return 1 if it worked.
*/
@@ -847,8 +846,10 @@ int sysfs_freeze_array(struct mdinfo *sra)
return 1; /* no sync_action == frozen */
if (sysfs_get_str(sra, NULL, "sync_action", buf, 20) <= 0)
return 0;
- if (strcmp(buf, "idle\n") != 0 &&
- strcmp(buf, "frozen\n") != 0)
+ if (strcmp(buf, "frozen\n") == 0)
+ /* Already frozen */
+ return 0;
+ if (strcmp(buf, "idle\n") != 0)
return -1;
if (sysfs_set_str(sra, NULL, "sync_action", "frozen") < 0)
return 0;