Repository navigation
feat: skip network mount points during indexing - #280
Merged
Johnson-zs merged 2 commits intoOct 10, 2026
Merged
Conversation
1. Root cause: index traversal and inotify monitoring had no network filesystem detection; network mounts under $HOME (nfs, cifs, curlftpfs, etc.) were traversed, causing excessive network I/O and index bloat 2. Fix: add NetworkMountDetector singleton using libmount to parse mountinfo and identify network mounts; integrate into shouldSkipDirectory() and shouldExcludePath() to skip them 3. Refresh: add refresh() method with QReadWriteLock so mount info is re-parsed before each traversal and FSMonitor init, detecting network mounts added after service startup 4. Impact: network mount points are no longer indexed or monitored; late-mounted network mounts are caught on re-index; local FUSE mounts with known subtypes remain unaffected; unknown FUSE mounts are conservatively skipped Log: Skip network mount points during file indexing and monitoring Influence: 1. Test indexing with network mounts (nfs, cifs, curlftpfs) under $HOME 2. Verify local FUSE mounts (ntfs, exfat) are still indexed normally 3. Confirm no regression on standard mount paths (/mnt, /media) 4. Test re-indexing after mounting a network path post-startup feat: 索引时跳过网络挂载点 1. 根因:索引遍历和 inotify 监控缺少网络文件系统检测,$HOME 下的 网络挂载(nfs、cifs、curlftpfs 等)会被遍历,导致大量网络 I/O 和索引膨胀 2. 方案:新增 NetworkMountDetector 单例,通过 libmount 解析 mountinfo 识别网络挂载点,集成到 shouldSkipDirectory() 和 shouldExcludePath() 中进行跳过 3. 刷新:新增 refresh() 方法并使用 QReadWriteLock 保护,在每次遍历 和 FSMonitor 初始化前重新解析挂载信息,检测服务启动后新增的 网络挂载点 4. 影响:网络挂载点不再被索引或监控;后挂载的网络路径在重建索引时 会被正确跳过;已知本地 FUSE 挂载不受影响;未知 FUSE 挂载保守跳过 Log: 索引和监控时跳过网络挂载点 Influence: 1. 测试 $HOME 下网络挂载(nfs、cifs、curlftpfs)是否被正确跳过 2. 验证本地 FUSE 挂载(ntfs、exfat)仍正常索引 3. 确认标准挂载路径(/mnt、/media)无回归 4. 测试服务启动后挂载网络路径再触发重建索引的场景
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideIntroduces a libmount-backed, refreshable network mount detector and integrates it into indexing traversal and filesystem monitoring so NFS, CIFS, and other network-backed mounts are skipped, while recognized local FUSE filesystems remain eligible for indexing. Sequence diagram for skipping network mounts during indexing and monitoringsequenceDiagram
participant Traversal as FileSystemProvider
participant Monitor as FSMonitorPrivate
participant Detector as NetworkMountDetector
participant Mounts as libmount
Traversal->>Detector: refresh()
Detector->>Mounts: mnt_table_parse_mtab()
Mounts-->>Detector: mount table
loop Directory traversal
Traversal->>Detector: isNetworkPath(path)
Detector-->>Traversal: true → skip directory
end
Monitor->>Detector: refresh()
Detector->>Mounts: mnt_table_parse_mtab()
Mounts-->>Detector: mount table
Monitor->>Detector: isNetworkPath(path)
Detector-->>Monitor: true → exclude watch
Flow diagram for classifying filesystem mountsflowchart TD
Start[Mount entry] --> Type{Filesystem type}
Type -->|nfs, cifs, sshfs, davfs, ceph, etc.| Network[Network mount]
Type -->|Known local FUSE subtype| Local[Local mount; index normally]
Type -->|Unknown FUSE or URL source| Network
Type -->|Other non-FUSE| Local
Network --> Skip[Skip traversal and filesystem watch]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. Root cause: common desktop FUSE mounts (gvfsd-fuse, fusectl, xdg-document-portal) were conservatively classified as network filesystems, so m_networkMountPoints was never empty in practice; this made isNetworkPath() call canonicalFilePath() (stat + readlink) on every path even when no real network mounts existed 2. Fix: add gvfsd-fuse, portal, appimage, flatpak to localFuseSubtypes; only treat fusectl as local (not all FUSE types without fuse. prefix); bare "fuse" fstype (used by curlftpfs FTP mounts) still goes through source URL check and conservative network classification; add raw-path prefix check in isNetworkPath() before canonicalFilePath() so most paths skip the syscall entirely 3. Impact: m_networkMountPoints is empty on typical desktops without real network mounts, enabling zero-syscall fast path; FTP mounts (fstype "fuse") are correctly detected as network; real network mounts still detected and skipped Influence: 1. Verify gvfsd-fuse mounts (/run/user/UID/gvfs) are not treated as network 2. Verify fusectl (/sys/fs/fuse/connections) is not treated as network 3. Test FTP FUSE mounts (fstype "fuse") are correctly detected as network 4. Test real network mounts (nfs, cifs) are still detected and skipped 5. Confirm symlink into network mount is still caught fix: 修正 FUSE 分类并优化 isNetworkPath 性能 1. 根因:常见桌面 FUSE 挂载(gvfsd-fuse、fusectl、xdg-document-portal) 被保守地归类为网络文件系统,导致 m_networkMountPoints 实际上从不 为空;这使得 isNetworkPath() 在没有真实网络挂载时也对每个路径 调用 canonicalFilePath()(stat + readlink),造成不必要的系统调用 开销 2. 方案:将 gvfsd-fuse、portal、appimage、flatpak 加入 localFuseSubtypes;仅将 fusectl 视为本地(不再将所有无 fuse. 前缀 的 FUSE 类型视为本地);bare "fuse" 类型(curlftpfs FTP 挂载使用) 仍走 source URL 检查和保守网络分类;在 isNetworkPath() 中先做原始 路径前缀匹配,命中则直接返回,未命中且非符号链接则跳过 canonicalFilePath() 调用 3. 影响:无真实网络挂载的典型桌面环境中 m_networkMountPoints 为空, 走零系统调用快速路径;FTP 挂载(fstype "fuse")被正确识别为网络; 真实网络挂载仍能被正确检测和跳过 Influence: 1. 验证 gvfsd-fuse 挂载(/run/user/UID/gvfs)不被视为网络挂载 2. 验证 fusectl(/sys/fs/fuse/connections)不被视为网络挂载 3. 测试 FTP FUSE 挂载(fstype "fuse")被正确识别为网络挂载 4. 测试真实网络挂载(nfs、cifs)仍能被正确检测和跳过 5. 确认指向网络挂载的符号链接仍能被正确识别
Johnson-zs
force-pushed
the
agent/bugfix/bbd6e5308246
branch
from
October 10, 2026 08:11
1bd4059 to
f19fbfb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: skip network mount points during indexing
filesystem detection; network mounts under $HOME (nfs, cifs,
curlftpfs, etc.) were traversed, causing excessive network I/O and
index bloat
mountinfo and identify network mounts; integrate into
shouldSkipDirectory() and shouldExcludePath() to skip them
re-parsed before each traversal and FSMonitor init, detecting
network mounts added after service startup
late-mounted network mounts are caught on re-index; local FUSE
mounts with known subtypes remain unaffected; unknown FUSE mounts
are conservatively skipped
Log: Skip network mount points during file indexing and monitoring
Influence:
feat: 索引时跳过网络挂载点
网络挂载(nfs、cifs、curlftpfs 等)会被遍历,导致大量网络 I/O
和索引膨胀
mountinfo 识别网络挂载点,集成到 shouldSkipDirectory() 和
shouldExcludePath() 中进行跳过
和 FSMonitor 初始化前重新解析挂载信息,检测服务启动后新增的
网络挂载点
会被正确跳过;已知本地 FUSE 挂载不受影响;未知 FUSE 挂载保守跳过
Log: 索引和监控时跳过网络挂载点
Influence:
Summary by Sourcery
Skip network-mounted paths during indexing and filesystem monitoring while continuing to support recognized local mounts.
New Features:
Bug Fixes:
Enhancements:
Build: