Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Thiago Macieira <thiago.macieira@intel.com>
To: linux-btrfs@vger.kernel.org
Subject: [6.9 behaviour change] subvolume device ID no longer present in /proc/self/mountinfo
Date: Tue, 28 May 2024 19:37:45 -0300	[thread overview]
Message-ID: <2548140.Uh0CODmnKu@tjmaciei-mobl5> (raw)

[-- Attachment #1: Type: text/plain, Size: 1934 bytes --]

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,
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCAI Fleet Engineering and Quality

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5152 bytes --]

                 reply	other threads:[~2024-05-28 22:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2548140.Uh0CODmnKu@tjmaciei-mobl5 \
    --to=thiago.macieira@intel.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox