Page MenuHomeFreeBSD

statfs(2): allow to interrupt busying
ClosedPublic

Authored by kib on Jul 27 2026, 1:45 PM.
Tags
None
Referenced Files
F171115546: D58477.id183019.diff
Tue, Sep 8, 7:23 PM
Unknown Object (File)
Sun, Sep 6, 9:50 AM
Unknown Object (File)
Sat, Sep 5, 9:02 AM
Unknown Object (File)
Fri, Sep 4, 8:06 AM
Unknown Object (File)
Fri, Sep 4, 7:40 AM
Unknown Object (File)
Wed, Sep 2, 4:20 AM
Unknown Object (File)
Wed, Sep 2, 4:16 AM
Unknown Object (File)
Tue, Sep 1, 9:15 PM
Subscribers

Details

Summary
There are probably more places which could benefit from allowing to
interrupt vfs_busy() calls at syscalls top level.

Requested by:   Peter Eriksson <pen@lysator.liu.se>


vfs_busy(): add MBF_PCATCH flag to allow interrupting the sleep

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Jul 27 2026, 1:45 PM
kib removed a subscriber: olce.
sys/kern/vfs_subr.c
934

If we were to leak the flag here, what would be the impact? It would seem that the pending unmount (whether successful or not) should always ultimately clear the flag, at which point it would also issue a wakeup(). That wakeup might harmlessly do nothing if our canceled wait happened to be the only one, but that seems less potentially disruptive than possibly waking up N other vfs_busy() callers.

936

spelling nit: then -> than

941

Should this case reacquire mountlist_mtx if MBF_MNTLSTLOCK was passed?
It seems we expect failed calls of vfs_busy() in general to return with the lock still held, though perhaps there's no caller that would pass both MBF_PCATCH and MBF_MNTLSTLOCK.

If we do want to reacquire that lock, then it might be cleaner to move this error-handling case below the call to MNT_ILOCK() at line 945.

kib marked 3 inline comments as done.Jul 28 2026, 7:19 AM
kib added inline comments.
sys/kern/vfs_subr.c
934

I believe that we get a spurious wakeup one way or another. So I decided to clean it there instead of leaking.

kib marked an inline comment as done.

Consistently return with the mountlist mutex locked on error, if it was locked on entry.

This revision is now accepted and ready to land.Jul 28 2026, 2:29 PM