summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-01-21 20:00:20 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-02-12 11:54:53 +0000
commitd274ab5b4c48d0a91a535c976a9e7a9a78b56f05 (patch)
tree2c58119f06d2143f5dfecee023361ae03858a5b7 /perl-install
parent105d6bea5e69ee7011e5c468ba3cd05eb999b359 (diff)
downloaddrakx-d274ab5b4c48d0a91a535c976a9e7a9a78b56f05.tar
drakx-d274ab5b4c48d0a91a535c976a9e7a9a78b56f05.tar.gz
drakx-d274ab5b4c48d0a91a535c976a9e7a9a78b56f05.tar.bz2
drakx-d274ab5b4c48d0a91a535c976a9e7a9a78b56f05.tar.xz
drakx-d274ab5b4c48d0a91a535c976a9e7a9a78b56f05.zip
Don't tell the kernel about partition table changes when it rescans them automatically (mga#20074).
When no partitions on a DOS-partitioned disk are mounted, the kernel automatically rescans the partition table when it is written to disk. We shouldn't then try to update the kernel's view of the partition table, as the list of deltas we have recorded is relative to the previous state of the partition table, not the newly rescanned state. The behaviour for other partition table types is unchanged. v2 (tvignaud): just make base class assume the kernel doesn't reread, only mbr subclass overrides need_to_tell_kernel() in order to be smarter
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/partition_table.pm2
-rw-r--r--perl-install/partition_table/dos.pm8
-rw-r--r--perl-install/partition_table/raw.pm6
3 files changed, 15 insertions, 1 deletions
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 049c7bb2e..76da83b81 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -500,7 +500,7 @@ sub write {
fs::dmraid::call_dmraid('-an');
fs::dmraid::call_dmraid('-ay');
} else {
- tell_kernel($hd, $tell_kernel);
+ tell_kernel($hd, $tell_kernel) if $hd->need_to_tell_kernel();
}
}
# get major/minor again after writing the partition table so that we got them for dynamic devices
diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm
index c56cdab31..69566aaa8 100644
--- a/perl-install/partition_table/dos.pm
+++ b/perl-install/partition_table/dos.pm
@@ -278,6 +278,14 @@ sub end_write {
close $F;
}
+sub need_to_tell_kernel {
+ my ($hd) = @_;
+ # If none of the partitions are mounted, the kernel will automatically rescan
+ # the partition table. If any partitions are mounted, this doesn't happen, so
+ # we need to tell the kernel what has changed.
+ return any { $_->{isMounted} } partition_table::get_normal_parts($hd);
+}
+
sub empty_raw { { raw => [ ({}) x $nb_primary ] } }
sub initialize {
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index e9b293b90..ebb20b179 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -238,6 +238,12 @@ sub zero_MBR_and_dirty {
fsedit::partition_table_clear_and_initialize([], $hd);
}
+#- by default, we assume the kernel doesn't automatically reread partition table:
+sub need_to_tell_kernel {
+ my ($_hd) = @_;
+ 1;
+}
+
sub read_primary {
my ($hd) = @_;