From: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
To: linux-raid@vger.kernel.org
Cc: Jes.Sorensen@redhat.com, tomasz.majchrzak@intel.com,
aleksey.obitotskiy@intel.com, pawel.baldysiak@intel.com,
artur.paszkiewicz@intel.com, maksymilian.kunt@intel.com,
Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Subject: [PATCH] Allow level migration only for single-array container
Date: Wed, 12 Oct 2016 14:29:42 +0200 [thread overview]
Message-ID: <1476275382-1566-1-git-send-email-mariusz.dabrowski@intel.com> (raw)
IMSM doesn't allow to change RAID level of array in container with two
arrays but array count check is being done too late (after removing disks)
and in some cases (e. g. RAID 0 and RAID 1 migrated to RAID 0) both arrays
become degraded. This patch adds array count check before disks are being
removed.
Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
---
Grow.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/Grow.c b/Grow.c
index 628f0e7..bcd27f5 100755
--- a/Grow.c
+++ b/Grow.c
@@ -777,6 +777,25 @@ int remove_disks_for_takeover(struct supertype *st,
struct mdinfo *remaining;
int slot;
+ if (st->ss->external) {
+ int rv = 0;
+ struct mdinfo *arrays = st->ss->container_content(st, NULL);
+ /* containter_content returns list of arrays in container
+ * If arrays->next is not NULL it means that there are 2 arrays in
+ * container and operation should be blocked
+ */
+ if (arrays) {
+ if (arrays->next)
+ rv = 1;
+ sysfs_free(arrays);
+ if (rv) {
+ pr_err("Error. Cannot perform operation on /dev/%s\n", st->devnm);
+ pr_err("For this operation it MUST be single array in container\n");
+ return rv;
+ }
+ }
+ }
+
if (sra->array.level == 10)
nr_of_copies = layout & 0xff;
else if (sra->array.level == 1)
--
1.8.3.1
next reply other threads:[~2016-10-12 12:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-12 12:29 Mariusz Dabrowski [this message]
2016-10-19 15:26 ` [PATCH] Allow level migration only for single-array container Jes Sorensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1476275382-1566-1-git-send-email-mariusz.dabrowski@intel.com \
--to=mariusz.dabrowski@intel.com \
--cc=Jes.Sorensen@redhat.com \
--cc=aleksey.obitotskiy@intel.com \
--cc=artur.paszkiewicz@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=maksymilian.kunt@intel.com \
--cc=pawel.baldysiak@intel.com \
--cc=tomasz.majchrzak@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).