Page MenuHomeFreeBSD

lockf: Do not block in vfs_busy()
ClosedPublic

Authored by markj on Thu, Sep 24, 1:51 PM.

Details

Summary

I believe a race is possible otherwise: vfs_busy() may return after an
unmounted filesystem has been removed from the global mount list.
That is, vfs_busy() will block until vfs_mount_destroy() sets
MNTK_REFEXPIRE, and at that point the mountpoint has been removed from
the mountlist, so TAILQ_FOREACH can return an invalid value.

Simply do not block if the mountpoint is being unmounted.

Fixes: eca39864f702 ("Add sysctl KERN_LOCKF")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable