]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: pass subarray id to kill_subarray function
authorBlazej Kucman <blazej.kucman@intel.com>
Wed, 19 Feb 2020 09:54:49 +0000 (10:54 +0100)
committerJes Sorensen <jsorensen@fb.com>
Mon, 24 Feb 2020 21:08:15 +0000 (16:08 -0500)
After patch b6180160f ("imsm: save current_vol number")
current_vol for imsm is not set and kill_subarray()
cannot determine which volume has to be deleted.
Volume has to be passed as "subarray_id".
The parameter affects only IMSM metadata.

Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Kill.c
mdadm.h
super-ddf.c
super-intel.c

diff --git a/Kill.c b/Kill.c
index d4767e29d15007038b3e4910438c24184aec63ed..bfd0efdc0b1d463bda64756cb51a2f487ba58de3 100644 (file)
--- a/Kill.c
+++ b/Kill.c
@@ -119,7 +119,7 @@ int Kill_subarray(char *dev, char *subarray, int verbose)
                st->update_tail = &st->updates;
 
        /* ok we've found our victim, drop the axe */
-       rv = st->ss->kill_subarray(st);
+       rv = st->ss->kill_subarray(st, subarray);
        if (rv) {
                if (verbose >= 0)
                        pr_err("Failed to delete subarray-%s from %s\n",
diff --git a/mdadm.h b/mdadm.h
index 9e987789b5fac94cf4570fef8f5fd66075b6b8b2..d94569f903b0aebf90f5a3dc44868104de820e0c 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -1038,7 +1038,8 @@ extern struct superswitch {
        /* query the supertype for default geometry */
        void (*default_geometry)(struct supertype *st, int *level, int *layout, int *chunk); /* optional */
        /* Permit subarray's to be deleted from inactive containers */
-       int (*kill_subarray)(struct supertype *st); /* optional */
+       int (*kill_subarray)(struct supertype *st,
+                            char *subarray_id); /* optional */
        /* Permit subarray's to be modified */
        int (*update_subarray)(struct supertype *st, char *subarray,
                               char *update, struct mddev_ident *ident); /* optional */
index 780206341406995cfa1b1f08c03d3f7835017901..7cd5702d81fa3547c3f7f070058ba83509fea883 100644 (file)
@@ -4446,7 +4446,7 @@ static int _kill_subarray_ddf(struct ddf_super *ddf, const char *guid)
        return 0;
 }
 
-static int kill_subarray_ddf(struct supertype *st)
+static int kill_subarray_ddf(struct supertype *st, char *subarray_id)
 {
        struct ddf_super *ddf = st->sb;
        /*
index 47809bc21642613fe0820e158bafdff5dbb215cc..e4d2122daeeef218e582cfc320b427c1fd1c7d4c 100644 (file)
@@ -7600,18 +7600,17 @@ static void default_geometry_imsm(struct supertype *st, int *level, int *layout,
 
 static void handle_missing(struct intel_super *super, struct imsm_dev *dev);
 
-static int kill_subarray_imsm(struct supertype *st)
+static int kill_subarray_imsm(struct supertype *st, char *subarray_id)
 {
-       /* remove the subarray currently referenced by ->current_vol */
+       /* remove the subarray currently referenced by subarray_id */
        __u8 i;
        struct intel_dev **dp;
        struct intel_super *super = st->sb;
-       __u8 current_vol = super->current_vol;
+       __u8 current_vol = strtoul(subarray_id, NULL, 10);
        struct imsm_super *mpb = super->anchor;
 
-       if (super->current_vol < 0)
+       if (mpb->num_raid_devs == 0)
                return 2;
-       super->current_vol = -1; /* invalidate subarray cursor */
 
        /* block deletions that would change the uuid of active subarrays
         *