summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table.pm
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-03-04 12:02:55 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-03-14 22:22:31 +0000
commitca515b773e51493aee36d67a5893af33101493b1 (patch)
tree79e5c8a1bd52b2e4f6ab51cd383e3658919202e3 /perl-install/partition_table.pm
parentb8551ad154fa255021b5c58ac7cdd729cbffc3f8 (diff)
downloaddrakx-ca515b773e51493aee36d67a5893af33101493b1.tar
drakx-ca515b773e51493aee36d67a5893af33101493b1.tar.gz
drakx-ca515b773e51493aee36d67a5893af33101493b1.tar.bz2
drakx-ca515b773e51493aee36d67a5893af33101493b1.tar.xz
drakx-ca515b773e51493aee36d67a5893af33101493b1.zip
Revised fix for clearing GPT partitions during automatic install.
This reverts commit 532fd1d60df306e204bae79c5158ca2302739966, which introduced a new bug when clearing GPT partitions in an interactive session (mga#20264), and replaces it with a new solution. When a partition table is initialised, we now add an 'init' action to the $hd->{will_tell_kernel} list. This is used both by gpt::write() (to clear the partition table) and by partition_table::tell_kernel() (to force the kernel to reread the partition table). Previous changes stored in $hd->{will_tell_kernel} are discarded, as they are no longer of interest. This also removes support for the will_tell_kernel 'force_reboot' action, as nothing uses that any more.
Diffstat (limited to 'perl-install/partition_table.pm')
-rw-r--r--perl-install/partition_table.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 4b357abb0..f3a67984f 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -284,6 +284,8 @@ sub initialize {
partition_table::dos::compute_CHS($hd, $part);
$hd->{primary}{raw}[0] = $part;
}
+
+ will_tell_kernel($hd, 'init');
}
sub read_primary {
@@ -394,6 +396,13 @@ sub will_tell_kernel {
if ($action eq 'resize') {
will_tell_kernel($hd, del => $o_part);
will_tell_kernel($hd, add => $o_part);
+ } elsif ($action eq 'init') {
+ # We will tell the kernel to reread the partition table, so no need to remember
+ # previous changes.
+ delete $hd->{will_tell_kernel};
+ delete $hd->{will_tell_kerneldelay_add};
+ delete $hd->{will_tell_kerneldelay_del};
+ push @{$hd->{will_tell_kernel} ||= []}, [ $action, () ];
} else {
my $part_number;
if ($o_part) {
@@ -403,7 +412,6 @@ sub will_tell_kernel {
}
my @para =
- $action eq 'force_reboot' ? () :
$action eq 'add' ? ($part_number, $o_part->{start}, $o_part->{size}) :
$action eq 'del' ? $part_number :
internal_error("unknown action $action");
@@ -426,7 +434,7 @@ sub tell_kernel {
my $F = partition_table::raw::openit($hd);
- my $force_reboot = any { $_->[0] eq 'force_reboot' } @$tell_kernel;
+ my $force_reboot = any { $_->[0] eq 'init' } @$tell_kernel;
if (!$force_reboot) {
foreach (@$tell_kernel) {
my ($action, $part_number, $o_start, $o_size) = @$_;