[gparted] Work around: retry ped_disk_commit_to_os() after sleep(1) (#604298)



commit bf86fd3f9ceb0096dfe87a8c9a38403c13b13f00
Author: Curtis Gedak <gedakc gmail com>
Date:   Fri Jan 15 15:30:50 2010 -0700

    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.

 src/GParted_Core.cc |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 7a942de..f82aca7 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -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 ;



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