mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-04 00:47:00 +01:00
fix(core,fuse): never stat a foreign mount from the local-file indexer
The "This computer" indexer walks $HOME, and `default_excludes` only kept it out of the Drive mountpoint and our own state/cache dirs. A home directory that also holds third-party FUSE mounts (sshfs, rclone) got walked into. `scan` does ask for `same_file_system(true)`, which looks sufficient and is not: `ignore` implements it as `is_same_file_system` -> `device_num(path)` -> `path.metadata()`, run after the directory is queued. Learning that a mount is foreign requires stat'ing it first, and against a mount whose server is gone that stat never returns. The consequence is worse than a stalled scan. The blocked thread sits in uninterruptible FUSE wait, so it ignores SIGKILL: the daemon can never exit, systemd's stop times out, and the unreapable process keeps the cache.db lock the next start needs, turning one dead mount into a permanent restart loop. No userspace recovery exists once a thread is in that state, so the fix has to be to never enter it. Exclude every mountpoint strictly below the scan root, read by path from /proc/self/mounts (octal-unescaped, so a path with a space still matches). `filter_entry` runs before the device stat, so the walker never touches them. Re-read per scan rather than cached at startup: a mount that appeared since the daemon started is the likeliest to be half-alive. This does not change what is indexed — a nested mount is a different device, so it was already going to be skipped. Only the stat in front of that decision goes away. Refs: docs/BUGS.md B90
This commit is contained in:
1 parent
f4d6580cd3
commit
b095b9f6b0
3 files changed
+180
-1
No files matched your search
@@ -487,7 +487,12 @@ fn scan_local_once(
|
||||
}
|
||||
};
|
||||
|
||||
let excludes = localindex::default_excludes(mountpoint, &dirs.state_dir(), &dirs.cache_dir());
|
||||
let mut excludes =
|
||||
localindex::default_excludes(mountpoint, &dirs.state_dir(), &dirs.cache_dir());
|
||||
// Resolved per scan rather than once at startup: mounts come and go, and a
|
||||
// mount that appeared since the daemon started is exactly the one most
|
||||
// likely to be a half-alive network filesystem (see `nested_mount_points`).
|
||||
excludes.extend(localindex::nested_mount_points(&home));
|
||||
indexing.store(true, Ordering::Relaxed);
|
||||
let started = Instant::now();
|
||||
|
||||
|
||||
Reference in new issue
Block a user