[pve-devel] applied: [PATCH container] don't leave fstrim lock if mount_all fails

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Aug 28 10:48:16 CEST 2019


On 26.08.19 16:06, Oguz Bektas wrote:
> when a container has a mountpoint which can't be mounted for some reason,
> mount_all dies and the fstrim lock stays. prevent this by moving the call into
> eval, warn if any error occurs.

applied, but added a little bit information here about the unmount_all case:

    Still try to unmount all already mounted MPs so that nothing blocking
    remains left

> 
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
>  src/PVE/CLI/pct.pm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
> index 8807633..35ad72f 100755
> --- a/src/PVE/CLI/pct.pm
> +++ b/src/PVE/CLI/pct.pm
> @@ -774,9 +774,9 @@ __PACKAGE__->register_method ({
>  
>  	my $storecfg = PVE::Storage::config();
>  	my $conf = PVE::LXC::Config->set_lock($vmid, 'fstrim');
> -	PVE::LXC::mount_all($vmid, $storecfg, $conf);
>  	eval {
>  	    my $path = "";
> +	    PVE::LXC::mount_all($vmid, $storecfg, $conf);
>  	    PVE::LXC::Config->foreach_mountpoint($conf, sub {
>  		my ($name, $mp) = @_;
>  		$path = $mp->{mp};
> @@ -784,6 +784,7 @@ __PACKAGE__->register_method ({
>  		PVE::Tools::run_command($cmd);
>  	    });
>  	};
> +	warn $@ if $@;
>  
>  	PVE::LXC::umount_all($vmid, $storecfg, $conf, 0);
>  	PVE::LXC::Config->remove_lock($vmid, 'fstrim');
> 




More information about the pve-devel mailing list