Skip to content

fix: Support filesystems that don't send Create events#21844

Open
Wilfred wants to merge 2 commits intorust-lang:masterfrom
Wilfred:watch_fuse_files
Open

fix: Support filesystems that don't send Create events#21844
Wilfred wants to merge 2 commits intorust-lang:masterfrom
Wilfred:watch_fuse_files

Conversation

@Wilfred
Copy link
Copy Markdown
Contributor

@Wilfred Wilfred commented Mar 19, 2026

On some filesystems, particularly FUSE on Linux, we don't get Create(...) events. We do get Access(Open(Any)) events, so handle those consistently with create/modify/remove events.

This fixes missed file notifications when using Sapling SCM with EdenFS, although I believe the problem can occur on other FUSE environments.

See the individual commit messages for more details.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 19, 2026
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you tested this on both FUSE and non-FUSE filesystems and found the performance satisfactory?

View changes since this review

@Wilfred
Copy link
Copy Markdown
Contributor Author

Wilfred commented Mar 25, 2026

I've tested on FUSE a bunch, but not much on non-FUSE. I can get you some more thorough benchmarks next week, I don't have much time for r-a this week I'm afraid.

Wilfred added 2 commits March 31, 2026 18:36
This is not a logical change, and just makes the next commit simpler.

It also shouldn't impact performance, because the vast majority of
events have a single path.
On some filesystems, particularly FUSE on Linux, we don't get
Create(...) events. We do get Access(Open(Any)) events, so handle
those consistently with create/modify/remove events.

This fixes missed file notifications when using Sapling SCM with
EdenFS, although I believe the problem can occur on other FUSE
environments.

Reproduction:

Commit a change with Sapling that adds a new file foo.rs and
references it with `mod foo;` in lib.rs. Configure rust-analyzer as
follows:

```
{
    "rust-analyzer.files.watcher": "server",
    "rust-analyzer.server.extraEnv": {
        "RA_LOG": "vfs_notify=debug"
    },
}
```

Go to the previous commit, restart rust-analyzer, then go to the next
commit. The logs only show:

```
2026-03-18T07:16:54.211788903-07:00 DEBUG vfs-notify event event=NotifyEvent(Ok(Event { kind: Access(Open(Any)), paths: ["/data/users/wilfred/scratch/src/foo.rs"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }))
2026-03-18T07:16:54.211906733-07:00 DEBUG vfs-notify event event=NotifyEvent(Ok(Event { kind: Access(Open(Any)), paths: ["/data/users/wilfred/scratch/src/foo.rs"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }))
2026-03-18T07:16:54.216467168-07:00 DEBUG vfs-notify event event=NotifyEvent(Ok(Event { kind: Access(Open(Any)), paths: ["/data/users/wilfred/scratch/src/lib.rs"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }))
2026-03-18T07:16:54.216811304-07:00 DEBUG vfs-notify event event=NotifyEvent(Ok(Event { kind: Access(Open(Any)), paths: ["/data/users/wilfred/scratch/src/lib.rs"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }))
```

Observe that `mod foo;` has a red squiggle and shows "unresolved
module, can't find module file: foo.rs, or foo/mod.rs". This
commit fixes that.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 31, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Wilfred
Copy link
Copy Markdown
Contributor Author

Wilfred commented Mar 31, 2026

Yep, testing this with non-FUSE (i.e. a normal filesystem) and server-side watching seems fine. I've tested a rust-analyzer build with rust-analyzer open as a repository in VS Code, and performance seems entirely normal in my testing.

I've also cherry-picked this PR for the users I support at work and not seen any issues there either, so I'm pretty confident these changes are good.

Happy to do any other tests you can think of, if I've missed anything :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants