https://bugs.kde.org/show_bug.cgi?id=474680
            Bug ID: 474680
           Summary: KMountPoint::List::findByPath does not handle btrfs
                    mounts
    Classification: Frameworks and Libraries
           Product: frameworks-kio
           Version: git master
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kio-bugs-n...@kde.org
          Reporter: m...@mwsys.mine.bz
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

currently this method matches the mountpoint by comparing the st_dev returned
by stat and comparing this to /proc/self/mountinfo

in the case of btrfs st_dev is used differently. Mainly st_dev is used to
differentiate btrfs subvolumes. there is no matching entry in mountinfo.

the "btrfs" way would be stat upwards in the tree until a different st_dev is
found (or you hit the root directory). This is the mountpoint (it will probably
not be in mountinfo, but technically this is the filesystem (=subvolume) root)

Then there is the question about the mounted dev. Since btrfs in that regard is
more like raid and lvm there is probably more than one device. The device list
is in /sys/fs/btrfs/<fs uuid>/devices/
The device uuid is apparently read with a BTRFS_IOC_FS_INFO ioctl

If the filesystem is btrfs in the first place seems to be using a (deprecated?)
statfs system call. There also exists statvfs, but that misses the f_type.

I would suggest the following:
in currentMountPoints check if the m_mountType == "btrfs" stat the root of that
and use that st_dev, that way the simplest case will be matched in findByPath.
It would be nice using the device list in /sys/fs.. instead of the one in
mountinfo. If in findByPath there is no match we could at first just search the
mount by "string comparing" (that would also be a generic way should another
filesystem do the same), but imo the correct way would be search the fs root,
add that to the list and return that element.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to