diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-03-23 02:25:38 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-03-23 02:25:38 +0000 |
commit | 16b5d462f73eb29d1f67fa01cc1ea66afdc72569 (patch) | |
tree | 5407bd573f4840e473ea27cbe61e5c7a07131fcd /fs/super.c | |
parent | ce8a076e11e7e5ee36007f9a3eee5bb3744cb8f6 (diff) |
Merge with Linux 2.3.99-pre2.
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 107 |
1 files changed, 48 insertions, 59 deletions
diff --git a/fs/super.c b/fs/super.c index 8aed9ce90..dd34ddc70 100644 --- a/fs/super.c +++ b/fs/super.c @@ -247,32 +247,9 @@ static struct file_system_type *get_fs_type(const char *name) return fs; } - struct vfsmount *vfsmntlist = NULL; static struct vfsmount *vfsmnttail = NULL, *mru_vfsmnt = NULL; -/* - * This part handles the management of the list of mounted filesystems. - */ -struct vfsmount *lookup_vfsmnt(kdev_t dev) -{ - struct vfsmount *lptr; - - if (vfsmntlist == NULL) - return NULL; - - if (mru_vfsmnt != NULL && mru_vfsmnt->mnt_dev == dev) - return (mru_vfsmnt); - - for (lptr = vfsmntlist; lptr != NULL; lptr = lptr->mnt_next) - if (lptr->mnt_dev == dev) { - mru_vfsmnt = lptr; - return (lptr); - } - - return NULL; -} - static struct vfsmount *add_vfsmnt(struct super_block *sb, const char *dev_name, const char *dir_name) { @@ -286,11 +263,6 @@ static struct vfsmount *add_vfsmnt(struct super_block *sb, lptr->mnt_sb = sb; lptr->mnt_dev = sb->s_dev; - lptr->mnt_flags = sb->s_flags; - - sema_init(&lptr->mnt_dquot.dqio_sem, 1); - sema_init(&lptr->mnt_dquot.dqoff_sem, 1); - lptr->mnt_dquot.flags = 0; /* N.B. Is it really OK to have a vfsmount without names? */ if (dev_name && !IS_ERR(tmp = getname(dev_name))) { @@ -399,9 +371,9 @@ int get_filesystem_info( char *buf ) len += sprintf( buf + len, "%s %s %s %s", tmp->mnt_devname, path, tmp->mnt_sb->s_type->name, - tmp->mnt_flags & MS_RDONLY ? "ro" : "rw" ); + tmp->mnt_sb->s_flags & MS_RDONLY ? "ro" : "rw" ); for (fs_infop = fs_info; fs_infop->flag; fs_infop++) { - if (tmp->mnt_flags & fs_infop->flag) { + if (tmp->mnt_sb->s_flags & fs_infop->flag) { strcpy(buf + len, fs_infop->str); len += strlen(fs_infop->str); } @@ -592,6 +564,9 @@ static struct super_block * read_super(kdev_t dev, struct block_device *bdev, sema_init(&s->s_vfs_rename_sem,1); sema_init(&s->s_nfsd_free_path_sem,1); s->s_type = type; + sema_init(&s->s_dquot.dqio_sem, 1); + sema_init(&s->s_dquot.dqoff_sem, 1); + s->s_dquot.flags = 0; lock_super(s); if (!type->read_super(s, data, silent)) goto out_fail; @@ -606,7 +581,6 @@ out_fail: s->s_dev = 0; s->s_bdev = 0; s->s_type = NULL; - put_filesystem(type); unlock_super(s); return NULL; } @@ -688,7 +662,7 @@ static struct block_device *do_umount(kdev_t dev, int unmount_root, int flags) * on the device. If the umount fails, too bad -- there * are no quotas running any more. Just turn them on again. */ - DQUOT_OFF(dev); + DQUOT_OFF(sb); acct_auto_close(dev); /* @@ -990,7 +964,6 @@ out: static int do_remount_sb(struct super_block *sb, int flags, char *data) { int retval; - struct vfsmount *vfsmnt; if (!(flags & MS_RDONLY) && sb->s_dev && is_read_only(sb->s_dev)) return -EACCES; @@ -1007,9 +980,6 @@ static int do_remount_sb(struct super_block *sb, int flags, char *data) return retval; } sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); - vfsmnt = lookup_vfsmnt(sb->s_dev); - if (vfsmnt) - vfsmnt->mnt_flags = sb->s_flags; /* * Invalidate the inodes, as some mount options may be changed. @@ -1093,8 +1063,8 @@ static int copy_mount_options (const void * data, unsigned long *where) * aren't used, as the syscall assumes we are talking to an older * version that didn't understand them. */ -asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, - unsigned long new_flags, void * data) +long do_sys_mount(char * dev_name, char * dir_name, unsigned long type_page, + unsigned long new_flags, unsigned long data_page) { struct file_system_type * fstype; struct dentry * dentry = NULL; @@ -1102,28 +1072,19 @@ asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, struct block_device *bdev = NULL; int retval; unsigned long flags = 0; - unsigned long page = 0; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - lock_kernel(); + if ((new_flags & (MS_MGC_MSK | MS_REMOUNT)) == (MS_MGC_VAL | MS_REMOUNT)) { - retval = copy_mount_options (data, &page); - if (retval < 0) - goto out; retval = do_remount(dir_name, new_flags & ~MS_MGC_MSK & ~MS_REMOUNT, - (char *) page); - free_page(page); + (char *) data_page); goto out; } - retval = copy_mount_options (type, &page); - if (retval < 0) - goto out; - fstype = get_fs_type((char *) page); - free_page(page); + fstype = get_fs_type((char *) type_page); retval = -ENODEV; if (!fstype) goto out; @@ -1150,22 +1111,50 @@ asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, if (bdops) bdev->bd_op = bdops; } - page = 0; - if ((new_flags & MS_MGC_MSK) == MS_MGC_VAL) { + if ((new_flags & MS_MGC_MSK) == MS_MGC_VAL) flags = new_flags & ~MS_MGC_MSK; - retval = copy_mount_options(data, &page); - if (retval < 0) - goto dput_and_out; - } + retval = do_mount(bdev, dev_name, dir_name, fstype->name, flags, - (void *) page); - free_page(page); + (void *) data_page); dput_and_out: dput(dentry); fs_out: put_filesystem(fstype); out: + return retval; +} + +asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, + unsigned long new_flags, void * data) +{ + int retval; + unsigned long data_page = 0; + unsigned long type_page = 0; + + lock_kernel(); + retval = copy_mount_options (type, &type_page); + if (retval < 0) + goto out; + + /* copy_mount_options allows a NULL user pointer, + * and just returns zero in that case. But if we + * allow the type to be NULL we will crash. + * Previously we did not check this case. + */ + if (type_page == 0) { + retval = -EINVAL; + goto out; + } + + retval = copy_mount_options (data, &data_page); + if (retval >= 0) { + retval = do_sys_mount(dev_name, dir_name, type_page, + new_flags, data_page); + free_page(data_page); + } + free_page(type_page); +out: unlock_kernel(); return retval; } @@ -1255,7 +1244,7 @@ void __init mount_root(void) * devfs crap and checking it right now. Later. */ if (!ROOT_DEV) - panic("I have no root and I want to sream"); + panic("I have no root and I want to scream"); bdev = bdget(kdev_t_to_nr(ROOT_DEV)); if (!bdev) |