summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2020-11-19 19:42:08 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2020-11-19 19:42:08 +0000
commit80dadc0c749f5521377808360e4e9fa7aff7389b (patch)
tree6768be6791a9378b01fdb15b6eabd9cfdce784a1
parentc7ffac2610c088756c0709291b081b9a31079262 (diff)
downloaddrakx-80dadc0c749f5521377808360e4e9fa7aff7389b.tar
drakx-80dadc0c749f5521377808360e4e9fa7aff7389b.tar.gz
drakx-80dadc0c749f5521377808360e4e9fa7aff7389b.tar.bz2
drakx-80dadc0c749f5521377808360e4e9fa7aff7389b.tar.xz
drakx-80dadc0c749f5521377808360e4e9fa7aff7389b.zip
Fix a crash when detecting a mdadm RAID array (mga#26707)
get_hds() did not handle the case of a mdadm RAID array created using raw devices instead of partitions. The drakx tools never do this, but the user may have done it another way.
-rw-r--r--perl-install/NEWS3
-rw-r--r--perl-install/fsedit.pm20
-rw-r--r--perl-install/install/NEWS2
3 files changed, 22 insertions, 3 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 51b1f8e34..7d2dec024 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,6 @@
+- diskdrake:
+ o fix crash when a mdadm RAID array has been created outside diskdrake using
+ raw devices (mga#26707)
- remove-unused-packages:
o disable timeout - it can corrupt the rpm database (mga#27580)
- drakhardware:
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index e53648a37..d209b0196 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -82,11 +82,11 @@ sub recompute_loopbacks {
}
sub raids {
- my ($hds) = @_;
+ my ($hds, $raw_hds) = @_;
my @parts = fs::get::hds_fstab(@$hds);
- my @l = grep { isRawRAID($_) } @parts or return [];
+ my @l = grep { isRawRAID($_) } ( @parts, @$raw_hds ) or return [];
log::l("looking for raids in " . join(' ', map { $_->{device} } @l));
@@ -197,6 +197,20 @@ sub get_hds {
foreach my $hd (@drives) {
$hd->{readonly} = $flags->{readonly};
+ #- We only create RAID components in disk partitions, but users may have used
+ #- mdadm directly to create them on raw disk devices. Detect that now, before
+ #- looking for a partition table (which is likely to fail badly - mga#26707).
+ if (my $type = fs::type::type_subpart_from_magic($hd)) {
+ if (isRawRAID($type)) {
+ #- Add the necessary information to the raw device to allow the RAID
+ #- array to be properly characterised in diskdrake.
+ put_in_hash($hd, $type);
+ $hd->{size} = $hd->{totalsectors};
+ push @raw_hds, $hd;
+ next;
+ }
+ }
+
eval { partition_table::raw::test_for_bad_drives($hd) if !$flags->{no_bad_drives} };
if (my $err = $@) {
log::l("test_for_bad_drives returned $err");
@@ -310,7 +324,7 @@ Do you agree to lose all the partitions?
}
#- detect raids before LVM allowing LVM on raid
- my $raids = raids(\@hds);
+ my $raids = raids(\@hds, \@raw_hds);
my $all_hds = { %{ fs::get::empty_all_hds() }, hds => \@hds, raw_hds => \@raw_hds, lvms => [], raids => $raids };
$all_hds->{lvms} = [ lvms($all_hds) ];
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index 7aa26dc3a..25f14d1fb 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,5 +1,7 @@
- partitioning:
o do not mount ESP with umask=0 under UEFI (mga#27415)
+ o fix "partition table is too corrupt for me" error when a mdadm RAID array
+ has been created outside Mageia tools using raw devices (mga#26707)
Version 18.34 - 14 September 2020