patch-2.3.99-pre2 linux/fs/super.c
Next file: linux/fs/ufs/dir.c
Previous file: linux/fs/smbfs/inode.c
Back to the patch index
Back to the overall index
- Lines: 213
- Date:
Fri Mar 17 16:46:27 2000
- Orig file:
v2.3.99-pre1/linux/fs/super.c
- Orig date:
Tue Mar 14 19:10:40 2000
diff -u --recursive --new-file v2.3.99-pre1/linux/fs/super.c linux/fs/super.c
@@ -247,32 +247,9 @@
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 @@
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 @@
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 @@
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 @@
s->s_dev = 0;
s->s_bdev = 0;
s->s_type = NULL;
- put_filesystem(type);
unlock_super(s);
return NULL;
}
@@ -688,7 +662,7 @@
* 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 @@
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 @@
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 @@
* 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 @@
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 @@
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 @@
* 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)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)