[BUG] Linux DiskProvider incorrectly selects underlying filesystem for over-mounted paths
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read src/NzbDrone.Mono/Disk/DiskProvider.cs and src/NzbDrone.Mono/Disk/ProcMountProvider.cs to trace how /proc/mounts and DriveInfo entries are combined and deduplicated. Add a regression test for two mounts at the same path, with ext4 followed by cifs; done when the discovered mount is cifs with DriveType.Network and DriveInfo remains a fallback.
Written by the indexing model from the issue text.
Description
Describe the bug
On Linux, Chaptarr can select the wrong filesystem when multiple mounts share the same mount-point path.
NzbDrone.Mono.Disk.DiskProvider.GetAllMounts() combines mounts from /proc/mounts with DriveInfo mounts, then calls:
mounts.DistinctBy(v => v.RootDirectory)
DistinctBy keeps the first entry for each mount point. When a filesystem is mounted over an existing mount point, the underlying mount can appear first in /proc/mounts, causing Chaptarr to discard the actual over-mounted filesystem.
For example, the underlying filesystem may be reported as ext4, while the filesystem mounted over it is a network share using cifs. Chaptarr then identifies the path as a local filesystem instead of a network mount.
To Reproduce
-
Run Chaptarr in Docker on Linux.
-
Create or use a directory on a local filesystem as a mount point.
-
Mount a network share (CIFS/SMB) over that directory.
-
Inspect
/proc/mounts. Both entries may appear, with the underlying filesystem first:/dev/mapper/local-root /mnt/example ext4 rw,... 0 0 //server/share /mnt/example cifs rw,... 0 0 -
Let Chaptarr discover the mounts.
-
Observe that the first entry (
ext4) is retained and the CIFS entry is discarded because both have the sameRootDirectory.
Expected behavior
When multiple mounts share the same mount-point path, Chaptarr should identify the filesystem that is actually mounted on top, rather than retaining the underlying filesystem.
In this example, the mount should be identified as cifs with DriveType.Network.
The DriveInfo fallback should also remain secondary to mount information obtained from /proc/mounts.
Screenshots
Not applicable. The issue can be demonstrated using the mount table output above.
System Information
- OS: Linux (Proxmox LXC)
- Chaptarr Version:
0.9.1000.0 - Installation Method: Docker
- Browser: Not relevant to this issue
Docker Information
- Docker version: Not yet included
- Docker Compose version: Not yet included
- Container: Chaptarr
Additional context
This appears to be an issue in the Linux mount-discovery implementation rather than something specific to one NAS or installation.
Relevant source files:
src/NzbDrone.Mono/Disk/DiskProvider.cssrc/NzbDrone.Mono/Disk/ProcMountProvider.cs
A possible fix would be to retain the topmost/latest /proc/mounts entry for each mount point, while ensuring that DriveInfo entries do not override entries obtained from /proc/mounts.
A regression test should cover two mounts with the same mount point, where an ext4 entry is followed by a cifs entry, and verify that the resulting mount is identified as cifs.
This issue is separate from an AudioBookShelf deletion-synchronization problem; a connection between the two has not been established.
Logs
Example mount information:
$ findmnt -T /mnt/example
TARGET SOURCE FSTYPE
/mnt/example /dev/mapper/local-root ext4
/mnt/example //server/share cifs
The corresponding /proc/mounts entries are included above.
No Chaptarr error is necessarily logged, because the problem is that the mount is classified incorrectly rather than an exception being thrown.
- Dominant language
- C#
- Stars
- 664
- Forks
- 48
- Avg merge
- 5h 47m
- Merged PRs (30d)
- 4
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Chaptarr/chaptarr
-
[BUG] MyAnonaMouse search turns a curly apostrophe into a space, so titles with ’ are never foundOpen
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
All issues in Chaptarr/chaptarr
Similar issues
-
bug module
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Tichau/FileConverter#829 ·
Maintainers usually reply within 9 days
-
needs triage
Difficulty 1/5 Under an hour Newbie friendliness 71/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
majorsilence/Majorsilence.Forms#718 ·
Maintainers usually reply within 1 day