HomeFreeBSD

Fix ENOSPC when unlinking multiple files from full pool

Description

Fix ENOSPC when unlinking multiple files from full pool

When unlinking multiple files from a pool at 100% capacity, it was
possible for ENOSPC to be returned after the first unlink. e.g.

    rm -f /mnt/fs/test1.0.0 /mnt/fs/test1.1.0 /mnt/fs/test1.2.0
    rm: cannot remove '/mnt/fs/test1.1.0': No space left on device
    rm: cannot remove '/mnt/fs/test1.2.0': No space left on device

After waiting for the pending deferred frees from the first unlink to
be processed the remaining files can then be unlinked. This is caused
by the quota limit in dsl_dir_tempreserve_impl() being temporarily
decreased to the allocatable pool capacity less any deferred free
space.

This is resolved using the existing mechanism of returning ERESTART
when over quota as long as we know enough space will shortly be
available after processing the pending deferred frees.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Ryan Moeller <freqlabs@FreeBSD.org>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13172

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Mar 8 2022, 5:16 PM
GitHub <noreply@github.com>Committed on Mar 8 2022, 5:16 PM
Parents
rG39a4daf742a4: Expose additional file level attributes
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG6df43169b309: Fix ENOSPC when unlinking multiple files from full pool (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Mar 8 2022, 5:16 PM