notify-rs / notify

🔭 Cross-platform filesystem notification library for Rust.
https://docs.rs/notify
2.68k stars 215 forks source link

inotify doesn't surface UNMOUNT events #627

Open awused opened 2 months ago

awused commented 2 months ago

System details

What you did (as detailed as you can)

I first noticed this when I noticed some of my notify watches would stop producing events for changes from the local machine on some directories. Eventually I traced it to NFS automatically unmounting idle file systems, which is annoying, but if I had gotten notified of the issue I could have worked around it by resubscribing.

This bug is not specific to NFS, and the same problems occur locally as well when unmounting filesystems. I tested this with zfs and tmpfs locally.

What you expected

The events are sent to the event handler so I can decide how to handle them.

What happened

I see these logs, but no events are handled because they're not covered by any cases in handle_inotify. Ideally I'd have some way to tie that id back to a specific directory I was watching and reconnect or otherwise handle it.

1627.979 TRACE notify::inotify      > inotify event: Event { wd: WatchDescriptor { id: 13, fd: (Weak) }, mask: ISDIR | UNMOUNT, cookie: 0, name: None }
1627.979 TRACE notify::inotify      > inotify event: Event { wd: WatchDescriptor { id: 13, fd: (Weak) }, mask: IGNORED, cookie: 0, name: None }
NatKarmios commented 1 month ago

Getting the same issue here.