diff options
author | Pawel Baldysiak <pawel.baldysiak@intel.com> | 2019-02-22 12:56:27 +0100 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2019-02-28 21:48:51 +0100 |
commit | 2b57e4fe041d52ae29866c93a878a11c07223cff (patch) | |
tree | 2f023059d8b9a4cc32d547c049e78559cf5063df /Assemble.c | |
parent | mdmon: wait for previous mdmon to exit during takeover (diff) | |
download | mdadm-2b57e4fe041d52ae29866c93a878a11c07223cff.tar.xz mdadm-2b57e4fe041d52ae29866c93a878a11c07223cff.zip |
Assemble: Fix starting array with initial reshape checkpoint
If array was stopped during reshape initialization,
there might be a "0" checkpoint recorded in metadata.
If array with such condition (reshape with position 0)
is passed to kernel - it will refuse to start such array.
Treat such array as normal during assemble, Grow_continue() will
reinitialize and start the reshape.
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'Assemble.c')
-rw-r--r-- | Assemble.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -2061,8 +2061,22 @@ int assemble_container_content(struct supertype *st, int mdfd, spare, &c->backup_file, c->verbose) == 1) return 1; - err = sysfs_set_str(content, NULL, - "array_state", "readonly"); + if (content->reshape_progress == 0) { + /* If reshape progress is 0 - we are assembling the + * array that was stopped, before reshape has started. + * Array needs to be started as active, Grow_continue() + * will start the reshape. + */ + sysfs_set_num(content, NULL, "reshape_position", + MaxSector); + err = sysfs_set_str(content, NULL, + "array_state", "active"); + sysfs_set_num(content, NULL, "reshape_position", 0); + } else { + err = sysfs_set_str(content, NULL, + "array_state", "readonly"); + } + if (err) return 1; |