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

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