Mageia Bugzilla – Attachment 9037 Details for
Bug 20264
Using "clear all" in diskdrake or in installer partitioning on GPT disk results in "failed to del partition #1 on /dev/..." message
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Replacement fix for original issue
0001-Revised-fix-for-clearing-GPT-partitions-during-autom.patch (text/plain), 3.99 KB, created by
Thierry Vignaud
on 2017-03-07 21:50:53 CET
(
hide
)
Description:
Replacement fix for original issue
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2017-03-07 21:50:53 CET
Size:
3.99 KB
patch
obsolete
>From 15f3e05b41480a1d1d0334b663cef151ca50cb94 Mon Sep 17 00:00:00 2001 >From: Martin Whitaker <mageia@martin-whitaker.me.uk> >Date: Sat, 4 Mar 2017 12:02:55 +0000 >Subject: [PATCH 1/4] 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. >--- > perl-install/partition_table.pm | 12 ++++++++++-- > perl-install/partition_table/gpt.pm | 7 ++----- > 2 files changed, 12 insertions(+), 7 deletions(-) > >diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm >index 4b357ab..f3a6798 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) = @$_; >diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm >index 7beecb3..f2f39f0 100644 >--- a/perl-install/partition_table/gpt.pm >+++ b/perl-install/partition_table/gpt.pm >@@ -81,9 +81,6 @@ sub write { > $partitions_killed = 1; > } > >- # sync libparted view with diskdrake one in order to prevent overlapping errors when adding partitions: >- c::disk_delete_all($hd->{file}) if delete $hd->{sync_with_libparted}; >- > foreach (@{$hd->{will_tell_kernel}}) { > my ($action, $part_number, $o_start, $o_size) = @$_; > my ($part) = grep { $_->{start} == $o_start && $_->{size} == $o_size } @$pt; >@@ -107,6 +104,8 @@ sub write { > } > } elsif ($action eq 'del' && !$partitions_killed) { > c::disk_del_partition($hd->{file}, $part_number) or die "failed to del partition #$part_number on $hd->{file}"; >+ } elsif ($action eq 'init' && !$partitions_killed) { >+ c::disk_delete_all($hd->{file}) or die "failed to delete all partitions on $hd->{file}"; > } > } > # prevent errors when telling kernel to reread partition table: >@@ -118,8 +117,6 @@ sub write { > > sub initialize { > my ($class, $hd) = @_; >- # sync libparted view with diskdrake one in order to prevent overlapping errors when adding partitions: >- $hd->{sync_with_libparted} = 1; > # part_number starts at 1 > my @raw = map { +{ part_number => $_ + 1 } } 0..$nb_primary-2; > $hd->{primary} = { raw => \@raw }; >-- >2.10.2 >
From 15f3e05b41480a1d1d0334b663cef151ca50cb94 Mon Sep 17 00:00:00 2001 From: Martin Whitaker <mageia@martin-whitaker.me.uk> Date: Sat, 4 Mar 2017 12:02:55 +0000 Subject: [PATCH 1/4] 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. --- perl-install/partition_table.pm | 12 ++++++++++-- perl-install/partition_table/gpt.pm | 7 ++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index 4b357ab..f3a6798 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) = @$_; diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm index 7beecb3..f2f39f0 100644 --- a/perl-install/partition_table/gpt.pm +++ b/perl-install/partition_table/gpt.pm @@ -81,9 +81,6 @@ sub write { $partitions_killed = 1; } - # sync libparted view with diskdrake one in order to prevent overlapping errors when adding partitions: - c::disk_delete_all($hd->{file}) if delete $hd->{sync_with_libparted}; - foreach (@{$hd->{will_tell_kernel}}) { my ($action, $part_number, $o_start, $o_size) = @$_; my ($part) = grep { $_->{start} == $o_start && $_->{size} == $o_size } @$pt; @@ -107,6 +104,8 @@ sub write { } } elsif ($action eq 'del' && !$partitions_killed) { c::disk_del_partition($hd->{file}, $part_number) or die "failed to del partition #$part_number on $hd->{file}"; + } elsif ($action eq 'init' && !$partitions_killed) { + c::disk_delete_all($hd->{file}) or die "failed to delete all partitions on $hd->{file}"; } } # prevent errors when telling kernel to reread partition table: @@ -118,8 +117,6 @@ sub write { sub initialize { my ($class, $hd) = @_; - # sync libparted view with diskdrake one in order to prevent overlapping errors when adding partitions: - $hd->{sync_with_libparted} = 1; # part_number starts at 1 my @raw = map { +{ part_number => $_ + 1 } } 0..$nb_primary-2; $hd->{primary} = { raw => \@raw }; -- 2.10.2
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 20264
:
9028
|
9029
|
9030
|
9031
| 9037 |
9038
|
9039
|
9040
|
9041
|
9042
|
9043
|
9047
|
9054
|
9055
|
9060
|
9082