forked from Minki/linux
md: close some races between setting and checking sync_action.
When checking sync_action in a script, we want to be sure it is as accurate as possible. As resync/reshape etc doesn't always start immediately (a separate thread is scheduled to do it), it is best if 'action_show' checks if MD_RECOVER_NEEDED is set (which it does) and in that case reports what is likely to start soon (which it only sometimes does). So: - report 'reshape' if reshape_position suggests one might start. - set MD_RECOVERY_RECOVER in raid1_reshape(), because that is very likely to happen next. Signed-off-by: NeilBrown <neilb@suse.com>
This commit is contained in:
parent
f7851be736
commit
985ca973b6
@ -4210,6 +4210,8 @@ action_show(struct mddev *mddev, char *page)
|
|||||||
type = "repair";
|
type = "repair";
|
||||||
} else if (test_bit(MD_RECOVERY_RECOVER, &recovery))
|
} else if (test_bit(MD_RECOVERY_RECOVER, &recovery))
|
||||||
type = "recover";
|
type = "recover";
|
||||||
|
else if (mddev->reshape_position != MaxSector)
|
||||||
|
type = "reshape";
|
||||||
}
|
}
|
||||||
return sprintf(page, "%s\n", type);
|
return sprintf(page, "%s\n", type);
|
||||||
}
|
}
|
||||||
|
@ -3113,6 +3113,7 @@ static int raid1_reshape(struct mddev *mddev)
|
|||||||
|
|
||||||
unfreeze_array(conf);
|
unfreeze_array(conf);
|
||||||
|
|
||||||
|
set_bit(MD_RECOVERY_RECOVER, &mddev->recovery);
|
||||||
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
|
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
|
||||||
md_wakeup_thread(mddev->thread);
|
md_wakeup_thread(mddev->thread);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user