[arch-projects] Mounting nodev fs with "none" as source.

Dave Reisner d at falconindy.com
Mon Dec 26 15:38:33 EST 2011


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
> 


More information about the arch-projects mailing list