Skip to content

Conversation

@cjc25
Copy link
Contributor

@cjc25 cjc25 commented May 14, 2025

Package fusekernel already had definitions of the NotifyInvalInodeOut and NotifyInvalEntryOut structures. We add a Notifier, which allows filesystem implementations to use those to invalidate kernel cache entries.

By using these invalidation mechanisms, user code can still mostly use the page cache, but with some feedback from the filesystem daemon when contents have changed dynamically.

Package fusekernel already had definitions of the NotifyInvalInodeOut
and NotifyInvalEntryOut structures. We add a Notifier, which allows
filesystem implementations to use those to invalidate kernel cache
entries.

By using these invalidation mechanisms, user code can still mostly use
the page cache, but with some feedback from the filesystem daemon when
contents have changed dynamically.
@cjc25
Copy link
Contributor Author

cjc25 commented May 14, 2025

This is somewhat similar to #140 . Some comparisons:

  • Instead of injecting the Connection into the FileSystem interface, this PR uses a wrapper Server, since ServeOps already had access to the Connection
  • Instead of allowing any calls to Connection functions, this PR wraps the writes by requiring the use of an interface in package fuse to issue the writes/notifications
  • Kernel notification support #140 writes to the fd directly and risks nil dereference on Connection. This PR wraps the writes in channels to serialize them (probably unnecessary, but convenient to think about), and risks deadlock if an Invalidate function must return before ServeOps can be called (which would be Weird, IMO).
  • Both PRs allow the fuse Server to deadlock if the user performs an invalidation while a "related operation" is outstanding.
  • This PR has a test implementation :). It mirrors the similar test implementations in libfuse.

@stapelberg
Copy link
Collaborator

Nice! Thanks for the clean PR. It passes CI, passes tests and seems to work in a quick manual test.

I am inclined to merge it.

@vitalif This should work for your use-case over in PR #140, too, right?

@stapelberg stapelberg merged commit 97f1c68 into jacobsa:master Jun 30, 2025
3 checks passed
@cjc25 cjc25 deleted the notifier branch November 18, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants