Grow: retry when writing 'reshape' to 'sync_action' is EBUSY.

EBUSY can be returned if something has recently happened
to cause md to want to check if recovery is needed, but hasn't
had a chance yet.

This can easily happen in testing.

So retry a few times in that case.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2015-05-14 14:50:42 +10:00
parent 670fe20aa0
commit ada38ebbcb
1 changed files with 8 additions and 3 deletions

11
Grow.c
View File

@ -718,9 +718,14 @@ int start_reshape(struct mdinfo *sra, int already_running,
if (!already_running)
sysfs_set_num(sra, NULL, "sync_min", sync_max_to_set);
err = err ?: sysfs_set_num(sra, NULL, "sync_max", sync_max_to_set);
if (!already_running)
err = err ?: sysfs_set_str(sra, NULL, "sync_action", "reshape");
if (!already_running && err == 0) {
int cnt = 5;
do {
err = sysfs_set_str(sra, NULL, "sync_action", "reshape");
if (err)
sleep(1);
} while (err && errno == EBUSY && cnt-- > 0);
}
return err;
}