vfs: Expose vfs_mount_mutex to make vfs_iterate_mounts usable reliably#17658
Closed
chrysn wants to merge 1 commit intoRIOT-OS:masterfrom
Closed
vfs: Expose vfs_mount_mutex to make vfs_iterate_mounts usable reliably#17658chrysn wants to merge 1 commit intoRIOT-OS:masterfrom
chrysn wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
The conditions on using vfs_iterate_mounts are hard to guarantee in any system where mounts happen outside auto_init, and impossible to guarantee for a generic component.
Member
Author
|
I now think #17660 is the better approach; will close this as soon as that receives any positive review. |
Member
Author
These turned out to be simple: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
The conditions on using vfs_iterate_mounts are hard to guarantee in any
system where mounts happen outside auto_init, and impossible to
guarantee for a generic component.
This makes the mount point mutex public, along with documentation on what goes bad if held for too long.
Maturity level
This is more a documentation of something attempted than a full PR -- the big downsides are in the documentation.
[edit: Also, there is an ugly
#definein there, but that's just to keep the delta low; if this PR were followed up on, a fixup commit would contain the text replacement of_mount_mutextovfs_mount_mutexand remove that define]More illustratively, all use of this I can imagine will fall into a single pattern:
The only applications that does not fall into this pattern is plainly listing paths of mount points (without doing anything more with them, that's my application in the CoAP file system server), or those that have sufficient room to first list the mount points and then stat / listdir them from the stored path buffers.
Next steps
As that seems inconvenient, I'd try something else: Maybe a similar function to vfs_iterate_mounts could produce open vfs_DIR. These could then be either be readdir'd, or fstatvfs'd (TBD: does that even work, or do we need a dstatvfs for that?), or fd2path'd (TBD).
All not trivial :-/
Pinging @jnohlgard for any insights from back when the VFS was crafted, and @benpicco who briefly engaged in yesterday's IRC discussion on the mutex.