/proc/mounts doesn't store bind flag
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
When symlinking /etc/mtab to /proc/mounts, bind mounts no longer have the bind option stored. Is this a bug or working as intended?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSc9y2AAoJEJrBOlT6nu75ihwH/A/rKo6GYPN+fIS+eA271n2X jqeGjHZr3mLfu5NGv+ihBWc9DM7zpxUXjWLzgY6+kyZ0RKyYbsbruQJLK3m+DPh5 +QASQ0p7ptKEArimKGeRMwqOlg0rRscZZRcPiT26ntwaS4aTreKtM2MvkJOdx2nR XqQTFyWOlu6neo4cS1fZse+sFO6PcwnsyB1zclRVcQbSMS0e/8qS7SKZ9PO8KRzS goT7gzvM/ShXmpOSblurFn3HFuVFswElDQ6WgWoNGHnJL9ClenBygUT7pMMj3Pbx qyHJzCW67Tc4iBDBN3V6g3y3ZmyCzKvTe2BQop009KnPeutlv8yzEVYW0f7XST0= =+HTn
-----END PGP SIGNATURE-----
Karel Zak
maintainerQuoted 3 lines · Phillip Susi
-----BEGIN PGP SIGNED MESSAGE-----
When symlinking/etc/mtabto/proc/mounts, bind mounts no longer have the bind option stored. Is this a bug or working as intended?
This is expected thing. All utils that expect "bind" flag are broken.
There is nothing like "bind" mountpoint (and kernel does not maintain such information at all), all mountpoints are equal, there is nothing like a primary (original) mountpoint.
You have to think about it as about hardlinks for files. The bind operation creates just another path to the filesystem. That's all.
mount /dev/sda1 /A mount --bind /A /B umount /A
then /B is still valid (BTW, this is impossible to describe in the traditional /etc/mtab where was always relation between /A and /B).
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
That is pretty much what I thought, but why is the bind flag stored when you do use mtab then? Shouldn't they give the same behavior, so bind should not be stored in mtab? In particular it changes the way you have to remount a bind mount ro, which is an unexpected user visible change.
Quoted 15 lines · Karel Zak
Quoted 3 lines · Phillip Susi
-----BEGIN PGP SIGNED MESSAGE----- When symlinking
/etc/mtabto/proc/mounts, bind mounts no longer have the bind option stored. Is this a bug or working as intended?This is expected thing. All utils that expect "bind" flag are broken.
There is nothing like "bind" mountpoint (and kernel does not maintain such information at all), all mountpoints are equal, there is nothing like a primary (original) mountpoint.
You have to think about it as about hardlinks for files. The bind operation creates just another path to the filesystem. That's all.
Quoted 8 lines
mount
/dev/sda1/A mount --bind /A /B umount /Athen /B is still valid (BTW, this is impossible to describe in the traditional
/etc/mtabwhere was always relation between /A and /B).Karel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSd6jsAAoJEJrBOlT6nu75zi8IALrs8Att9snO3z1Z1PcNikiG yXuhaDLP8+4Nz8c8+GTFUc2SpaZHR6t1uUenMBiRrtlzqZFcGdQaNGF1wWorSTf9 cih7ffcgzXC7hA/pkPTCTTZYh1BJQbZqiH1coHoNlkyJo1ej6e0ZO42HEgQA+Aa3 0OKa6SkARTLY2NM7HBhxMpK42pt8G/3lZxngs3YHgVhB8UxeVylDcdH3M/z6GTPY IdnjP/k1EzTgfhMXgd5OH/lvxmOhgt9kknSXz3D4sBUH24MJzKQ2N41+t1k/4K2u LY8jb70kOxtlgmnlw+1fXk8lqi2vRxSUlupS8fLust6M4bUEzHlfLAOUaebTNYY= =rHWj
-----END PGP SIGNATURE-----
Karel Zak
maintainerQuoted 5 lines · Phillip Susi
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1That is pretty much what I thought, but why is the bind flag stored when you do use mtab then? Shouldn't they give the same behavior, so
Historical reasons... 10 years ago nobody cares about the sense of the flag in the mtab ;-(
And it's also difficult for userspace to generate the right mount source device if a directory is specified.
I'm not sure if I want to change the mtab behavior if for example old coreutils df(1) or some backup tools depend on this odd behavior.
It seems better to keep it without a change and provide a better solution only for new systems without mtab.
Quoted 3 lines
bind should not be stored in mtab? In particular it changes the way you have to remount a bind mount ro, which is an unexpected user visible change.
Yes. The update to systems without mtab has some disadvantages, but it's still acceptable compare to mtab disadvantages.
Fedora did the change years (2?) ago and the number of the bug reports related to this problem is almost zero. The question is what will happen on server (e.g. RHEL), we will see :-)
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com