All of lore.kernel.org
 help / color / mirror / Atom feed
* bind mounts on btrfs cause mountinfo confusion
@ 2017-07-17 21:47 Chris Murphy
  2017-07-18  7:24 ` Duncan
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Murphy @ 2017-07-17 21:47 UTC (permalink / raw)
  To: Btrfs BTRFS

libOSTree makes use of bind mounts during startup to support multiple
fs trees on any file system for the purpose of atomic updates and
rollback.

Example during boot:

Jul 17 15:18:42 frawhide.localdomain systemd[779]: var.mount:
Executing: /usr/bin/mount
/sysroot/ostree/deploy/fedora-workstation/var /var -o bind

cat /proc/self/mounts

/dev/sda6 /var btrfs
rw,relatime,ssd,space_cache,subvolid=5,subvol=/ostree/deploy/fedora-workstation/var
0 0

findmnt shows basically the same

─/var
/dev/sda6[/ostree/deploy/fedora-workstation/var]
│                                                btrfs
rw,relatime,ssd,space_cache,subvolid=5,subvol=/ostree/deploy/fedora-workstation


There is no such subvolume /ostree/deploy/fedora-workstation/var,
basically it seems like whatever is producing this mount information
(kernel code?) is just assuming a bind mount on Btrfs is a subvolume
without checking if that subvolume really exists, and if it's just an
ordinary directory being bind mounted, which is what's going on here.

I'd say it's confusing. But I don't know if it's a problem otherwise.




-- 
Chris Murphy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bind mounts on btrfs cause mountinfo confusion
  2017-07-17 21:47 bind mounts on btrfs cause mountinfo confusion Chris Murphy
@ 2017-07-18  7:24 ` Duncan
  2017-07-18 18:57   ` Andrei Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Duncan @ 2017-07-18  7:24 UTC (permalink / raw)
  To: linux-btrfs

Chris Murphy posted on Mon, 17 Jul 2017 15:47:20 -0600 as excerpted:

> Example during boot:
> 
> Executing: /usr/bin/mount
> /sysroot/ostree/deploy/fedora-workstation/var /var -o bind
> 
> cat /proc/self/mounts
> 
> /dev/sda6 /var btrfs
> rw,relatime,ssd,space_cache,subvolid=5,subvol=/ostree/deploy/fedora-
> workstation/var 0 0
> 
> findmnt shows basically the same [options only listed]
> 
> rw,relatime,ssd,space_cache,subvolid=5,subvol=/ostree/deploy/fedora-
> workstation
> 
> 
> There is no such subvolume /ostree/deploy/fedora-workstation/var,
> basically it seems like whatever is producing this mount information
> (kernel code?) is just assuming a bind mount on Btrfs is a subvolume
> without checking if that subvolume really exists, and if it's just an
> ordinary directory being bind mounted, which is what's going on here.
> 
> I'd say it's confusing. But I don't know if it's a problem otherwise.

Yes, it's kernel code.  The reason is that btrfs internally handles 
subvolume mounts as bind-mounts, so it thinks all bind-mounts are 
subvolume mounts, even when they're not.

It can be slightly confusing, true, but I actually appreciate having the 
path information available here for my bind-mounts (which aren't 
subvolumes as I don't use subvolumes here).  It makes it easier to figure 
out which are the bind-mounts vs the original mount.  From my mount 
output:

/dev/sda5 on / type btrfs (..,subvolid=5,subvol=/)
/dev/sda5 on /m/cbind/etc/bind type btrfs (..,subvolid=5,subvol=/etc/bind)

/dev/sda6 on /h type btrfs (..,subvolid=5,subvol=/)
/dev/sda6 on /m/cbind/var/bind type btrfs (..,subvolid=5,subvol=/var/bind)

Note the subvolid=5.  For real subvolume mounts that should be something 
else, so it makes it clear it's the root subvolume and thus a regular 
bind-mount not a subvolume mount, regardless of what subvol= says.

Meanwhile, the subvol= gives me the information that the duplicate 
/dev/sdx is missing, the path on the device that's actually being 
mounted.  For the original mount it's /.  For bind-mounts, it's the path 
that's being bind-mounted elsewhere, /etc/bind being bind-mounted to 
/m/cbind/etc/bind, for the first (sda5) listing above.

Before the kernel started printing that subvol= stuff, this information 
was missing, as it still is for non-btrfs.

So while slightly confusing, I definitely /like/ having that new 
information available. =:^)

Arguably it could be printed as something other than "subvol=", however, 
but what?  If I had a reasonable suggestion for something that retains 
the additional information but looks less confusing regardless of whether 
it's an actual subvolume mount or just a bind-mount, I'd have made it 
already. =:^(

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bind mounts on btrfs cause mountinfo confusion
  2017-07-18  7:24 ` Duncan
@ 2017-07-18 18:57   ` Andrei Borzenkov
  0 siblings, 0 replies; 3+ messages in thread
From: Andrei Borzenkov @ 2017-07-18 18:57 UTC (permalink / raw)
  To: Duncan, linux-btrfs

18.07.2017 10:24, Duncan пишет:
> 
> Before the kernel started printing that subvol= stuff, this information 
> was missing, as it still is for non-btrfs.
> 

Huh?

tail -1 /proc/self/mountinfo

215 25 8:4 /tmp/from /tmp/to rw,relatime shared:1 - ext4 /dev/sda4
rw,errors=remount-ro,data=ordered

You just need to look in the right place ...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-18 18:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 21:47 bind mounts on btrfs cause mountinfo confusion Chris Murphy
2017-07-18  7:24 ` Duncan
2017-07-18 18:57   ` Andrei Borzenkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.