[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#230758: libc6: mountkernfs check for tmpfs availability is useless and attempts to mount even if unavailable



Thanks for your report.

At Mon, 02 Feb 2004 11:50:30 +0100,
josh buhl wrote:
> Now, on my sytem tmpfs is not enabled in the kernel:
> 
> spleen:~# grep -i tmpfs /boot/config-2.4.24
> # CONFIG_TMPFS is not set
> spleen:~#
> 
> however, this availability test is still true:
> 
> spleen:~# grep -i tmpfs /proc/filesystems
> nodev   tmpfs
> spleen:~# grep -ci '[<[:space:]]tmpfs' /proc/filesystems
> 1
> spleen:~#
> 
> And so mounting tmpfs at boot fails with an error message.
> 
> 
> After recompiling the kernel and enabling tmpfs, the check produces the
> same results:
> 
> spleen:~# grep -i tmpfs /boot/config-2.4.24
> CONFIG_TMPFS=y
> spleen:~# grep -i tmpfs /proc/filesystems
> nodev   tmpfs
> spleen:~# grep -ci '[<[:space:]]tmpfs' /proc/filesystems
> 1
> spleen:~#
> 
> 
> I don't know why /proc/filesytems shows tmpfs even if it's not compiled 
> in...

Looking at kernel 2.6.1 Documentation/filesystems/tmpfs.txt:

	tmpfs has the following uses:

	1) There is always a kernel internal mount which you will not see at
	   all. This is used for shared anonymous mappings and SYSV shared
	   memory. 
	
	   This mount does not depend on CONFIG_TMPFS. If CONFIG_TMPFS is not
	   set, the user visible part of tmpfs is not build. But the internal
	   mechanisms are always present.

Kernel 2.6 has only "tmpfs" entry.

However, OTOH, kernel 2.4 has both "tmpfs" entry and "shmfs" entry.
I find the difference at linux-2.4.23/mm/shmem.c:init_tmpfs() as follows:

	static int __init init_tmpfs(void)
	{
	        error = register_filesystem(&tmpfs_fs_type);
	#ifdef CONFIG_TMPFS
	        error = register_filesystem(&shmem_fs_type);
	#endif

Kernel 2.4 always mounts tmpfs, but not shmfs (it mounts iff
CONFIG_TMPFS is used).  From checking throught all kernel 2.5 patches,
this modification was done in 2.5.45, worked by akpm:

	http://linux.bkbits.net:8080/linux-2.5/diffs/mm/shmem.c@1.91?nav=index.html|src/|src/mm|hist/mm/shmem.c

And summary:

	kernel 2.3.3x - 2.3.??	shmfs is existed
	kernel 2.3.? - 2.5.44:	shmfs and tmpfs are existed
				if there is no "shmfs", then we should
				avoid to mount /dev/shm.
	kernel 2.5.45-:		tmpfs is existed

Now I fix:

	kernel - 2.5.44		check shmfs and tmpfs, and mount as "tmpfs"
				if tmpfs is unavailable, try to use shmfs.
	kernel 2.5.45 -		check only tmpfs, and mount as "tmpfs"

Regards,
-- gotom



Reply to: