Add fallback busy detection for btrfs file systems (#723842)
In a number of cases there may be no btrfs device cache entry. Some of the reasons why this can occur: 1) Mounting device removed from btrfs on linux <= 3.4 so old mount point in /proc/mounts; 2) btrfs and btrfs-show commands don't exist; 3) btrfs or btrfs-show command returned non-zero exit status; 4) get_cache_entry() failed to parse output from btrfs filesystem show or btrfs-show. Without a valid btrfs device cache entry, busy detection for all member devices fails. Search the GParted internal mounted partitions map as the fallback busy detection method. This can only determine if the mounting device is mounted or not, not any of the other members of a multi-device btrfs file system. Bug #723842 - GParted resizes the wrong filesystem (does not pass the devid to btrfs filesystem resize)
This commit is contained in:
parent
0e980a47a2
commit
d47783eff8
12
src/btrfs.cc
12
src/btrfs.cc
|
@ -441,6 +441,18 @@ void btrfs::clear_cache()
|
|||
Glib::ustring btrfs::get_mount_device( const Glib::ustring & path )
|
||||
{
|
||||
BTRFS_Device btrfs_dev = get_cache_entry( path ) ;
|
||||
if ( btrfs_dev .devid == -1 || btrfs_dev .members .empty() )
|
||||
{
|
||||
//WARNING:
|
||||
// No btrfs device cache entry found or entry without any member devices.
|
||||
// Use fallback busy detection method which can only determine if the
|
||||
// mounting device is mounted or not, not any of the other members of a
|
||||
// multi-device btrfs file system.
|
||||
if ( GParted_Core::is_dev_mounted( path ) )
|
||||
return path ;
|
||||
return "" ;
|
||||
}
|
||||
|
||||
for ( unsigned int i = 0 ; i < btrfs_dev .members .size() ; i ++ )
|
||||
if ( GParted_Core::is_dev_mounted( btrfs_dev .members[ i ] ) )
|
||||
return btrfs_dev .members[ i ] ;
|
||||
|
|
Loading…
Reference in New Issue