mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
Push lock_super() into the ->remount_fs() of filesystems that care about it
Note that since we can't run into contention between remount_fs and write_super (due to exclusion on s_umount), we have to care only about filesystems that touch lock_super() on their own. Out of those ext3, ext4, hpfs, sysv and ufs do need it; fat doesn't since its ->remount_fs() only accesses assign-once data (basically, it's "we have no atime on directories and only have atime on files for vfat; force nodiratime and possibly noatime into *flags"). [folded a build fix from hch] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
6cfd014842
commit
bbd6851a32
6 changed files with 21 additions and 3 deletions
|
@ -2491,6 +2491,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Store the original options */
|
/* Store the original options */
|
||||||
|
lock_super(sb);
|
||||||
old_sb_flags = sb->s_flags;
|
old_sb_flags = sb->s_flags;
|
||||||
old_opts.s_mount_opt = sbi->s_mount_opt;
|
old_opts.s_mount_opt = sbi->s_mount_opt;
|
||||||
old_opts.s_resuid = sbi->s_resuid;
|
old_opts.s_resuid = sbi->s_resuid;
|
||||||
|
@ -2598,6 +2599,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
|
||||||
old_opts.s_qf_names[i] != sbi->s_qf_names[i])
|
old_opts.s_qf_names[i] != sbi->s_qf_names[i])
|
||||||
kfree(old_opts.s_qf_names[i]);
|
kfree(old_opts.s_qf_names[i]);
|
||||||
#endif
|
#endif
|
||||||
|
unlock_super(sb);
|
||||||
return 0;
|
return 0;
|
||||||
restore_opts:
|
restore_opts:
|
||||||
sb->s_flags = old_sb_flags;
|
sb->s_flags = old_sb_flags;
|
||||||
|
@ -2614,6 +2616,7 @@ restore_opts:
|
||||||
sbi->s_qf_names[i] = old_opts.s_qf_names[i];
|
sbi->s_qf_names[i] = old_opts.s_qf_names[i];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
unlock_super(sb);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3421,6 +3421,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Store the original options */
|
/* Store the original options */
|
||||||
|
lock_super(sb);
|
||||||
old_sb_flags = sb->s_flags;
|
old_sb_flags = sb->s_flags;
|
||||||
old_opts.s_mount_opt = sbi->s_mount_opt;
|
old_opts.s_mount_opt = sbi->s_mount_opt;
|
||||||
old_opts.s_resuid = sbi->s_resuid;
|
old_opts.s_resuid = sbi->s_resuid;
|
||||||
|
@ -3554,6 +3555,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
|
||||||
old_opts.s_qf_names[i] != sbi->s_qf_names[i])
|
old_opts.s_qf_names[i] != sbi->s_qf_names[i])
|
||||||
kfree(old_opts.s_qf_names[i]);
|
kfree(old_opts.s_qf_names[i]);
|
||||||
#endif
|
#endif
|
||||||
|
unlock_super(sb);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
restore_opts:
|
restore_opts:
|
||||||
|
@ -3573,6 +3575,7 @@ restore_opts:
|
||||||
sbi->s_qf_names[i] = old_opts.s_qf_names[i];
|
sbi->s_qf_names[i] = old_opts.s_qf_names[i];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
unlock_super(sb);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -398,6 +398,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
|
||||||
|
|
||||||
*flags |= MS_NOATIME;
|
*flags |= MS_NOATIME;
|
||||||
|
|
||||||
|
lock_super(s);
|
||||||
uid = sbi->sb_uid; gid = sbi->sb_gid;
|
uid = sbi->sb_uid; gid = sbi->sb_gid;
|
||||||
umask = 0777 & ~sbi->sb_mode;
|
umask = 0777 & ~sbi->sb_mode;
|
||||||
lowercase = sbi->sb_lowercase; conv = sbi->sb_conv;
|
lowercase = sbi->sb_lowercase; conv = sbi->sb_conv;
|
||||||
|
@ -430,9 +431,11 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
|
||||||
|
|
||||||
replace_mount_options(s, new_opts);
|
replace_mount_options(s, new_opts);
|
||||||
|
|
||||||
|
unlock_super(s);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
|
unlock_super(s);
|
||||||
kfree(new_opts);
|
kfree(new_opts);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -556,9 +556,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
|
||||||
remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY);
|
remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY);
|
||||||
|
|
||||||
if (sb->s_op->remount_fs) {
|
if (sb->s_op->remount_fs) {
|
||||||
lock_super(sb);
|
|
||||||
retval = sb->s_op->remount_fs(sb, &flags, data);
|
retval = sb->s_op->remount_fs(sb, &flags, data);
|
||||||
unlock_super(sb);
|
|
||||||
if (retval)
|
if (retval)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,12 @@ clean:
|
||||||
static int sysv_remount(struct super_block *sb, int *flags, char *data)
|
static int sysv_remount(struct super_block *sb, int *flags, char *data)
|
||||||
{
|
{
|
||||||
struct sysv_sb_info *sbi = SYSV_SB(sb);
|
struct sysv_sb_info *sbi = SYSV_SB(sb);
|
||||||
|
lock_super(sb);
|
||||||
if (sbi->s_forced_ro)
|
if (sbi->s_forced_ro)
|
||||||
*flags |= MS_RDONLY;
|
*flags |= MS_RDONLY;
|
||||||
if (!(*flags & MS_RDONLY))
|
if (!(*flags & MS_RDONLY))
|
||||||
sb->s_dirt = 1;
|
sb->s_dirt = 1;
|
||||||
|
unlock_super(sb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1181,6 +1181,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||||
unsigned new_mount_opt, ufstype;
|
unsigned new_mount_opt, ufstype;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
|
||||||
|
lock_super(sb);
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
flags = UFS_SB(sb)->s_flags;
|
flags = UFS_SB(sb)->s_flags;
|
||||||
usb1 = ubh_get_usb_first(uspi);
|
usb1 = ubh_get_usb_first(uspi);
|
||||||
|
@ -1193,17 +1194,21 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||||
ufstype = UFS_SB(sb)->s_mount_opt & UFS_MOUNT_UFSTYPE;
|
ufstype = UFS_SB(sb)->s_mount_opt & UFS_MOUNT_UFSTYPE;
|
||||||
new_mount_opt = 0;
|
new_mount_opt = 0;
|
||||||
ufs_set_opt (new_mount_opt, ONERROR_LOCK);
|
ufs_set_opt (new_mount_opt, ONERROR_LOCK);
|
||||||
if (!ufs_parse_options (data, &new_mount_opt))
|
if (!ufs_parse_options (data, &new_mount_opt)) {
|
||||||
|
unlock_super(sb);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
if (!(new_mount_opt & UFS_MOUNT_UFSTYPE)) {
|
if (!(new_mount_opt & UFS_MOUNT_UFSTYPE)) {
|
||||||
new_mount_opt |= ufstype;
|
new_mount_opt |= ufstype;
|
||||||
} else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) {
|
} else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) {
|
||||||
printk("ufstype can't be changed during remount\n");
|
printk("ufstype can't be changed during remount\n");
|
||||||
|
unlock_super(sb);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
|
if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
|
||||||
UFS_SB(sb)->s_mount_opt = new_mount_opt;
|
UFS_SB(sb)->s_mount_opt = new_mount_opt;
|
||||||
|
unlock_super(sb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1228,6 +1233,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||||
#ifndef CONFIG_UFS_FS_WRITE
|
#ifndef CONFIG_UFS_FS_WRITE
|
||||||
printk("ufs was compiled with read-only support, "
|
printk("ufs was compiled with read-only support, "
|
||||||
"can't be mounted as read-write\n");
|
"can't be mounted as read-write\n");
|
||||||
|
unlock_super(sb);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
#else
|
#else
|
||||||
if (ufstype != UFS_MOUNT_UFSTYPE_SUN &&
|
if (ufstype != UFS_MOUNT_UFSTYPE_SUN &&
|
||||||
|
@ -1236,16 +1242,19 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||||
ufstype != UFS_MOUNT_UFSTYPE_SUNx86 &&
|
ufstype != UFS_MOUNT_UFSTYPE_SUNx86 &&
|
||||||
ufstype != UFS_MOUNT_UFSTYPE_UFS2) {
|
ufstype != UFS_MOUNT_UFSTYPE_UFS2) {
|
||||||
printk("this ufstype is read-only supported\n");
|
printk("this ufstype is read-only supported\n");
|
||||||
|
unlock_super(sb);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (!ufs_read_cylinder_structures(sb)) {
|
if (!ufs_read_cylinder_structures(sb)) {
|
||||||
printk("failed during remounting\n");
|
printk("failed during remounting\n");
|
||||||
|
unlock_super(sb);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
sb->s_flags &= ~MS_RDONLY;
|
sb->s_flags &= ~MS_RDONLY;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
UFS_SB(sb)->s_mount_opt = new_mount_opt;
|
UFS_SB(sb)->s_mount_opt = new_mount_opt;
|
||||||
|
unlock_super(sb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue