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

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