[gparted] Fix regression - linux-swap resize broken (#706604)



commit 51845b7799b637b83d62ca6c4b89348e914d786a
Author: Curtis Gedak <gedakc gmail com>
Date:   Thu Aug 22 12:46:09 2013 -0600

    Fix regression - linux-swap resize broken (#706604)
    
    Unfortunately a regression was introduced with GParted 0.14.1 wherein
    linux-swap grow and shrink operations were broken.  This regression was
    a direct result of the following commit:
    
        Prevent file system grow when partition grow fails (#686668)
        fd963289201532f2216029ffd1e0b49e22d79560
    
    The regression did not result in an error in the GUI, but rather the
    linux-swap file system was not "resized" to the correct partition size.
    
    The logic error introduced with the above commit listed has now been
    fixed.
    
    BACKGROUND INFORMATION ON LINUX-SWAP RESIZING
    
    Currently no command line tools are available for resizing linux-swap.
    However, since linux-swap does not contain data in the usual sense, we
    simulate resizing linux-swap by re-creating (maximizing to fill
    partition) the linux-swap file system with the same UUID and volume
    label.  To work correctly, the linux-swap file system must be re-created
    after the final partition resize action has occurred.
    
    Closes Bug #706604 - Failure to properly grow or shrink linux-swap when
                         resizing

 src/GParted_Core.cc |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 8707066..625265f 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -2273,9 +2273,9 @@ bool GParted_Core::resize( const Partition & partition_old,
 
                //expand file system to fit exactly in partition
                if (   succes
-                   && (   //Maximize file system if FS not linux-swap and new size > old
-                          partition_new .filesystem != FS_LINUX_SWAP  //linux-swap is recreated, not resized
-                       && partition_new .get_sector_length() > partition_old .get_sector_length()
+                   && (   //Maximize file system if linux-swap or new size > old
+                          partition_new .filesystem == FS_LINUX_SWAP  //linux-swap is recreated, not resized
+                       || partition_new .get_sector_length() > partition_old .get_sector_length()
                       )
                   )
                        succes =    check_repair_filesystem( partition_new, operationdetail )


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