]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
manage: adjust checking subarray state in update_subarray
authorPawel Piatkowski <pawel.piatkowski@intel.com>
Wed, 20 Dec 2023 09:32:49 +0000 (10:32 +0100)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Fri, 5 Jan 2024 10:47:09 +0000 (11:47 +0100)
Only changing bitmap related consistency_policy requires
subarray to be inactive.
consistency_policy with PPL or NO_PPL value can be changed on
active subarray.
It fixes regression introduced in commit
db10eab68e652f141169 ("Fix --update-subarray on active volume")

Signed-off-by: Pawel Piatkowski <pawel.piatkowski@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Manage.c

index f0d4cb0172ded282b51736bb7ca710c805c0ae80..915322667788734b433cdaa4b1903a6ba2fa0377 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -1749,6 +1749,7 @@ int Update_subarray(char *dev, char *subarray, enum update_opt update,
        int fd, rv = 2;
        struct mdinfo *info = NULL;
        char *update_verb = map_num(update_options, update);
+       bool allow_active = update == UOPT_PPL || update == UOPT_NO_PPL;
 
        memset(st, 0, sizeof(*st));
 
@@ -1763,7 +1764,7 @@ int Update_subarray(char *dev, char *subarray, enum update_opt update,
                goto free_super;
        }
 
-       if (is_subarray_active(subarray, st->devnm)) {
+       if (!allow_active && is_subarray_active(subarray, st->devnm)) {
                if (verbose >= 0)
                        pr_err("Subarray %s in %s is active, cannot update %s\n",
                                subarray, dev, update_verb);