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
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.

Wilfred added 2 commits March 19, 2026 13:24
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 rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 19, 2026
Copy link
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
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.

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