[arch-projects] Mounting nodev fs with "none" as source.
Hello I recently discovered an issue when _not_ using "none" as source of nodev filesystems. For example in our default fstab for /tmp as source is used "tmp". If you run "mount -a" under a directory with a "tmp" directory, /tmp will be mounted again as tmpfs with "fake source" as $PWD/tmp: # mount | grep /tmp tmp on /tmp type tmpfs (rw,relatime) # pwd /root # mkdir tmp # mount -a # mount | grep /tmp tmp on /tmp type tmpfs (rw,relatime) /root/tmp on /tmp type tmpfs (rw,relatime) But if using special keyword "none" as source this does not happen. # mount | grep /tmp none on /tmp type tmpfs (rw,relatime) # pwd /root # mkdir none # mount -a # mount | grep /tmp none on /tmp type tmpfs (rw,relatime) In the past (when /etc/mtab was not linked to /proc/self/mounts) weird behaviours appears when using "none" as source, but now seems that works fine. Other ways to workaround this is using the same path as source. I think we can also change source to "none" of /dev /run /proc /dev/shm and /dev/pts, looks like more correct. (or using the same path as source). I tested using none in all nodev fs and shutdown is clean without errors. what do you think? -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On Mon, Dec 26, 2011 at 05:21:49PM -0300, Gerardo Exequiel Pozzi wrote:
Hello
I recently discovered an issue when _not_ using "none" as source of nodev filesystems. For example in our default fstab for /tmp as source is used "tmp". If you run "mount -a" under a directory with a "tmp" directory, /tmp will be mounted again as tmpfs with "fake source" as $PWD/tmp:
# mount | grep /tmp tmp on /tmp type tmpfs (rw,relatime) # pwd /root # mkdir tmp # mount -a # mount | grep /tmp tmp on /tmp type tmpfs (rw,relatime) /root/tmp on /tmp type tmpfs (rw,relatime)
It's insane behavior, and should be fixed in util-linux.
But if using special keyword "none" as source this does not happen.
# mount | grep /tmp none on /tmp type tmpfs (rw,relatime) # pwd /root # mkdir none # mount -a # mount | grep /tmp none on /tmp type tmpfs (rw,relatime)
In the past (when /etc/mtab was not linked to /proc/self/mounts) weird behaviours appears when using "none" as source, but now seems that works fine.
Yeah... I can tell you from looking through the sources for libmount and mount that "none" is treated specially, and generally results in functions returning NULL. If you recall the problem we ran into with mountpoint from u-l segfaulting in AIF, it was in part because of using "none" for the mounts (and dereferencing the NULL return).
Other ways to workaround this is using the same path as source. I think we can also change source to "none" of /dev /run /proc /dev/shm and /dev/pts, looks like more correct. (or using the same path as source).
Correct? I disagree. It shouldn't matter what you call it -- the behavior should be consistent (unless I'm horribly misinformed). Again, blame where blame is due. In the case of a 'nodev' filesystem, the source should just be flat out ignored. d
I tested using none in all nodev fs and shutdown is clean without errors. what do you think?
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On Mon, Dec 26, 2011 at 03:38:33PM -0500, Dave Reisner wrote:
On Mon, Dec 26, 2011 at 05:21:49PM -0300, Gerardo Exequiel Pozzi wrote:
Hello
I recently discovered an issue when _not_ using "none" as source of nodev filesystems. For example in our default fstab for /tmp as source is used "tmp". If you run "mount -a" under a directory with a "tmp" directory, /tmp will be mounted again as tmpfs with "fake source" as $PWD/tmp:
# mount | grep /tmp tmp on /tmp type tmpfs (rw,relatime) # pwd /root # mkdir tmp # mount -a # mount | grep /tmp tmp on /tmp type tmpfs (rw,relatime) /root/tmp on /tmp type tmpfs (rw,relatime)
It's insane behavior, and should be fixed in util-linux.
But if using special keyword "none" as source this does not happen.
# mount | grep /tmp none on /tmp type tmpfs (rw,relatime) # pwd /root # mkdir none # mount -a # mount | grep /tmp none on /tmp type tmpfs (rw,relatime)
In the past (when /etc/mtab was not linked to /proc/self/mounts) weird behaviours appears when using "none" as source, but now seems that works fine.
Yeah... I can tell you from looking through the sources for libmount and mount that "none" is treated specially, and generally results in functions returning NULL. If you recall the problem we ran into with mountpoint from u-l segfaulting in AIF, it was in part because of using "none" for the mounts (and dereferencing the NULL return).
Other ways to workaround this is using the same path as source. I think we can also change source to "none" of /dev /run /proc /dev/shm and /dev/pts, looks like more correct. (or using the same path as source).
Correct? I disagree. It shouldn't matter what you call it -- the behavior should be consistent (unless I'm horribly misinformed). Again, blame where blame is due. In the case of a 'nodev' filesystem, the source should just be flat out ignored.
d
I tested using none in all nodev fs and shutdown is clean without errors. what do you think?
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Quick update... Just as I suspected, libmount will always try to canonicalize the source of a device with no regard for what it is. This is a simple change. This is a simple change in the fstab parsing to always trust the source when you encounter a pseudofs (such as tmpfs, cgroup, rpc_pipefs, etc). Patch for this will go out by the end of the night regardless of the mayhem that follows... Digging into this further -- you don't even need to mount /tmp to duplicate the bad behavior, e.g. # echo 'foo /foo tmpfs defaults 0 0' >> /etc/fstab # cd /root # mkdir foo # mount -a ...and you'll have a tmpfs on /root/foo. I'm not sure yet if this can be worked around. Seems really ugly... almost like mount(2) might be at fault here and there isn't much libmount can do. d
On 12/26/2011 06:34 PM, Dave Reisner wrote:
On Mon, Dec 26, 2011 at 03:38:33PM -0500, Dave Reisner wrote:
On Mon, Dec 26, 2011 at 05:21:49PM -0300, Gerardo Exequiel Pozzi wrote:
Hello
I recently discovered an issue when _not_ using "none" as source of nodev filesystems. For example in our default fstab for /tmp as source is used "tmp". If you run "mount -a" under a directory with a "tmp" directory, /tmp will be mounted again as tmpfs with "fake source" as $PWD/tmp:
# mount | grep /tmp tmp on /tmp type tmpfs (rw,relatime) # pwd /root # mkdir tmp # mount -a # mount | grep /tmp tmp on /tmp type tmpfs (rw,relatime) /root/tmp on /tmp type tmpfs (rw,relatime) It's insane behavior, and should be fixed in util-linux.
But if using special keyword "none" as source this does not happen.
# mount | grep /tmp none on /tmp type tmpfs (rw,relatime) # pwd /root # mkdir none # mount -a # mount | grep /tmp none on /tmp type tmpfs (rw,relatime)
In the past (when /etc/mtab was not linked to /proc/self/mounts) weird behaviours appears when using "none" as source, but now seems that works fine. Yeah... I can tell you from looking through the sources for libmount and mount that "none" is treated specially, and generally results in functions returning NULL. If you recall the problem we ran into with mountpoint from u-l segfaulting in AIF, it was in part because of using "none" for the mounts (and dereferencing the NULL return).
Other ways to workaround this is using the same path as source. I think we can also change source to "none" of /dev /run /proc /dev/shm and /dev/pts, looks like more correct. (or using the same path as source). Correct? I disagree. It shouldn't matter what you call it -- the behavior should be consistent (unless I'm horribly misinformed). Again, blame where blame is due. In the case of a 'nodev' filesystem, the source should just be flat out ignored.
d
I tested using none in all nodev fs and shutdown is clean without errors. what do you think?
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Quick update...
Just as I suspected, libmount will always try to canonicalize the source of a device with no regard for what it is. This is a simple change. This is a simple change in the fstab parsing to always trust the source when you encounter a pseudofs (such as tmpfs, cgroup, rpc_pipefs, etc). Patch for this will go out by the end of the night regardless of the mayhem that follows... Thank you!
Digging into this further -- you don't even need to mount /tmp to duplicate the bad behavior, e.g.
# echo 'foo /foo tmpfs defaults 0 0'>> /etc/fstab # cd /root # mkdir foo # mount -a
...and you'll have a tmpfs on /root/foo. I'm not sure yet if this can be worked around. Seems really ugly... almost like mount(2) might be at fault here and there isn't much libmount can do. Yes I just used "tmp" as an example. d
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On Mon, Dec 26, 2011 at 07:14:52PM -0300, Gerardo Exequiel Pozzi wrote:
On 12/26/2011 06:34 PM, Dave Reisner wrote:
Quick update...
Just as I suspected, libmount will always try to canonicalize the source of a device with no regard for what it is. This is a simple change. This is a simple change in the fstab parsing to always trust the source when you encounter a pseudofs (such as tmpfs, cgroup, rpc_pipefs, etc). Patch for this will go out by the end of the night regardless of the mayhem that follows... Thank you!
http://marc.info/?l=util-linux-ng&m=132493755706841&w=2
Digging into this further -- you don't even need to mount /tmp to duplicate the bad behavior, e.g.
# echo 'foo /foo tmpfs defaults 0 0'>> /etc/fstab # cd /root # mkdir foo # mount -a
...and you'll have a tmpfs on /root/foo. I'm not sure yet if this can be worked around. Seems really ugly... almost like mount(2) might be at fault here and there isn't much libmount can do.
Yes I just used "tmp" as an example.
d
Success here as well. Stupid thinking -- mount(2) will rightfully ignore the source parameter for a nodev fs. http://marc.info/?l=util-linux-ng&m=132493755706843&w=2 Only problem, as noted in the patch there, is that legacy mount is a goddamn monster. It does all sorts of bad things and I didn't really see an easy way to fix it. I'm really hoping that it goes away with 2.21, but it seems unlikely right now. Maybe Karel or someone else will be inclined to fix it... d
On Mon, Dec 26, 2011 at 11:29 PM, Dave Reisner <d@falconindy.com> wrote:
[...]
Dead links...? -t
On 12/26/2011 08:28 PM, Tom Gundersen wrote:
On Mon, Dec 26, 2011 at 11:29 PM, Dave Reisner<d@falconindy.com> wrote:
http://marc.info/?l=util-linux-ng&m=132493755706841&w=2 [...]
http://marc.info/?l=util-linux-ng&m=132493755706843&w=2 Dead links...?
-t
Links previously working. Mirror: http://www.spinics.net/lists/util-linux-ng/msg05568.html http://www.spinics.net/lists/util-linux-ng/msg05569.html -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On Mon, Dec 26, 2011 at 08:45:11PM -0300, Gerardo Exequiel Pozzi wrote:
On 12/26/2011 08:28 PM, Tom Gundersen wrote:
On Mon, Dec 26, 2011 at 11:29 PM, Dave Reisner<d@falconindy.com> wrote:
http://marc.info/?l=util-linux-ng&m=132493755706841&w=2 [...]
http://marc.info/?l=util-linux-ng&m=132493755706843&w=2 Dead links...?
-t
Links previously working.
Mirror:
http://www.spinics.net/lists/util-linux-ng/msg05568.html http://www.spinics.net/lists/util-linux-ng/msg05569.html
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
All 3 patched merged. mount will behave better for 2.21. d
participants (3)
-
Dave Reisner
-
Gerardo Exequiel Pozzi
-
Tom Gundersen