Skip to content
This repository has been archived by the owner on Oct 12, 2020. It is now read-only.

Commit

Permalink
Specify nodes number when updating cluster nodes
Browse files Browse the repository at this point in the history
Now it allows updating cluster nodes without specify --nodes. It can write superblock
with zero nodes. It can break the current cluster. Add this check to avoid this problem.

v2: It needs check c.update first to avoid NULL pointer reference
v3: Wol points the typo error

Signed-off-by: Xiao Ni <[email protected]>
Signed-off-by: Jes Sorensen <[email protected]>
  • Loading branch information
XiaoNi87 authored and Jes Sorensen committed Aug 7, 2020
1 parent 77b72fa commit 138a9e9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mdadm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,11 @@ int main(int argc, char *argv[])
}
}

if (c.update && strcmp(c.update, "nodes") == 0 && c.nodes == 0) {
pr_err("Please specify nodes number with --nodes\n");
exit(1);
}

if (c.backup_file && data_offset != INVALID_SECTORS) {
pr_err("--backup-file and --data-offset are incompatible\n");
exit(2);
Expand Down

0 comments on commit 138a9e9

Please sign in to comment.