From a41ab57be17ef2a065973721f936dfa0fa535107 Mon Sep 17 00:00:00 2001 From: Vratislav Podzimek Date: Wed, 12 Apr 2017 12:15:59 +0200 Subject: [PATCH] New version - Do not try to parse 'raid_spec' for 'bd_md_activate' (vtrefny) --- libblockdev.spec | 8 +++++- md_activate_fix.patch | 65 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 md_activate_fix.patch diff --git a/libblockdev.spec b/libblockdev.spec index 31541b6..87eedfa 100644 --- a/libblockdev.spec +++ b/libblockdev.spec @@ -64,13 +64,14 @@ Name: libblockdev Version: 2.6 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A library for low-level manipulation with block devices License: LGPLv2+ URL: https://github.com/rhinstaller/libblockdev Source0: https://github.com/rhinstaller/libblockdev/archive/%{name}-%{version}.tar.gz Patch0: valid_thpool_md_size.patch +Patch1: md_activate_fix.patch BuildRequires: glib2-devel BuildRequires: gobject-introspection-devel @@ -520,6 +521,7 @@ A meta-package that pulls all the libblockdev plugins as dependencies. %prep %setup -q -n %{name}-%{version} %patch0 -p1 +%patch1 -p1 %build %configure %{?configure_opts} @@ -789,6 +791,10 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} %files plugins-all %changelog +* Wed Apr 12 2017 Vratislav Podzimek - 2.6-3 +- Do not try to parse 'raid_spec' for 'bd_md_activate' (vtrefny) + Resolves: rhbz#1439111 + * Tue Apr 11 2017 Vratislav Podzimek - 2.6-2 - Make sure the returned thpool MD size is valid (vpodzime) diff --git a/md_activate_fix.patch b/md_activate_fix.patch new file mode 100644 index 0000000..c8068b8 --- /dev/null +++ b/md_activate_fix.patch @@ -0,0 +1,65 @@ +From 44bb54dc76c1adb2d0263343a00016537a334d5f Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 12 Apr 2017 08:37:39 +0200 +Subject: [PATCH] Do not try to parse 'raid_spec' for 'bd_md_activate' + (#1439111) + +It is possible to call 'mdadm --assemble' using the '/dev/md...' +path so do not try to parse/check given raid specification -- +even non-existing path is a valid input for this function. +--- + src/plugins/mdraid.c | 12 ++---------- + tests/mdraid_test.py | 4 +++- + 2 files changed, 5 insertions(+), 11 deletions(-) + +diff --git a/src/plugins/mdraid.c b/src/plugins/mdraid.c +index c7cfe2a..e5e5f8b 100644 +--- a/src/plugins/mdraid.c ++++ b/src/plugins/mdraid.c +@@ -635,7 +635,6 @@ gboolean bd_md_activate (const gchar *raid_spec, const gchar **members, const gc + guint64 num_members = (raid_spec && members) ? g_strv_length ((gchar **) members) : 0; + const gchar **argv = NULL; + gchar *uuid_str = NULL; +- gchar *mdadm_spec = NULL; + guint argv_top = 0; + guint i = 0; + gboolean ret = FALSE; +@@ -643,17 +642,10 @@ gboolean bd_md_activate (const gchar *raid_spec, const gchar **members, const gc + /* mdadm, --assemble, raid_spec/--scan, --run, --uuid=uuid, member1, member2,..., NULL*/ + argv = g_new0 (const gchar*, num_members + 6); + +- if (raid_spec) { +- mdadm_spec = get_mdadm_spec_from_input (raid_spec, error); +- if (!mdadm_spec) +- /* error is already populated */ +- return FALSE; +- } +- + argv[argv_top++] = "mdadm"; + argv[argv_top++] = "--assemble"; +- if (mdadm_spec) +- argv[argv_top++] = mdadm_spec; ++ if (raid_spec) ++ argv[argv_top++] = raid_spec; + else + argv[argv_top++] = "--scan"; + if (start_degraded) +diff --git a/tests/mdraid_test.py b/tests/mdraid_test.py +index 09c8542..0a526d1 100644 +--- a/tests/mdraid_test.py ++++ b/tests/mdraid_test.py +@@ -227,8 +227,10 @@ class MDTestActivateDeactivate(MDTestCase): + succ = BlockDev.md_deactivate(BlockDev.md_node_from_name("bd_test_md")) + self.assertTrue(succ) + ++ # try to activate using full path, not just the name ++ # (it should work too and blivet does this) + with wait_for_action("resync"): +- succ = BlockDev.md_activate("bd_test_md", ++ succ = BlockDev.md_activate("/dev/md/bd_test_md", + [self.loop_dev, self.loop_dev2, self.loop_dev3], None) + self.assertTrue(succ) + +-- +2.9.3 +