Blame SOURCES/0064-imsm-pass-subarray-id-to-kill_subarray-function.patch

8e8941
From 3364781b929f571a3dc3a6afed09eb1b03ce607c Mon Sep 17 00:00:00 2001
8e8941
From: Blazej Kucman <blazej.kucman@intel.com>
8e8941
Date: Wed, 19 Feb 2020 10:54:49 +0100
8e8941
Subject: [RHEL7.9 PATCH 64/77] imsm: pass subarray id to kill_subarray
8e8941
 function
8e8941
8e8941
After patch b6180160f ("imsm: save current_vol number")
8e8941
current_vol for imsm is not set and kill_subarray()
8e8941
cannot determine which volume has to be deleted.
8e8941
Volume has to be passed as "subarray_id".
8e8941
The parameter affects only IMSM metadata.
8e8941
8e8941
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
8e8941
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
8e8941
---
8e8941
 Kill.c        | 2 +-
8e8941
 mdadm.h       | 3 ++-
8e8941
 super-ddf.c   | 2 +-
8e8941
 super-intel.c | 9 ++++-----
8e8941
 4 files changed, 8 insertions(+), 8 deletions(-)
8e8941
8e8941
diff --git a/Kill.c b/Kill.c
8e8941
index d4767e2..bfd0efd 100644
8e8941
--- a/Kill.c
8e8941
+++ b/Kill.c
8e8941
@@ -119,7 +119,7 @@ int Kill_subarray(char *dev, char *subarray, int verbose)
8e8941
 		st->update_tail = &st->updates;
8e8941
 
8e8941
 	/* ok we've found our victim, drop the axe */
8e8941
-	rv = st->ss->kill_subarray(st);
8e8941
+	rv = st->ss->kill_subarray(st, subarray);
8e8941
 	if (rv) {
8e8941
 		if (verbose >= 0)
8e8941
 			pr_err("Failed to delete subarray-%s from %s\n",
8e8941
diff --git a/mdadm.h b/mdadm.h
8e8941
index 9e98778..d94569f 100644
8e8941
--- a/mdadm.h
8e8941
+++ b/mdadm.h
8e8941
@@ -1038,7 +1038,8 @@ extern struct superswitch {
8e8941
 	/* query the supertype for default geometry */
8e8941
 	void (*default_geometry)(struct supertype *st, int *level, int *layout, int *chunk); /* optional */
8e8941
 	/* Permit subarray's to be deleted from inactive containers */
8e8941
-	int (*kill_subarray)(struct supertype *st); /* optional */
8e8941
+	int (*kill_subarray)(struct supertype *st,
8e8941
+			     char *subarray_id); /* optional */
8e8941
 	/* Permit subarray's to be modified */
8e8941
 	int (*update_subarray)(struct supertype *st, char *subarray,
8e8941
 			       char *update, struct mddev_ident *ident); /* optional */
8e8941
diff --git a/super-ddf.c b/super-ddf.c
8e8941
index 7802063..7cd5702 100644
8e8941
--- a/super-ddf.c
8e8941
+++ b/super-ddf.c
8e8941
@@ -4446,7 +4446,7 @@ static int _kill_subarray_ddf(struct ddf_super *ddf, const char *guid)
8e8941
 	return 0;
8e8941
 }
8e8941
 
8e8941
-static int kill_subarray_ddf(struct supertype *st)
8e8941
+static int kill_subarray_ddf(struct supertype *st, char *subarray_id)
8e8941
 {
8e8941
 	struct ddf_super *ddf = st->sb;
8e8941
 	/*
8e8941
diff --git a/super-intel.c b/super-intel.c
8e8941
index 47809bc..e4d2122 100644
8e8941
--- a/super-intel.c
8e8941
+++ b/super-intel.c
8e8941
@@ -7600,18 +7600,17 @@ static void default_geometry_imsm(struct supertype *st, int *level, int *layout,
8e8941
 
8e8941
 static void handle_missing(struct intel_super *super, struct imsm_dev *dev);
8e8941
 
8e8941
-static int kill_subarray_imsm(struct supertype *st)
8e8941
+static int kill_subarray_imsm(struct supertype *st, char *subarray_id)
8e8941
 {
8e8941
-	/* remove the subarray currently referenced by ->current_vol */
8e8941
+	/* remove the subarray currently referenced by subarray_id */
8e8941
 	__u8 i;
8e8941
 	struct intel_dev **dp;
8e8941
 	struct intel_super *super = st->sb;
8e8941
-	__u8 current_vol = super->current_vol;
8e8941
+	__u8 current_vol = strtoul(subarray_id, NULL, 10);
8e8941
 	struct imsm_super *mpb = super->anchor;
8e8941
 
8e8941
-	if (super->current_vol < 0)
8e8941
+	if (mpb->num_raid_devs == 0)
8e8941
 		return 2;
8e8941
-	super->current_vol = -1; /* invalidate subarray cursor */
8e8941
 
8e8941
 	/* block deletions that would change the uuid of active subarrays
8e8941
 	 *
8e8941
-- 
8e8941
2.7.5
8e8941