Skip to contentSkip to conversation

subvolume device ID no longer present in /proc/self/mountinfo

6.9 behaviour change Thiago Macieira 1 participant 1 message May 28, 2024 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Re: https://bugreports.qt.io/browse/QTBUG-125721

Summary: the submodule's block device ID is no longer present in /proc/self/mountinfo. Instead, the root device ID is now shown and that does not match what you get from stat().

Qt's QStorageInfo class used to use this matching to detect when a filesystem had been mounted over and were no longer accessible. With the change in kernel behaviour, QStorageInfo always concludes all btrfs subvolumes are mounted over.

When you mount a subvolume, the subvolume gets its own device ID:

# mount -o loop fs foo    
# btrfs sub create foo/@
Create subvolume 'foo/@'
# btrfs sub create foo/@home
Create subvolume 'foo/@home'
# mkdir foo/@/home
# umount foo 
# mount -o loop,subvol=/@ fs foo
# mount -o loop,subvol=/@home fs foo/home
# stat -c %d foo
149
# stat -c %d foo/home/
94

In 6.8.8:

# grep loop0 /proc/self/mountinfo 
340 35 0:149 /@ /tmp/foo rw,relatime shared:310 - btrfs /dev/loop0 
rw,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@
450 340 0:94 /@home /tmp/foo/home rw,relatime shared:1049 - btrfs /dev/loop0 
rw,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home

In 6.9.1:

$ stat -c %d foo foo/home; grep loop0 /proc/self/mountinfo
153
154
486 58 0:151 /@ /tmp/foo rw,relatime shared:445 - btrfs /dev/loop0 
rw,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@
496 486 0:151 /@home /tmp/foo/home rw,relatime shared:455 - btrfs /dev/loop0 
rw,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home

Note that how device 151 is not the same as reported by stat().

I need to know if this behaviour is expected and will remain, or if it will be fixed, or alternatively if it is a configuration problem somewhere. If it is expected, I will need to find a workaround to solving my problem.

Thank you in advance, best regards,

Signature · 2 lines
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCAI Fleet Engineering and Quality