HomeFreeBSD

tmpfs: Account for whiteouts during rename/rmdir

Description

tmpfs: Account for whiteouts during rename/rmdir

The existing tmpfs implementation will return ENOTEMPTY for VOP_RMDIR,
or for the destination directory of VOP_RENAME, for any case in which
the directory is non-empty, even if the directory only contains
whiteouts.

Fix this by tracking total whiteout dirent allocation separately for
each directory, and avoid returning ENOTEMPTY if IGNOREWHITEOUT has
been specified by the caller and the total allocation of dirents is not
greater than the total whiteout allocation. This addresses "directory
not empty" failures seen on some recently-added unionfs stress2 tests
which use tmpfs as a base-layer filesystem.

A separate issue for independent consideration is that unionfs' default
behavior when deleting files or directories is to create whiteouts even
when it does not truly need to do so.

Differential Revision: https://reviews.freebsd.org/D45987
Reviewed by: kib (prior version), olce
Tested by: pho

Details

Provenance
jahAuthored on Aug 6 2024, 4:30 AM
Reviewer
kib
Differential Revision
D45987: tmpfs: Account for whiteouts during rename/rmdir
Parents
rG2ed053cde558: vfs: Add IGNOREWHITEOUT flag and adopt it in UFS/unionfs
Branches
Unknown
Tags
Unknown