[gparted] Fix busy detection of file systems inside Linux Software RAID (#712533)
- From: Mike Fleetwood <mfleetwo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Fix busy detection of file systems inside Linux Software RAID (#712533)
- Date: Wed, 27 Nov 2013 20:21:23 +0000 (UTC)
commit 4d7ebe0314b8c713d7b0b1a1453e95f067d52fae
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sat Nov 16 16:00:28 2013 +0000
Fix busy detection of file systems inside Linux Software RAID (#712533)
On some distributions GParted doesn't detect when a file system is busy
and mounted when the partition is within a Linux Software RAID array.
Affected distributions include: Debian 6, Debian 7 and RHEL/CentOS 6.x.
This is because of a bug in libparted 2.3 and earlier. It was fixed by
this change in libparted 2.4:
http://git.savannah.gnu.org/cgit/parted.git/commit/?id=db52898c214310dab4ed84e6cb2f9ffc8c3aa502
linux: also detect "in-use" dmraid and scsi-Nth (N>=16) partition
Ubuntu 13.10 with libparted 2.3 is not affected because it contains a
distribution specific patch to correct it.
Fix by using GParted's internal mounted partitions map, mount_info, to
determine if a partition is busy, in addition to using libparted's
ped_partition_is_busy().
Bug #712533 - Partitions not detected as busy inside Software RAID on
some distros
src/GParted_Core.cc | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 962d8f3..54743b4 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1051,9 +1051,20 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
}
else
#endif
- partition_is_busy = ped_partition_is_busy( lp_partition )
- || ( filesystem == FS_LVM2_PV &&
lvm2_pv_info .has_active_lvs( partition_path ) )
- || ( filesystem == FS_LINUX_SWRAID &&
Utils::swraid_member_is_active( partition_path ) ) ;
+ {
+ //Determine if partition is busy:
+ // 1st search GParted internal mounted partitions map;
+ // 2nd custom checks for none file system partitions;
+ // 3rd use libparted.
+ iter_mp = mount_info .find( partition_path ) ;
+ if ( iter_mp != mount_info .end() )
+ partition_is_busy = true ;
+
+ partition_is_busy |= ( filesystem == FS_LVM2_PV &&
lvm2_pv_info .has_active_lvs( partition_path ) )
+ || ( filesystem == FS_LINUX_SWRAID &&
Utils::swraid_member_is_active( partition_path ) ) ;
+
+ partition_is_busy |= ped_partition_is_busy( lp_partition ) ;
+ }
partition_temp .Set( device .get_path(),
partition_path,
@@ -1095,7 +1106,10 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
}
else
#endif
+ {
+ //For extended partitions only use libparted to determine if it's
busy.
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]