#320 btrfs info: bind mounts cause bogus subvol information in mountinfo
Closed: Wontfix 5 months ago by chrismurphy. Opened 2 years ago by chrismurphy.

This is an info bug, not an atomic bug, and it's non-fatal. Open question if upstream should be pushed to fix it or if this is cosmetic.

Background: Btrfs subvolumes can be directly mounted with mount -o subvol=nameofsubvolume. Behind the scenes this is a bind mount. When using the mount command or looking at /proc/self/mountinfo both subvolid and subvol info is shown.

Example:

/dev/sda1 on /srv/scratch type btrfs (rw,noatime,seclabel,compress=zlib,space_cache,subvolid=910,subvol=/scratch,x-systemd.automount)

subvolid=910 is subvol=scratch, those are synonymous and immutable, at least on disk.

Problem: Ostree installations make prolific use of bind mounts for assembly, and I've discovered that mount thinks these bind mounts are subvolumes.

Example:

/dev/sda7 on /sysroot type btrfs (rw,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/root)
/dev/sda7 on / type btrfs (rw,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/root/ostree/deploy/fedora-workstation/deploy/cee1dd51ce63436e3d2e9df8b1759981055c7ac29c78d450217bf684631f0549.0)
/dev/sda7 on /usr type btrfs (ro,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/root/ostree/deploy/fedora-workstation/deploy/cee1dd51ce63436e3d2e9df8b1759981055c7ac29c78d450217bf684631f0549.0/usr)
/dev/sda7 on /var type btrfs (rw,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/root/ostree/deploy/fedora-workstation/var)

The first line is correct. subvolid=5 is subvol=root. All the other lines have correct subvolid's but the subvol listed is a bind mount, there is no such subvolume as those listed.

Clearly the kernel code is correctly looking up subvolume ID, but it's assuming bind mounts are subvolumes rather than directly looking them up. Upstream report is here:

https://www.spinics.net/lists/linux-btrfs/msg67410.html


Thanks for the info. Do you mind keeping up with the upstream discussion and report back here?

Metadata Update from @dustymabe:
- Issue tagged with: host

2 years ago

I'm going to close this for now. Upstream says it's a difficult problem to solve correctly. The subvolid is curiously correct, which I've asked about and if there's an answer it'll appear after this comment.

https://lore.kernel.org/linux-btrfs/20190612095851.GG3563@twin.jikos.cz/

Metadata Update from @chrismurphy:
- Issue close_status updated to: Wontfix
- Issue status updated to: Closed (was: Open)

5 months ago

Login to comment on this ticket.

Metadata