Re: Max mounted filesystems

Guest section DW (dwguest@win.tue.nl)
Thu, 21 Jan 1999 22:30:12 +0100 (MET)


From: "Stephen C. Tweedie" <sct@redhat.com>

On Tue, 19 Jan 1999 17:12:44 -0600 (EST), Russell Steffen
<rsteffen@ia.net> said:

> By default the maximum number of mounted filesystems is 64, correct?

On 2.0, yes.

> And is this value is controlled completely by the value of NR_SUPER in
> linux/fs.h ? (ie, I can raise the lmit to, say 256, just by changing
> NR_SUPER?)

Yes.

On 2.2, it is fully dynamic. Just echo a new value to
/proc/sys/fs/super-max.

Yes. One of the problems with mount is that one usually gets
the infamous

"mount: wrong fs type, bad option, bad superblock on %s
" or too many mounted file systems"

error message. In other words, the kernel knows precisely what is
wrong but returns EINVAL to user space, like old `ed' that prints
just `?' for any error.

In particular, the mount system call should return EMFILE instead of
EINVAL in case of "too many mounted file systems"
(so that mount can print the informative error message:
"mount: too many mounted file systems"
" perhaps increase /proc/sys/fs/super-max?"
).

In other words, a patch like the one below might be a good start.
Eventually all vfs routines should return more detailed
error values.

Andries

(2.2.0pre7 diff, pasted from screen:)
--- super.c~ Sat Jan 9 23:10:30 1999
+++ super.c Thu Jan 21 22:23:49 1999
@@ -534,8 +534,8 @@
return s;
}

-static struct super_block * read_super(kdev_t dev,const char *name,int flags,
- void *data, int silent)
+static struct super_block * read_super(kdev_t dev, const char *name, int flags,
+ void *data, int silent, int *err)
{
struct super_block * s;
struct file_system_type *type;
@@ -554,8 +554,10 @@
goto out;
}
s = get_empty_super();
- if (!s)
+ if (!s) {
+ *err = -EMFILE;
goto out;
+ }
s->s_dev = dev;
s->s_flags = flags;
s->s_dirt = 0;
@@ -877,7 +879,7 @@
* read_super just does a get_super().
*/
error = -EINVAL;
- sb = read_super(dev, type, flags, data, 0);
+ sb = read_super(dev, type, flags, data, 0, &error);
if (!sb)
goto dput_and_out;

@@ -1121,7 +1123,7 @@
struct vfsmount *vfsmnt;
struct inode * d_inode = NULL;
struct file filp;
- int retval;
+ int retval, dummy;

#ifdef CONFIG_ROOT_NFS
if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
@@ -1189,7 +1191,7 @@
else for (fs_type = file_systems ; fs_type ; fs_type = fs_type->next) {
if (!(fs_type->fs_flags & FS_REQUIRES_DEV))
continue;
- sb = read_super(ROOT_DEV,fs_type->name,root_mountflags,NULL,1);
+ sb = read_super(ROOT_DEV,fs_type->name,root_mountflags,NULL,1,&dummy);
if (sb) {
sb->s_flags = root_mountflags;
current->fs->root = dget(sb->s_root);

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