Bug 270988 - vfs: Fix 'emptydir' mount option and vfs_emptydir()
Summary: vfs: Fix 'emptydir' mount option and vfs_emptydir()
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Olivier Certner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-21 21:19 UTC by Olivier Certner
Modified: 2024-01-23 17:43 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Certner freebsd_committer freebsd_triage 2023-04-21 21:19:22 UTC
vfs_emptydir() considers directories containing directories of the
form 'X.' with X being any character as empty (and also another undesirable behavior with whiteouts).

More in-depth description of the problem and a patch at review D39755.
Comment 1 commit-hook freebsd_committer freebsd_triage 2023-04-28 01:30:26 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6450e7bbad0c68176f28b51773a3af5d6022c7dd

commit 6450e7bbad0c68176f28b51773a3af5d6022c7dd
Author:     Olivier Certner <olce.freebsd@certner.fr>
AuthorDate: 2023-04-22 16:07:07 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-04-28 01:27:54 +0000

    vfs: Fix "emptydir" mount option

    Fix vfs_emptydir(). It would consider directories containing directories
    with name of the form 'X.' (X being any authorized byte) as empty. Also,
    it would cause VOP_READDIR() to return an error on directories
    containing enough whiteouts. While here, use a more decently sized
    buffer as done elsewhere.

    Remove ad-hoc iteration on the directory's content and instead use the
    newly exported vn_dir_next_dirent() function (this is what fixes the
    second problem mentioned above).

    PR:     270988
    Reviewed by:    kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D39775

 sys/kern/vfs_subr.c | 115 ++++++++++++++++++++++++++++++----------------------
 1 file changed, 67 insertions(+), 48 deletions(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-05-05 06:39:42 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6a53a4ff653722488379cedf4326deabbfccd749

commit 6a53a4ff653722488379cedf4326deabbfccd749
Author:     Olivier Certner <olce.freebsd@certner.fr>
AuthorDate: 2023-04-22 16:07:07 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-05-05 06:20:58 +0000

    vfs: Fix "emptydir" mount option

    PR:     270988

    (cherry picked from commit 6450e7bbad0c68176f28b51773a3af5d6022c7dd)

 sys/kern/vfs_subr.c | 115 ++++++++++++++++++++++++++++++----------------------
 1 file changed, 67 insertions(+), 48 deletions(-)