Mageia Bugzilla – Attachment 9172 Details for
Bug 20619
Failure to inform kernel about partition table changes when "Use entire disk" is selected in installer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Patch to drakxtools to make DOS partitioning more robust
0001-Add-safety-net-for-informing-the-kernel-after-writin.patch (text/plain), 2.36 KB, created by
Martin Whitaker
on 2017-04-02 22:12:14 CEST
(
hide
)
Description:
Patch to drakxtools to make DOS partitioning more robust
Filename:
MIME Type:
Creator:
Martin Whitaker
Created:
2017-04-02 22:12:14 CEST
Size:
2.36 KB
patch
obsolete
>From f844e7410941f15021dc0ae23bbde0f9c6c70782 Mon Sep 17 00:00:00 2001 >From: Martin Whitaker <mageia@martin-whitaker.me.uk> >Date: Sun, 2 Apr 2017 19:45:27 +0100 >Subject: [PATCH 1/2] Add safety net for informing the kernel after writing a > DOS partition table. > >There is an unidentified condition that prevents udevd calling the >BLKRRPART ioctl after a partition table is written. It looks like >either the kernel or udevd drops device change events if they are >too closely spaced in time. So, in the case where we expect udevd >to call BLKRRPART, check /proc/partitions to make sure it has done >so. Arbitrarily try 5 times, 100ms apart, before giving up and >informing the kernel ourselves. > >diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm >index a97fcf8..61d0f45 100644 >--- a/perl-install/partition_table/dos.pm >+++ b/perl-install/partition_table/dos.pm >@@ -6,9 +6,11 @@ use vars qw(@ISA); > > @ISA = qw(partition_table::raw); > >+use Time::HiRes qw(usleep); > use common; > use partition_table::raw; > use partition_table; >+use fs::proc_partitions; > use fs::type; > use c; > >@@ -291,7 +293,24 @@ sub need_to_tell_kernel { > # diskdrake will not let the user delete an individual partition that is mounted, but will let the > # user clear all partitions. So initialize() records if any partitions were mounted and we take note > # of that here. >- return ! -e '/usr/lib/udev/rules.d/60-block.rules' || delete $hd->{hadMountedPartitions} || any { $_->{isMounted} } partition_table::get_normal_parts($hd); >+ return 1 if ! -e '/usr/lib/udev/rules.d/60-block.rules' || delete $hd->{hadMountedPartitions} || any { $_->{isMounted} } partition_table::get_normal_parts($hd); >+ >+ # No further actions must be performed until the kernel has been informed of the changes. There is >+ # no easy way to check that udevd has received the uevent and called the BLKRRPART ioctl, so do it >+ # the hard way. >+ my $tries = 0; >+ do { >+ usleep(100000); >+ log::l("checking that udevd has informed the kernel of partition table changes"); >+ eval { fs::proc_partitions::compare($hd) }; >+ return 0 if !$@; >+ $tries++; >+ } while $tries < 5; >+ >+ # We don't expect to get here, but fail safe if so. >+ log::l("udevd failed to inform kernel of partition table changes"); >+ $hd->{rebootNeeded} = 1; >+ 1; > } > > sub empty_raw { { raw => [ ({}) x $nb_primary ] } } >-- >2.10.2
From f844e7410941f15021dc0ae23bbde0f9c6c70782 Mon Sep 17 00:00:00 2001 From: Martin Whitaker <mageia@martin-whitaker.me.uk> Date: Sun, 2 Apr 2017 19:45:27 +0100 Subject: [PATCH 1/2] Add safety net for informing the kernel after writing a DOS partition table. There is an unidentified condition that prevents udevd calling the BLKRRPART ioctl after a partition table is written. It looks like either the kernel or udevd drops device change events if they are too closely spaced in time. So, in the case where we expect udevd to call BLKRRPART, check /proc/partitions to make sure it has done so. Arbitrarily try 5 times, 100ms apart, before giving up and informing the kernel ourselves. diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm index a97fcf8..61d0f45 100644 --- a/perl-install/partition_table/dos.pm +++ b/perl-install/partition_table/dos.pm @@ -6,9 +6,11 @@ use vars qw(@ISA); @ISA = qw(partition_table::raw); +use Time::HiRes qw(usleep); use common; use partition_table::raw; use partition_table; +use fs::proc_partitions; use fs::type; use c; @@ -291,7 +293,24 @@ sub need_to_tell_kernel { # diskdrake will not let the user delete an individual partition that is mounted, but will let the # user clear all partitions. So initialize() records if any partitions were mounted and we take note # of that here. - return ! -e '/usr/lib/udev/rules.d/60-block.rules' || delete $hd->{hadMountedPartitions} || any { $_->{isMounted} } partition_table::get_normal_parts($hd); + return 1 if ! -e '/usr/lib/udev/rules.d/60-block.rules' || delete $hd->{hadMountedPartitions} || any { $_->{isMounted} } partition_table::get_normal_parts($hd); + + # No further actions must be performed until the kernel has been informed of the changes. There is + # no easy way to check that udevd has received the uevent and called the BLKRRPART ioctl, so do it + # the hard way. + my $tries = 0; + do { + usleep(100000); + log::l("checking that udevd has informed the kernel of partition table changes"); + eval { fs::proc_partitions::compare($hd) }; + return 0 if !$@; + $tries++; + } while $tries < 5; + + # We don't expect to get here, but fail safe if so. + log::l("udevd failed to inform kernel of partition table changes"); + $hd->{rebootNeeded} = 1; + 1; } sub empty_raw { { raw => [ ({}) x $nb_primary ] } } -- 2.10.2
View Attachment As Raw
Actions:
View
Attachments on
bug 20619
:
9171
| 9172 |
9173