[pbs-devel] [PATCH proxmox-backup v2] api: config: use guard for unmounting on failed datastore creation

Christian Ebner c.ebner at proxmox.com
Thu Mar 20 16:34:45 CET 2025


> On 20.03.2025 13:11 CET Hannes Laimer <h.laimer at proxmox.com> wrote:
> 
>  
> Currently if any `?`/`bail!` happens between mounting and completing
> the creation process unmounting will be skipped. Adding this guard
> solves that problem and makes it easier to add things in the future
> without having to worry about a disk not being unmounted in case of a
> failed creation.
> 
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> Reported-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> ---

Thanks, this patch will come in handy here [0].

Tested creating new datastore on ext3 -> fails
Tested reusing pre-existing datastore with corrupt folder structure -> fails
Tested moving and replacing the datastore config while datastore creattion, so that writing the config will fail by `mv datastore.cfg datastore.cfg.old && mkdir datastore.cfg` -> fails

For all 3 cases the removable datastore backing device is correctly unmounted after failure.

Therefore please consider this:

Tested-by: Christian Ebner <c.ebner at proxmox.com>

[0] https://lore.proxmox.com/pbs-devel/20250320131711.312894-6-c.ebner@proxmox.com/




More information about the pbs-devel mailing list