mirror of https://github.com/digint/btrbk
btrbk: trigger autofs mount while resolving mountpoints
If resolved mount point has fs_type=autofs, trigger automount by calling "btrfs subvolume show" on the mount point, and check mountinfo again.pull/274/head
parent
f37a638f30
commit
17957a163a
|
@ -1,6 +1,7 @@
|
||||||
btrbk-master
|
btrbk-master
|
||||||
|
|
||||||
* Bump dependency >= btrfs-progs-4.12 (as of btrbk-0.27.0).
|
* Bump dependency >= btrfs-progs-4.12 (as of btrbk-0.27.0).
|
||||||
|
* Trigger autofs mount while resolving mountpoints (close #259).
|
||||||
|
|
||||||
btrbk-0.27.1
|
btrbk-0.27.1
|
||||||
|
|
||||||
|
|
17
btrbk
17
btrbk
|
@ -1847,9 +1847,10 @@ sub system_mkdir($)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub btrfs_mountpoint($)
|
sub btrfs_mountpoint
|
||||||
{
|
{
|
||||||
my $vol = shift // die;
|
my $vol = shift // die;
|
||||||
|
my $autofs_retry = shift;
|
||||||
|
|
||||||
DEBUG "Resolving btrfs mount point for: $vol->{PRINT}";
|
DEBUG "Resolving btrfs mount point for: $vol->{PRINT}";
|
||||||
|
|
||||||
|
@ -1891,7 +1892,19 @@ sub btrfs_mountpoint($)
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
TRACE "resolved mount point (mount_source=$mountpoint->{mount_source}, subvolid=" . ($mountpoint->{MNTOPS}->{subvolid} // '<undef>') . "): $mountpoint->{mount_point}";
|
TRACE "resolved mount point (mount_source=$mountpoint->{mount_source}, subvolid=" . ($mountpoint->{MNTOPS}->{subvolid} // '<undef>') . "): $mountpoint->{mount_point}";
|
||||||
unless($mountpoint->{fs_type} eq 'btrfs') {
|
|
||||||
|
# handle autofs
|
||||||
|
if($mountpoint->{fs_type} eq 'autofs') {
|
||||||
|
if($autofs_retry) {
|
||||||
|
DEBUG "non-btrfs autofs mount point for: $vol->{PRINT}";
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
DEBUG "autofs mount point found, triggering automount on $mountpoint->{mount_point} for: $vol->{PRINT}";
|
||||||
|
btrfs_subvolume_show(vinfo($vol->{URL_PREFIX} . $mountpoint->{mount_point}, $vol->{CONFIG}));
|
||||||
|
$mountinfo_cache{$host} = undef;
|
||||||
|
return btrfs_mountpoint($vol, 1);
|
||||||
|
}
|
||||||
|
elsif($mountpoint->{fs_type} ne 'btrfs') {
|
||||||
DEBUG "No btrfs mount point found for: $vol->{PRINT}";
|
DEBUG "No btrfs mount point found for: $vol->{PRINT}";
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue