[pve-devel] [PATCH qemu-server v2 13/16] introduce QSD module for qemu-storage-daemon functionality

Daniel Kral d.kral at proxmox.com
Thu Nov 6 15:32:39 CET 2025


On Mon Oct 20, 2025 at 4:13 PM CEST, Fiona Ebner wrote:
> diff --git a/src/PVE/QemuServer/Helpers.pm b/src/PVE/QemuServer/Helpers.pm
> index ce9c352a..35c00754 100644
> --- a/src/PVE/QemuServer/Helpers.pm
> +++ b/src/PVE/QemuServer/Helpers.pm
> @@ -89,6 +89,39 @@ sub qsd_pidfile_name {
>      return "${var_run_tmpdir}/qsd-${id}.pid";
>  }
>  
> +sub qsd_fuse_export_cleanup_files {
> +    my ($id) = @_;
> +
> +    # Usually, /var/run is a symlink to /run. It needs to be the exact path for checking if mounted
> +    # below. Note that Cwd::realpath() needs to be done on the directory already. Doing it on the
> +    # file does not work if the storage daemon is not running and the FUSE is still mounted.
> +    my ($real_dir) = Cwd::realpath($var_run_tmpdir) =~ m/^(.*)$/; # untaint
> +    if (!$real_dir) {
> +        warn "error resolving $var_run_tmpdir - not checking for left-over QSD files\n";
> +        return;
> +    }
> +
> +    my $mounts = PVE::ProcFSTools::parse_proc_mounts();
> +
> +    PVE::Tools::dir_glob_foreach(
> +        $real_dir,
> +        "qsd-${id}-.*\.fuse",
> +        sub {
> +            my ($file) = @_;
> +            my $path = "${real_dir}/${file}";
> +            if (grep { $_->[1] eq $path } $mounts->@*) {
> +                PVE::Tools::run_command(['umount', $path]);
> +            }

Could only check it if shooting down the qsd process with
`kill -KILL <pid>`, but starting the VM again worked flawlessly, thanks!

> +            unlink $path;
> +        },
> +    );
> +}




More information about the pve-devel mailing list