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
This commit is contained in:
parent
103fd9a0c6
commit
4d7ebe0314
|
@ -1051,9 +1051,20 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
partition_is_busy = ped_partition_is_busy( lp_partition )
|
{
|
||||||
|| ( filesystem == FS_LVM2_PV && lvm2_pv_info .has_active_lvs( partition_path ) )
|
//Determine if partition is busy:
|
||||||
|| ( filesystem == FS_LINUX_SWRAID && Utils::swraid_member_is_active( partition_path ) ) ;
|
// 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_temp .Set( device .get_path(),
|
||||||
partition_path,
|
partition_path,
|
||||||
|
@ -1095,7 +1106,10 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
//For extended partitions only use libparted to determine if it's busy.
|
||||||
partition_is_busy = ped_partition_is_busy( lp_partition ) ;
|
partition_is_busy = ped_partition_is_busy( lp_partition ) ;
|
||||||
|
}
|
||||||
|
|
||||||
partition_temp .Set( device .get_path(),
|
partition_temp .Set( device .get_path(),
|
||||||
partition_path,
|
partition_path,
|
||||||
|
|
Loading…
Reference in New Issue