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...)
This commit is contained in:
Rogier Goossens 2012-02-07 14:04:46 +01:00 committed by Curtis Gedak
parent ed51f4b28f
commit 50befd62a3
1 changed files with 5 additions and 4 deletions

View File

@ -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,