Re: Configuration system bug? : tmpfs listing in /proc/filesystems when TMPFS was not configured!?

From: Hugh Dickins
Date: Sat Nov 06 2004 - 16:11:13 EST


On Sun, 7 Nov 2004, Chiaki wrote:

> (Please cc: me since I am not subscribed to linux-kernel list.)
>
> I think there is something fishy about kernel 2.6.9.
>
> I failed to enable TMPFS during configuration of
> my linux kernel 2.6.9.
>
> However, somehow /proc/filesystems lists "nodev tmpfs" line !?
>
> Is this to be expected?

It's been like that since 2.4.4. I suspect it started out as a mistake,
but it's been like that for so long, I've been reluctant to change it
for fear of what might break instead.

> Background:
> I found this hard way. At least one program, namely,
> Debian udev package checks whether the system
> supports tmpfs by looking at the contents of /proc/filesystems.
> Because of this entry in /proc/filesystems, the script fails miserably
> now.

That seems a reasonable thing to do, and it may be okay even
despite the misleading advertizement of tmpfs in /proc/filesystems,
if the mount fails as it should.

> Because of the listing of tmpfs although TMPFS was not configured(!?),
> a system initialization script for udev is fooled into believing that
> tmpfs is supported and tries to mount tmpfs on /dev.
>
> Worse. Somehow the mount command doesn't complain
> about tmpfs not supported, and returns succcess code to the
> invoking shell. (I checked.)
> (If mount fails, then we can probably fix the script to detect the
> internal consistency problem and quits.)

This is the really bad part, that is new behaviour in 2.6.9, and
my fault for not thinking harder about MS_NOUSER. Worse than that,
it leaves the directory in a bizarre state, "Not a directory" when
you try to list it for example - Anton reported this weeks ago, but
we couldn't reproduce it, not knowing it needed CONFIG_TMPFS off.

Please try the patch below (against 2.6.9, I'll send Andrew and Linus
the same for 2.6.10-rc later, with proper comment), it fixes mount to
fail cleanly when CONFIG_TMPFS is off. Let us (or Debian) know if it
also then fixes the Debian udev initialization in this case.

Thanks,
Hugh

--- 2.6.9/mm/shmem.c 2004-10-18 22:56:29.000000000 +0100
+++ linux/mm/shmem.c 2004-11-06 21:04:41.743173040 +0000
@@ -1904,6 +1904,8 @@ static int shmem_fill_super(struct super
sbinfo->max_inodes = inodes;
sbinfo->free_inodes = inodes;
}
+#else
+ sb->s_flags |= MS_NOUSER;
#endif

sb->s_maxbytes = SHMEM_MAX_BYTES;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/