All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinz Mauelshagen <mauelsha@fedoraproject.org>
To: lvm-devel@redhat.com
Subject: master - lvconvert: check for supported raid0/raid4 segtypes
Date: Thu, 27 Oct 2016 14:45:04 +0000 (UTC)	[thread overview]
Message-ID: <20161027144504.89107601EC@fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e118b65d651d921390d3e8bbcac7170c3894d048
Commit:        e118b65d651d921390d3e8bbcac7170c3894d048
Parent:        61ae07966dfa68e7a03c054b1486136028c5c4a6
Author:        Heinz Mauelshagen <heinzm@redhat.com>
AuthorDate:    Thu Oct 27 16:44:32 2016 +0200
Committer:     Heinz Mauelshagen <heinzm@redhat.com>
CommitterDate: Thu Oct 27 16:44:32 2016 +0200

lvconvert: check for supported raid0/raid4 segtypes

Validate kernel support for raid0/raid4 on given and
requested segtype before requesting conversions on them.

Because raid10 wasn't present in old RAID targets, add
the same validation to be prepared once we support them.
---
 tools/lvconvert.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 90642aa..23b5906 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1963,16 +1963,24 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
 
 	if ((seg_is_linear(seg) || seg_is_striped(seg) || seg_is_mirrored(seg) || lv_is_raid(lv)) &&
 	    (lp->type_str && lp->type_str[0])) {
-		/* Activation is required later which precludes existing unsupported raid0 segment */
-		if (segtype_is_any_raid0(lp->segtype) &&
+		/* Activation is required later which precludes existing supported raid0 segment */
+		if ((seg_is_any_raid0(seg) || segtype_is_any_raid0(lp->segtype)) &&
 		    !(lp->target_attr & RAID_FEATURE_RAID0)) {
 			log_error("RAID module does not support RAID0.");
 			return 0;
 		}
 
+		/* Activation is required later which precludes existing supported raid4 segment */
 		if (!_raid4_conversion_supported(lv, lp))
 			return 0;
 
+		/* Activation is required later which precludes existing supported raid10 segment */
+		if ((seg_is_raid10(seg) || segtype_is_raid10(lp->segtype)) &&
+		    !(lp->target_attr & RAID_FEATURE_RAID10)) {
+			log_error("RAID module does not support RAID10.");
+			return 0;
+		}
+
 		if (!arg_is_set(cmd, stripes_long_ARG))
 			lp->stripes = 0;
 



                 reply	other threads:[~2016-10-27 14:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20161027144504.89107601EC@fedorahosted.org \
    --to=mauelsha@fedoraproject.org \
    --cc=lvm-devel@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.