Hi Tollef Fog Heen,

> What does mountinfo look like if you do a bind mount of a subvolume?

Subvolume /@home mounted on /home:

# mount --bind /home/lost+found /tmp/h_a
# mount --bind /home/niels/.local /tmp/h_b
# mount --bind /tmp/h_b/share /tmp/h_c

# egrep @home /proc/self/mountinfo
26 20 0:16 /@home /home rw,relatime - btrfs /dev/sdb3 rw,space_cache
34 20 0:16 /@home/lost+found /tmp/h_a rw,relatime - btrfs /dev/sdb3 
rw,space_cache
35 20 0:16 /@home/niels/.local /tmp/h_b rw,relatime - btrfs /dev/sdb3 
rw,space_cache
36 20 0:16 /@home/niels/.local/share /tmp/h_c rw,relatime - btrfs /dev/sdb3 
rw,space_cache

For reference, here's also subvolume /@jessie mounted on /:

# mount --bind /bin /tmp/j_a
# mount --bind /usr/local /tmp/j_b
# mount --bind /tmp/j_b/share /tmp/j_c

# egrep @jessie /proc/self/mountinfo
20 1 0:16 /@jessie / rw,relatime - btrfs /dev/sdb3 rw,space_cache
31 20 0:16 /@jessie/bin /tmp/j_a rw,relatime - btrfs /dev/sdb3 rw,space_cache
32 20 0:16 /@jessie/usr/local /tmp/j_b rw,relatime - btrfs /dev/sdb3 
rw,space_cache
33 20 0:16 /@jessie/usr/local/share /tmp/j_c rw,relatime - btrfs /dev/sdb3 
rw,space_cache

> And ditto if you do multiple mounts of the same subvolume (to different
> locations)?

Subvolume /@home mounted at multiple points:

# mount -t btrfs -o subvol=/@home /dev/sdb3 /tmp/s_a
# mount -t btrfs -o subvol=/@home /dev/sdb3 /tmp/s_b

# egrep @home /proc/self/mountinfo
26 20 0:16 /@home /home rw,relatime - btrfs /dev/sdb3 rw,space_cache
31 20 0:16 /@home /tmp/s_a rw,relatime - btrfs /dev/sdb3 rw,space_cache
32 20 0:16 /@home /tmp/s_b rw,relatime - btrfs /dev/sdb3 rw,space_cache

Top (sub)volume / mounted at multiple points:

# mount -t btrfs -o subvol=/ /dev/sdb3 /mnt/tmp
# mount -t btrfs -o subvol=/ /dev/sdb3 /tmp/t_a
# mount -t btrfs -o subvol=/ /dev/sdb3 /tmp/t_b

# egrep '0:16 / ' /proc/self/mountinfo
33 20 0:16 / /mnt/tmp rw,relatime - btrfs /dev/sdb3 rw,space_cache
34 20 0:16 / /tmp/t_a rw,relatime - btrfs /dev/sdb3 rw,space_cache
35 20 0:16 / /tmp/t_b rw,relatime - btrfs /dev/sdb3 rw,space_cache



Essentially, from a VFS user's point of view, btrfs subvolumes look
and behave like bind mounts (apart from requiring different mount
options) - they create an additional view into the same filesystem,
possibly rooted further down the tree.

The root (root of the mount within the filesystem) of mountinfo
cascades nicely, even if there are bind mounts on subvolumes.

The / root of a particular filesystem (partition) is not guaranteed
to be mounted even if deeper levels of the hierarchy are. This is
more common for btrfs subvolumes, but in fact also possible for
bind mounts.


Thanks for your work,
Niels Boehm


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to