[gparted] Check LVM cache only for LVM physical volumes



commit 50befd62a321aaac8ae85778ba05f31216e7e696
Author: Rogier Goossens <goossens rogier gmail com>
Date:   Tue Feb 7 14:04:46 2012 +0100

    Check LVM cache only for LVM physical volumes
    
    Determine the FS type before checking whether a FS is busy,
    and check LVM only for LVM PVs.
    
    Remove the LVM busy check for extended partitions, as they
    don't contain LVM PVs - or any other FS for that matter.
    (and even if they did, the rest of the code silently assumes
    they don't...)

 src/GParted_Core.cc |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index ed7b352..73b8ac6 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -917,6 +917,7 @@ void GParted_Core::set_device_partitions( Device & device )
 		libparted_messages .clear() ;
 		partition_temp .Reset() ;
 		bool partition_is_busy = false ;
+		GParted::FILESYSTEM filesystem ;
 
 		//Retrieve partition path
 		Glib::ustring partition_path = get_partition_path( lp_partition );
@@ -925,6 +926,7 @@ void GParted_Core::set_device_partitions( Device & device )
 		{
 			case PED_PARTITION_NORMAL:
 			case PED_PARTITION_LOGICAL:
+				filesystem = get_filesystem() ;
 #ifndef USE_LIBPARTED_DMRAID
 				//Handle dmraid devices differently because the minor number might not
 				//  match the last number of the partition filename as shown by "ls -l /dev/mapper"
@@ -943,13 +945,13 @@ void GParted_Core::set_device_partitions( Device & device )
 				else
 #endif
 					partition_is_busy = ped_partition_is_busy( lp_partition ) ||
-					                    lvm2_pv_info .has_active_lvs( partition_path ) ;
+					                    ( filesystem == GParted::FS_LVM2_PV && lvm2_pv_info .has_active_lvs( partition_path ) ) ;
 
 				partition_temp .Set( device .get_path(),
 						     partition_path,
 						     lp_partition ->num,
 						     lp_partition ->type == 0 ?	GParted::TYPE_PRIMARY : GParted::TYPE_LOGICAL,
-						     get_filesystem(),
+						     filesystem,
 						     lp_partition ->geom .start,
 						     lp_partition ->geom .end,
 						     device .sector_size,
@@ -985,8 +987,7 @@ void GParted_Core::set_device_partitions( Device & device )
 				}
 				else
 #endif
-					partition_is_busy = ped_partition_is_busy( lp_partition ) ||
-					                    lvm2_pv_info .has_active_lvs( partition_path ) ;
+					partition_is_busy = ped_partition_is_busy( lp_partition ) ;
 
 				partition_temp .Set( device .get_path(),
 						     partition_path, 



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