From f9a84585d7c3cb6ef8c51f39ac784cdfa1c78c0201d15c2246d315e65902131a Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 21 Sep 2011 23:59:12 +0000 Subject: [PATCH] - rebuild.fix: When a rebuild is requested that cannot be handled, report and error instead of crashing (bnc#716904) - ddf-erase: Allow dmraid to erase ddf metadata properly (bnc#712671) OBS-URL: https://build.opensuse.org/package/show/Base:System/dmraid?expand=0&rev=19 --- ddf-erase | 31 +++++++++++++++++++++++++++++++ dmraid.changes | 9 +++++++++ dmraid.spec | 4 ++++ rebuild.fix | 27 +++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 ddf-erase create mode 100644 rebuild.fix diff --git a/ddf-erase b/ddf-erase new file mode 100644 index 0000000..0c1cfde --- /dev/null +++ b/ddf-erase @@ -0,0 +1,31 @@ +Allow dmraid to erase ddf metadata properly. + +2 things go wrong: + 1/ when seeking to the anchor, it seeks to far by a factor of 512 + 2/ when writing to the anchor, it writes 0 bytes, not 512. + +Signed-off-by: NeilBrown +References: bnc#712671 +--- + lib/format/ddf/ddf1.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- 1.0.0.rc16.orig/lib/format/ddf/ddf1.c ++++ 1.0.0.rc16/lib/format/ddf/ddf1.c +@@ -536,7 +536,7 @@ try_to_find_ddf1(struct lib_context *lc, + ddf1_sboffset) || !is_ddf1(lc, di, ddf1)) + goto bad; + +- ddf1->anchor_offset = ddf1_sboffset; ++ ddf1->anchor_offset = ddf1_sboffset / 512; + + /* Convert endianness */ + ddf1->in_cpu_format = 0; +@@ -967,6 +967,7 @@ setup_rd(struct lib_context *lc, struct + ma[i].offset = ddf1->primary->primary_table_lba; + + ma->offset = ddf1->anchor_offset; ++ ma->size = 512; + (ma++)->area = &ddf1->anchor; + + (ma++)->area = ddf1->primary; diff --git a/dmraid.changes b/dmraid.changes index d8f9795..91ffd99 100644 --- a/dmraid.changes +++ b/dmraid.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Sep 21 23:57:12 UTC 2011 - nfbrown@suse.com + +- rebuild.fix: When a rebuild is requested that + cannot be handled, report and error instead of + crashing (bnc#716904) +- ddf-erase: Allow dmraid to erase ddf metadata + properly (bnc#712671) + ------------------------------------------------------------------- Fri May 27 09:29:31 UTC 2011 - lnussel@suse.de diff --git a/dmraid.spec b/dmraid.spec index 1b48e52..cfb04d1 100644 --- a/dmraid.spec +++ b/dmraid.spec @@ -40,6 +40,8 @@ Patch2: dmraid-1.0.0.rc13-geometry.patch Patch3: lib-install.patch Patch4: handle_spaces Patch5: remove_trylock +Patch6: rebuild.fix +Patch7: ddf-erase BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: %fillup_prereq @@ -76,6 +78,8 @@ Authors: %patch3 -p1 %patch4 -p1 %patch5 -p2 +%patch6 -p1 +%patch7 -p1 cp %{SOURCE3} . %build diff --git a/rebuild.fix b/rebuild.fix new file mode 100644 index 0000000..18882d0 --- /dev/null +++ b/rebuild.fix @@ -0,0 +1,27 @@ +Only imsm arrays can be rebuild by dmraid + +Others cause a segfault. + +Fix that so they print a more helpful error messages. + +From: Leonardo Chiquitto +Reviewed-by: NeilBrown +References: bnc#716904 +--- + lib/metadata/reconfig.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- 1.0.0.rc16.orig/lib/metadata/reconfig.c ++++ 1.0.0.rc16/lib/metadata/reconfig.c +@@ -552,6 +552,11 @@ _rebuild_raidset(struct lib_context *lc, + int driveRebuild = 1; + + rs = find_group(lc, sub_rs); ++ if (!rs) { ++ log_print(lc, "Rebuild: array \"%s\" cannot be rebuilt by dmraid.\n", ++ set_name); ++ return 1; ++ } + + /* raid 0 cannot be rebuild - exit */ + if (T_RAID0(sub_rs) && (!SETS(sub_rs))) {