1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

raid: lvcreate and lvchange fail if --min_recovery_rate is defined

Both commands default [raid_](min|max)recoveryrate to 0 but ensure
min_recovery_rate is not larger than max_recoveryrate.  This results
in command failure without requestinng the user to also define
max_recovery_rate >= min_recovery_rate.

Fix both commands by defining max_recovery_rate = min_recoveryrate
in case "lvcreate/lvchange --minrecoveryrate Size ..." requests a
larger value than current maxrecoveryrate without also giving option
"--maxrecoveryrate Size ..." with a size greater or equal than min.
This commit is contained in:
Heinz Mauelshagen 2023-11-20 17:05:59 +01:00
parent 921ceddebf
commit 3589e515dc
2 changed files with 4 additions and 4 deletions

View File

@ -1013,8 +1013,8 @@ static int _lvchange_recovery_rate(struct logical_volume *lv,
if (raid_seg->max_recovery_rate &&
(raid_seg->max_recovery_rate < raid_seg->min_recovery_rate)) {
log_error("Minimum recovery rate cannot be higher than maximum.");
return 0;
log_print_unless_silent("Minimum recovery rate cannot be higher than maximum, adjusting.");
raid_seg->max_recovery_rate = raid_seg->min_recovery_rate;
}
/* Request caller to commit and reload metadata */

View File

@ -595,8 +595,8 @@ static int _read_raid_params(struct cmd_context *cmd,
lp->max_recovery_rate = arg_uint_value(cmd, maxrecoveryrate_ARG, 0) / 2;
if (lp->min_recovery_rate > lp->max_recovery_rate) {
log_error("Minimum recovery rate cannot be higher than maximum.");
return 0;
log_print_unless_silent("Minimum recovery rate cannot be higher than maximum, adjusting.");
lp->max_recovery_rate > lp->min_recovery_rate;
}
if (lp->region_size < lp->stripe_size) {