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



commit 2f53876c0fc8bceddabe739c298e19e7939d9ad7
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Tue Nov 28 12:44:13 2017 +0000

    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

 src/GParted_Core.cc |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 47bd271..7d70256 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -4243,7 +4243,12 @@ bool GParted_Core::commit( PedDisk* lp_disk )
        succes = commit_to_os( lp_disk, SETTLE_DEVICE_APPLY_MAX_WAIT_SECONDS ) && succes;
 
        if ( opened )
+       {
                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 ;
 }
@@ -4273,6 +4278,8 @@ bool GParted_Core::commit_to_os( PedDisk* lp_disk, std::time_t timeout )
        }
 #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 ) ;
 
        return succes ;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]