Summary
Implement proper inode-to-multiple-path tracking in the host scanner.
The current usage_count logic can have a temporary tracking gap after a partial scan. A partial scan does not rebuild all monitored hardlink references. If one monitored hardlink is then unlinked, unref_inode can remove the inode from the userspace map and the kernel inode map while another monitored hardlink still exists.
Required changes
Update the host scanner model so that each monitored inode can track all monitored paths that reference it. Use this path set to maintain correct reference counts during full scans, partial scans, link events, unlink events, and rename events.
Do not rely on a later periodic full scan to restore tracking. This is necessary when periodic scans are delayed or disabled.
Affected areas
fact/src/host_scanner.rs
- Inode map and usage-count lifecycle
- Partial scans for mount and symlink events
- Hardlink link, unlink, and rename handling
Acceptance criteria
- One inode can retain multiple monitored paths.
- Partial scans reconcile monitored paths for affected inodes without dropping paths outside the scan scope.
- Unlinking one monitored hardlink preserves userspace and kernel inode tracking while another monitored hardlink remains.
- The implementation handles
scan_interval = 0.
- Tests cover a partial scan followed by unlinking one of multiple monitored hardlinks.
References
Summary
Implement proper inode-to-multiple-path tracking in the host scanner.
The current
usage_countlogic can have a temporary tracking gap after a partial scan. A partial scan does not rebuild all monitored hardlink references. If one monitored hardlink is then unlinked,unref_inodecan remove the inode from the userspace map and the kernel inode map while another monitored hardlink still exists.Required changes
Update the host scanner model so that each monitored inode can track all monitored paths that reference it. Use this path set to maintain correct reference counts during full scans, partial scans, link events, unlink events, and rename events.
Do not rely on a later periodic full scan to restore tracking. This is necessary when periodic scans are delayed or disabled.
Affected areas
fact/src/host_scanner.rsAcceptance criteria
scan_interval = 0.References