Work around: retry ped_disk_commit_to_os() after sleep(1) (#604298)
Bug #604298 involves a problem that can occur when GParted uses libparted to manipulate a partition table, but the ped_disk_commit_to_os() function fails to inform the Linux kernel of these changes to the partition table. This problem is intermittent in nature and is difficult to reliably reproduce. This change is an attempt at a work around. If the first call to ped_disk_commit_to_os() fails, then we sleep for 1 second to allow the system to settle before invoking the function call again. My testing has shown that this greatly improves the chances of successfully informing the kernel of partition changes. Thanks go to François Dupoux and Steven Shiau for their suggestions and help to resolve this problem.
This commit is contained in:
parent
9c2d70e1d6
commit
bf86fd3f9c
|
@ -2762,8 +2762,19 @@ bool GParted_Core::commit_to_os( std::time_t timeout )
|
|||
if ( dmraid .is_dmraid_device( lp_disk ->dev ->path ) )
|
||||
succes = true ;
|
||||
else
|
||||
{
|
||||
succes = ped_disk_commit_to_os( lp_disk ) ;
|
||||
|
||||
//FIXME: Work around to try to alleviate problems caused by
|
||||
// bug #604298 - Failure to inform kernel of partition changes
|
||||
// If not successful the first time, try one more time.
|
||||
if ( ! succes )
|
||||
{
|
||||
sleep( 1 ) ;
|
||||
succes = ped_disk_commit_to_os( lp_disk ) ;
|
||||
}
|
||||
}
|
||||
|
||||
settle_device( timeout ) ;
|
||||
|
||||
return succes ;
|
||||
|
|
Loading…
Reference in New Issue