Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-doc
Path: blob/main/website/content/en/status/report-2021-07-2021-09/msdosfs_rename.adoc
18097 views
=== Fixes for msdosfs_rename VOP

Contact: Konstantin Belousov <[email protected]> +
Contact: Peter Holm <[email protected]>

Our msdosfs(5) implementation is old code and has a relatively
large legacy cost.  In particular, even though it got fine-grained
locking and miscellaneous bugfixes over time, sometimes a serious issue
is found in it.

Recently trasz@ found that msdosfs rename can be easily deadlocked.
Further examination of rename code revealed a lot of issues with locking,
potential use after free, and filesystem structure corruption.

As part of the update, locking in the msdosfs rename code was reworked.
We need to lock up to four vnodes, and check one path to ensure that
rename does not create circular parent relations between directories.
For that, the locking procedure was copied from UFS rename, where all
vnodes except the first are locked in try-mode.  Lockless relockup was
added to msdosfs and the directory path checker was changed to non-blocking
mode.

During this work, all known issues were fixed and msdosfs passes
the enhanced stress2 suite of tests.

Sponsor: The FreeBSD Foundation (kib's contributions)