[pbs-devel] [PATCH proxmox-backup v6 08/23] api2: admin: add (un)mount endpoint for removable datastores

Dietmar Maurer dietmar at proxmox.com
Fri Apr 19 09:27:00 CEST 2024


> +fn do_unmount_device(
> +    datastore: DataStoreConfig,
> +    worker: Option<&dyn WorkerTaskContext>,
> +) -> Result<(), Error> {
> +    let mut active_operations = task_tracking::get_active_operations(&datastore.name)?;
> +    let mut counter = 0;
> +    while active_operations.read + active_operations.write > 0 {
> +        if counter == 0 {
> +            if let Some(worker) = worker {
> +                if worker.abort_requested() {
> +                    bail!("aborted, due to user request");
> +                }
> +                task_log!(
> +                    worker,
> +                    "cannot unmount yet, still {} read and {} write operations active",
> +                    active_operations.read,
> +                    active_operations.write
> +                );
> +            }
> +            counter = 5000;

only 5 seconds?

> +        }
> +        counter -= 1;
> +        std::thread::sleep(std::time::Duration::from_millis(1));

do we really need to check every millisecond (I would suggest 250ms)?




More information about the pbs-devel mailing list