Wait for the kernel and udev to settle partitions for a second time (#790418)

There is still another subtle issue.  When GParted_Core::commit() closes
the device, the kernel initiates a second set of events which removes
and re-adds the partitions again.  Need to wait for these to complete
to prevent any following step failing with missing partition device
nodes.

Bug 790418 - "Unable to inform the kernel of the change" message may
             lead to corrupted partition table
This commit is contained in:
Mike Fleetwood 2017-11-28 12:44:13 +00:00 committed by Curtis Gedak
parent f49f0bb2b8
commit 2f53876c0f
1 changed files with 7 additions and 0 deletions

View File

@ -4243,7 +4243,12 @@ bool GParted_Core::commit( PedDisk* lp_disk )
succes = commit_to_os( lp_disk, SETTLE_DEVICE_APPLY_MAX_WAIT_SECONDS ) && succes; succes = commit_to_os( lp_disk, SETTLE_DEVICE_APPLY_MAX_WAIT_SECONDS ) && succes;
if ( opened ) if ( opened )
{
ped_device_close( lp_disk->dev ); ped_device_close( lp_disk->dev );
// Wait for udev rules to complete and partition device nodes to settle
// from this ped_device_close().
settle_device( SETTLE_DEVICE_APPLY_MAX_WAIT_SECONDS );
}
return succes ; return succes ;
} }
@ -4273,6 +4278,8 @@ bool GParted_Core::commit_to_os( PedDisk* lp_disk, std::time_t timeout )
} }
#endif #endif
// Wait for udev rules to complete and partition device nodes to settle from above
// ped_disk_commit_to_os() initiated kernel update of the partitions.
settle_device( timeout ) ; settle_device( timeout ) ;
return succes ; return succes ;