vfs: remount_fs BKL pushdown
Subsystems (30)
PATCH 1/1 vfs: remount_fs BKL pushdown
Push BKL down into ->remount_fs()
--- drivers/isdn/capi/capifs.c | 5 +++++ drivers/staging/pohmelfs/inode.c | 11 +++++++++-- drivers/usb/core/inode.c | 5 +++++ fs/adfs/super.c | 9 ++++++++- fs/affs/super.c | 12 ++++++++++-- fs/befs/linuxvfs.c | 7 ++++++- fs/btrfs/super.c | 22 +++++++++++++++++----- fs/cifs/cifsfs.c | 2 ++ fs/coda/inode.c | 2 ++ fs/cramfs/inode.c | 3 +++ fs/devpts/inode.c | 10 ++++++++-- fs/efs/super.c | 3 +++ fs/ext2/super.c | 18 ++++++++++++++---- fs/ext3/super.c | 7 ++++++- fs/ext4/super.c | 7 ++++++- fs/fat/inode.c | 5 ++++- fs/freevxfs/vxfs_super.c | 3 +++ fs/fuse/inode.c | 6 +++++- fs/gfs2/ops_super.c | 27 +++++++++++++++++++++------ fs/hfs/super.c | 7 ++++++- fs/hfsplus/super.c | 12 ++++++++++-- fs/hpfs/super.c | 8 +++++++- fs/isofs/inode.c | 3 +++ fs/jffs2/fs.c | 11 +++++++++-- fs/jfs/super.c | 27 ++++++++++++++++++++++----- fs/minix/inode.c | 14 +++++++++++--- fs/namespace.c | 2 -- fs/ncpfs/inode.c | 2 ++ fs/nfs/super.c | 20 +++++++++++++++----- fs/nilfs2/super.c | 10 ++++++++-- fs/ntfs/super.c | 18 ++++++++++++++++-- fs/ocfs2/super.c | 7 ++++++- fs/openpromfs/inode.c | 3 +++ fs/qnx4/inode.c | 3 +++ fs/reiserfs/super.c | 12 ++++++++++-- fs/romfs/super.c | 3 +++ fs/smbfs/inode.c | 2 ++ fs/squashfs/super.c | 3 +++ fs/super.c | 4 ---- fs/sysv/inode.c | 7 ++++++- fs/ubifs/super.c | 13 +++++++++++-- fs/udf/super.c | 13 ++++++++++--- fs/ufs/super.c | 11 ++++++++++- fs/xfs/linux-2.6/xfs_super.c | 7 ++++++- kernel/cgroup.c | 9 +++++++-- mm/shmem.c | 13 ++++++++++--- 46 files changed, 336 insertions(+), 72 deletions(-)
drivers/isdn/capi/capifs.c +5 -0
@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/ctype.h> #include <linux/sched.h> /* current */ +#include <linux/smp_lock.h> #include "capifs.h"
@@ -54,6 +55,8 @@ static int capifs_remount(struct super_block *s, int *flags, char *data)char *this_char;char *new_opt =kstrdup (data,GFP_KERNEL ); +lock_kernel (); + this_char =NULL ;while ((this_char =strsep (&data,"," )) !=NULL ) {int n;
@@ -71,6 +74,7 @@ static int capifs_remount(struct super_block *s, int *flags, char *data)else {kfree (new_opt);printk ("capifs: called with bogus options\n" ); +unlock_kernel ();return -EINVAL ; } }
@@ -84,6 +88,7 @@ static int capifs_remount(struct super_block *s, int *flags, char *data) config.gid = gid; config.mode = mode; +unlock_kernel ();return 0 ; }
drivers/staging/pohmelfs/inode.c +9 -2
@@ -30,6 +30,7 @@#include <linux/statfs.h> #include <linux/writeback.h> #include <linux/quotaops.h> +#include <linux/smp_lock.h> #include "netfs.h"
@@ -1475,8 +1476,12 @@ static int pohmelfs_parse_options(char *options, struct pohmelfs_sb *psb, int restatic int pohmelfs_remount (struct super_block *sb,int *flags,char *data) {int err; -struct pohmelfs_sb *psb =POHMELFS_SB (sb); -unsigned long old_sb_flags = sb->s_flags; +struct pohmelfs_sb *psb; +unsigned long old_sb_flags; + +lock_kernel (); + psb =POHMELFS_SB (sb); + old_sb_flags = sb->s_flags; err =pohmelfs_parse_options (data, psb,1 );if (err)
@@ -1484,10 +1489,12 @@ static int pohmelfs_remount(struct super_block *sb, int *flags, char *data)if (!(*flags &MS_RDONLY )) sb->s_flags &= ~MS_RDONLY ; +unlock_kernel ();return 0 ; err_out_restore: sb->s_flags = old_sb_flags; +unlock_kernel ();return err; }
drivers/usb/core/inode.c +5 -0
@@ -39,6 +39,7 @@#include <linux/parser.h> #include <linux/notifier.h> #include <linux/seq_file.h> +#include <linux/smp_lock.h> #include <asm/byteorder.h> #include "usb.h" #include "hcd.h"
@@ -260,14 +261,18 @@ static int remount(struct super_block *sb, int *flags, char *data)if (ignore_mount)return 0 ; +lock_kernel (); +if (parse_options (sb, data)) {printk (KERN_WARNING "usbfs: mount parameter error.\n" ); +unlock_kernel ();return -EINVAL ; }if (usbfs_mount && usbfs_mount->mnt_sb)update_sb (usbfs_mount->mnt_sb); +unlock_kernel ();return 0 ; }
fs/adfs/super.c +8 -1
@@ -22,6 +22,7 @@#include <linux/bitops.h> #include <linux/mount.h> #include <linux/seq_file.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include <asm/system.h>
@@ -213,8 +214,14 @@ static int parse_options(struct super_block *sb, char *options)static int adfs_remount (struct super_block *sb,int *flags,char *data) { +int ret; + +lock_kernel (); *flags |=MS_NODIRATIME ; -return parse_options (sb, data); + ret =parse_options (sb, data); +unlock_kernel (); + +return ret; }static int adfs_statfs (struct dentry *dentry,struct kstatfs *buf)
fs/affs/super.c +10 -2
@@ -16,6 +16,7 @@#include <linux/parser.h> #include <linux/magic.h> #include <linux/sched.h> +#include <linux/smp_lock.h> #include "affs.h" extern struct timezone sys_tz;
@@ -486,7 +487,7 @@ out_error_noinode:static int affs_remount (struct super_block *sb,int *flags,char *data) { -struct affs_sb_info *sbi =AFFS_SB (sb); +struct affs_sb_info *sbi;int blocksize;uid_t uid;gid_t gid;
@@ -499,12 +500,16 @@ affs_remount(struct super_block *sb, int *flags, char *data)pr_debug ("AFFS: remount(flags=0x%x,opts=\"%s\")\n" ,*flags,data); +lock_kernel (); + + sbi =AFFS_SB (sb); *flags |=MS_NODIRATIME ;if (!parse_options (data, &uid, &gid, &mode, &reserved, &root_block, &blocksize, &sbi->s_prefix, sbi->s_volume, &mount_flags)) {kfree (new_opts); +unlock_kernel ();return -EINVAL ; }kfree (sb->s_options);
@@ -515,8 +520,10 @@ affs_remount(struct super_block *sb, int *flags, char *data) sbi->s_uid = uid; sbi->s_gid = gid; -if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) +if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) { +unlock_kernel ();return 0 ; + }if (*flags &MS_RDONLY ) { sb->s_dirt =1 ;while (sb->s_dirt)
@@ -525,6 +532,7 @@ affs_remount(struct super_block *sb, int *flags, char *data) }else res =affs_init_bitmap (sb, flags); +unlock_kernel ();return res; }
fs/befs/linuxvfs.c +6 -1
@@ -15,6 +15,7 @@#include <linux/vfs.h> #include <linux/parser.h> #include <linux/namei.h> +#include <linux/smp_lock.h> #include "befs.h" #include "btree.h"
@@ -891,8 +892,12 @@ befs_fill_super(struct super_block *sb, void *data, int silent)static int befs_remount (struct super_block *sb,int *flags,char *data) { -if (!(*flags &MS_RDONLY )) +lock_kernel (); +if (!(*flags &MS_RDONLY )) { +unlock_kernel ();return -EINVAL ; + } +unlock_kernel ();return 0 ; }
fs/btrfs/super.c +17 -5
@@ -553,15 +553,22 @@ error_free_subvol_name:static int btrfs_remount (struct super_block *sb,int *flags,char *data) { -struct btrfs_root *root =btrfs_sb (sb); +struct btrfs_root *root;int ret; +lock_kernel (); + root =btrfs_sb (sb); + ret =btrfs_parse_options (root, data); -if (ret) +if (ret) { +unlock_kernel ();return -EINVAL ; + } -if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) +if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) { +unlock_kernel ();return 0 ; + }if (*flags &MS_RDONLY ) { sb->s_flags |=MS_RDONLY ;
@@ -569,11 +576,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) ret =btrfs_commit_super (root);WARN_ON (ret); }else { -if (root->fs_info->fs_devices->rw_devices ==0 ) +if (root->fs_info->fs_devices->rw_devices ==0 ) { +unlock_kernel ();return -EACCES ; + } -if (btrfs_super_log_root (&root->fs_info->super_copy) !=0 ) +if (btrfs_super_log_root (&root->fs_info->super_copy) !=0 ) { +unlock_kernel ();return -EINVAL ; + } ret =btrfs_cleanup_reloc_trees (root);WARN_ON (ret);
@@ -584,6 +595,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) sb->s_flags &= ~MS_RDONLY ; } +unlock_kernel ();return 0 ; }
fs/cifs/cifsfs.c +2 -0
@@ -564,7 +564,9 @@ static int cifs_show_stats(struct seq_file *s, struct vfsmount *mnt)static int cifs_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_NODIRATIME ; +unlock_kernel ();return 0 ; }
fs/coda/inode.c +2 -0
@@ -83,7 +83,9 @@ void coda_destroy_inodecache(void)static int coda_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_NOATIME ; +unlock_kernel ();return 0 ; }
fs/cramfs/inode.c +3 -0
@@ -23,6 +23,7 @@#include <linux/buffer_head.h> #include <linux/vfs.h> #include <linux/mutex.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h>
@@ -215,7 +216,9 @@ static void cramfs_put_super(struct super_block *sb)static int cramfs_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_RDONLY ; +unlock_kernel ();return 0 ; }
fs/devpts/inode.c +8 -2
@@ -23,6 +23,7 @@#include <linux/parser.h> #include <linux/fsnotify.h> #include <linux/seq_file.h> +#include <linux/smp_lock.h> #define DEVPTS_SUPER_MAGIC 0x1cd1
@@ -221,8 +222,12 @@ static inline void update_ptmx_mode(struct pts_fs_info *fsi)static int devpts_remount (struct super_block *sb,int *flags,char *data) {int err; -struct pts_fs_info *fsi =DEVPTS_SB (sb); -struct pts_mount_opts *opts = &fsi->mount_opts; +struct pts_fs_info *fsi; +struct pts_mount_opts *opts; + +lock_kernel (); + fsi =DEVPTS_SB (sb); + opts = &fsi->mount_opts; err =parse_mount_options (data,PARSE_REMOUNT , opts);
@@ -233,6 +238,7 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data)* so do this even on error return. */ update_ptmx_mode (fsi); +unlock_kernel ();return err; }
fs/efs/super.c +3 -0
@@ -12,6 +12,7 @@#include <linux/slab.h> #include <linux/buffer_head.h> #include <linux/vfs.h> +#include <linux/smp_lock.h> #include "efs.h" #include <linux/efs_vh.h>
@@ -101,7 +102,9 @@ static void efs_put_super(struct super_block *s)static int efs_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_RDONLY ; +unlock_kernel ();return 0 ; }
fs/ext2/super.c +14 -4
@@ -1149,13 +1149,17 @@ void ext2_write_super (struct super_block * sb)static int ext2_remount (struct super_block * sb,int * flags,char * data) { -struct ext2_sb_info * sbi =EXT2_SB (sb); +struct ext2_sb_info * sbi;struct ext2_super_block * es; -unsigned long old_mount_opt = sbi->s_mount_opt; +unsigned long old_mount_opt;struct ext2_mount_options old_opts;unsigned long old_sb_flags;int err; +lock_kernel (); + sbi =EXT2_SB (sb); + old_mount_opt = sbi->s_mount_opt; +/* Store the old options */ old_sb_flags = sb->s_flags; old_opts.s_mount_opt = sbi->s_mount_opt;
@@ -1191,12 +1195,16 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) sbi->s_mount_opt &= ~EXT2_MOUNT_XIP ; sbi->s_mount_opt |= old_mount_opt &EXT2_MOUNT_XIP ; } -if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) +if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) { +unlock_kernel ();return 0 ; + }if (*flags &MS_RDONLY ) {if (le16_to_cpu (es->s_state) &EXT2_VALID_FS || - !(sbi->s_mount_state &EXT2_VALID_FS )) + !(sbi->s_mount_state &EXT2_VALID_FS )) { +unlock_kernel ();return 0 ; + }/* * OK, we are remounting a valid rw partition rdonly, so set * the rdonly flag and then mark the partition as valid again.
@@ -1223,12 +1231,14 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) sb->s_flags &= ~MS_RDONLY ; }ext2_sync_super (sb, es); +unlock_kernel ();return 0 ; restore_opts: sbi->s_mount_opt = old_opts.s_mount_opt; sbi->s_resuid = old_opts.s_resuid; sbi->s_resgid = old_opts.s_resgid; sb->s_flags = old_sb_flags; +unlock_kernel ();return err; }
fs/ext3/super.c +6 -1
@@ -2499,7 +2499,7 @@ static int ext3_unfreeze(struct super_block *sb)static int ext3_remount (struct super_block * sb,int * flags,char * data) {struct ext3_super_block * es; -struct ext3_sb_info *sbi =EXT3_SB (sb); +struct ext3_sb_info *sbi;ext3_fsblk_t n_blocks_count =0 ;unsigned long old_sb_flags;struct ext3_mount_options old_opts;
@@ -2508,6 +2508,9 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)int i;#endif +lock_kernel (); + sbi =EXT3_SB (sb); +/* Store the original options */ old_sb_flags = sb->s_flags; old_opts.s_mount_opt = sbi->s_mount_opt;
@@ -2616,6 +2619,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) old_opts.s_qf_names[i] != sbi->s_qf_names[i])kfree (old_opts.s_qf_names[i]);#endif +unlock_kernel ();return 0 ; restore_opts: sb->s_flags = old_sb_flags;
@@ -2632,6 +2636,7 @@ restore_opts: sbi->s_qf_names[i] = old_opts.s_qf_names[i]; }#endif +unlock_kernel ();return err; }
fs/ext4/super.c +6 -1
@@ -3360,7 +3360,7 @@ static int ext4_unfreeze(struct super_block *sb)static int ext4_remount (struct super_block *sb,int *flags,char *data) {struct ext4_super_block *es; -struct ext4_sb_info *sbi =EXT4_SB (sb); +struct ext4_sb_info *sbi;ext4_fsblk_t n_blocks_count =0 ;unsigned long old_sb_flags;struct ext4_mount_options old_opts;
@@ -3371,6 +3371,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)int i;#endif +lock_kernel (); + sbi =EXT4_SB (sb); +/* Store the original options */ old_sb_flags = sb->s_flags; old_opts.s_mount_opt = sbi->s_mount_opt;
@@ -3514,6 +3517,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) old_opts.s_qf_names[i] != sbi->s_qf_names[i])kfree (old_opts.s_qf_names[i]);#endif +unlock_kernel ();return 0 ; restore_opts: sb->s_flags = old_sb_flags;
@@ -3532,6 +3536,7 @@ restore_opts: sbi->s_qf_names[i] = old_opts.s_qf_names[i]; }#endif +unlock_kernel ();return err; }
fs/fat/inode.c +4 -1
@@ -516,8 +516,11 @@ static void __exit fat_destroy_inodecache(void)static int fat_remount (struct super_block *sb,int *flags,char *data) { -struct msdos_sb_info *sbi =MSDOS_SB (sb); +struct msdos_sb_info *sbi; +lock_kernel (); + sbi =MSDOS_SB (sb); *flags |=MS_NODIRATIME | (sbi->options.isvfat ?0 :MS_NOATIME ); +unlock_kernel ();return 0 ; }
fs/freevxfs/vxfs_super.c +3 -0
@@ -41,6 +41,7 @@#include <linux/stat.h> #include <linux/vfs.h> #include <linux/mount.h> +#include <linux/smp_lock.h> #include "vxfs.h" #include "vxfs_extern.h"
@@ -125,7 +126,9 @@ vxfs_statfs(struct dentry *dentry, struct kstatfs *bufp)static int vxfs_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_RDONLY ; +unlock_kernel ();return 0 ; }
fs/fuse/inode.c +5 -1
@@ -110,9 +110,13 @@ static void fuse_clear_inode(struct inode *inode)static int fuse_remount_fs (struct super_block *sb,int *flags,char *data) { -if (*flags &MS_MANDLOCK ) +lock_kernel (); +if (*flags &MS_MANDLOCK ) { +unlock_kernel ();return -EINVAL ; + } +unlock_kernel ();return 0 ; }
fs/gfs2/ops_super.c +21 -6
@@ -20,6 +20,7 @@#include <linux/gfs2_ondisk.h> #include <linux/crc32.h> #include <linux/time.h> +#include <linux/smp_lock.h> #include "gfs2.h" #include "incore.h"
@@ -434,27 +435,37 @@ static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf)static int gfs2_remount_fs (struct super_block *sb,int *flags,char *data) { -struct gfs2_sbd *sdp = sb->s_fs_info; -struct gfs2_args args = sdp->sd_args;/* Default to current settings */ +struct gfs2_sbd *sdp; +struct gfs2_args args;int error; +lock_kernel (); + sdp = sb->s_fs_info; + args = sdp->sd_args;/* Default to current settings */ + error =gfs2_mount_args (sdp, &args, data); -if (error) +if (error) { +unlock_kernel ();return error; + }/* Not allowed to change locking details */ if (strcmp (args.ar_lockproto, sdp->sd_args.ar_lockproto) ||strcmp (args.ar_locktable, sdp->sd_args.ar_locktable) || -strcmp (args.ar_hostdata, sdp->sd_args.ar_hostdata)) +strcmp (args.ar_hostdata, sdp->sd_args.ar_hostdata)) { +unlock_kernel ();return -EINVAL ; + }/* Some flags must not be changed */ if (args_neq (&args, &sdp->sd_args, spectator) ||args_neq (&args, &sdp->sd_args, ignore_local_fs) ||args_neq (&args, &sdp->sd_args, localflocks) ||args_neq (&args, &sdp->sd_args, localcaching) || -args_neq (&args, &sdp->sd_args, meta)) +args_neq (&args, &sdp->sd_args, meta)) { +unlock_kernel ();return -EINVAL ; + }if (sdp->sd_args.ar_spectator) *flags |=MS_RDONLY ;
@@ -464,8 +475,10 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) error =gfs2_make_fs_ro (sdp); else error =gfs2_make_fs_rw (sdp); -if (error) +if (error) { +unlock_kernel ();return error; + } } sdp->sd_args = args;
@@ -473,6 +486,8 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) sb->s_flags |=MS_POSIXACL ; else sb->s_flags &= ~MS_POSIXACL; + +unlock_kernel ();return 0 ; }
fs/hfs/super.c +6 -1
@@ -20,6 +20,7 @@#include <linux/parser.h> #include <linux/seq_file.h> #include <linux/vfs.h> +#include <linux/smp_lock.h> #include "hfs_fs.h" #include "btree.h"
@@ -100,9 +101,12 @@ static int hfs_statfs(struct dentry *dentry, struct kstatfs *buf)static int hfs_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_NODIRATIME ; -if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) +if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) { +unlock_kernel ();return 0 ; + }if (!(*flags &MS_RDONLY )) {if (!(HFS_SB (sb)->mdb->drAtrb &cpu_to_be16 (HFS_SB_ATTRIB_UNMNT ))) { printk(KERN_WARNING "hfs: filesystem was not cleanly unmounted, "
@@ -115,6 +119,7 @@ static int hfs_remount(struct super_block *sb, int *flags, char *data) *flags |=MS_RDONLY ; } } +unlock_kernel ();return 0 ; }
fs/hfsplus/super.c +10 -2
@@ -14,6 +14,7 @@#include <linux/slab.h> #include <linux/vfs.h> #include <linux/nls.h> +#include <linux/smp_lock.h> static struct inode *hfsplus_alloc_inode (struct super_block *sb);static void hfsplus_destroy_inode (struct inode *inode);
@@ -241,16 +242,22 @@ static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf)static int hfsplus_remount (struct super_block *sb,int *flags,char *data) { -if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) +lock_kernel (); + +if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) { +unlock_kernel ();return 0 ; + }if (!(*flags &MS_RDONLY )) {struct hfsplus_vh *vhdr =HFSPLUS_SB (sb).s_vhdr;struct hfsplus_sb_info sbi;memset (&sbi,0 ,sizeof (struct hfsplus_sb_info )); sbi.nls =HFSPLUS_SB (sb).nls; -if (!hfsplus_parse_options (data, &sbi)) +if (!hfsplus_parse_options (data, &sbi)) { +unlock_kernel ();return -EINVAL ; + }if (!(vhdr->attributes &cpu_to_be32 (HFSPLUS_VOL_UNMNT ))) { printk(KERN_WARNING "hfs: filesystem was not cleanly unmounted, "
@@ -269,6 +276,7 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data) *flags |=MS_RDONLY ; } } +unlock_kernel ();return 0 ; }
fs/hpfs/super.c +7 -1
@@ -13,6 +13,7 @@#include <linux/statfs.h> #include <linux/magic.h> #include <linux/sched.h> +#include <linux/smp_lock.h> /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */
@@ -388,9 +389,12 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)umode_t umask;int lowercase, conv, eas, chk, errs, chkdsk, timeshift;int o; -struct hpfs_sb_info *sbi =hpfs_sb (s); +struct hpfs_sb_info *sbi;char *new_opts =kstrdup (data,GFP_KERNEL ); +lock_kernel (); + sbi =hpfs_sb (s); + *flags |=MS_NOATIME ; uid = sbi->sb_uid; gid = sbi->sb_gid;
@@ -426,10 +430,12 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)kfree (s->s_options); s->s_options = new_opts; +unlock_kernel ();return 0 ; out_err:kfree (new_opts); +unlock_kernel ();return -EINVAL ; }
fs/isofs/inode.c +3 -0
@@ -21,6 +21,7 @@#include <linux/statfs.h> #include <linux/cdrom.h> #include <linux/parser.h> +#include <linux/smp_lock.h> #include "isofs.h" #include "zisofs.h"
@@ -99,8 +100,10 @@ static void destroy_inodecache(void)static int isofs_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel ();/* we probably want a lot more here */ *flags |=MS_RDONLY ; +unlock_kernel ();return 0 ; }
fs/jffs2/fs.c +9 -2
@@ -20,6 +20,7 @@#include <linux/vmalloc.h> #include <linux/vfs.h> #include <linux/crc32.h> +#include <linux/smp_lock.h> #include "nodelist.h" static int jffs2_flash_setup (struct jffs2_sb_info *c);
@@ -378,10 +379,15 @@ void jffs2_dirty_inode(struct inode *inode)int jffs2_remount_fs (struct super_block *sb,int *flags,char *data) { -struct jffs2_sb_info *c =JFFS2_SB_INFO (sb); +struct jffs2_sb_info *c; -if (c->flags &JFFS2_SB_FLAG_RO && !(sb->s_flags &MS_RDONLY )) +lock_kernel (); + c =JFFS2_SB_INFO (sb); + +if (c->flags &JFFS2_SB_FLAG_RO && !(sb->s_flags &MS_RDONLY )) { +unlock_kernel ();return -EROFS ; + }/* We stop if it was running, then restart if it needs to. This also catches the case where it was stopped and this
@@ -399,6 +405,7 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data) *flags |=MS_NOATIME ; +unlock_kernel ();return 0 ; }
fs/jfs/super.c +22 -5
@@ -32,6 +32,7 @@#include <linux/crc32.h> #include <asm/uaccess.h> #include <linux/seq_file.h> +#include <linux/smp_lock.h> #include "jfs_incore.h" #include "jfs_filsys.h"
@@ -369,20 +370,28 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) {s64 newLVSize =0 ;int rc =0 ; -int flag =JFS_SBI (sb)->flag; +int flag; +int ret; + +lock_kernel (); + flag =JFS_SBI (sb)->flag;if (!parse_options (data, sb, &newLVSize, &flag)) { +unlock_kernel ();return -EINVAL ; }if (newLVSize) {if (sb->s_flags &MS_RDONLY ) {printk (KERN_ERR "JFS: resize requires volume to be mounted read-write\n" ); +unlock_kernel ();return -EROFS ; } rc =jfs_extendfs (sb, newLVSize,0 ); -if (rc) +if (rc) { +unlock_kernel ();return rc; + } }if ((sb->s_flags &MS_RDONLY ) && !(*flags &MS_RDONLY )) {
@@ -393,23 +402,31 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)truncate_inode_pages (JFS_SBI (sb)->direct_inode->i_mapping,0 );JFS_SBI (sb)->flag = flag; -return jfs_mount_rw (sb,1 ); + ret =jfs_mount_rw (sb,1 ); +unlock_kernel (); +return ret; }if ((!(sb->s_flags &MS_RDONLY )) && (*flags &MS_RDONLY )) { rc =jfs_umount_rw (sb);JFS_SBI (sb)->flag = flag; +unlock_kernel ();return rc; }if ((JFS_SBI (sb)->flag &JFS_NOINTEGRITY ) != (flag &JFS_NOINTEGRITY ))if (!(sb->s_flags &MS_RDONLY )) { rc =jfs_umount_rw (sb); -if (rc) +if (rc) { +unlock_kernel ();return rc; + }JFS_SBI (sb)->flag = flag; -return jfs_mount_rw (sb,1 ); + ret =jfs_mount_rw (sb,1 ); +unlock_kernel (); +return ret; }JFS_SBI (sb)->flag = flag; +unlock_kernel ();return 0 ; }
fs/minix/inode.c +11 -3
@@ -17,6 +17,7 @@#include <linux/init.h> #include <linux/highuid.h> #include <linux/vfs.h> +#include <linux/smp_lock.h> static int minix_write_inode (struct inode * inode,int wait);static int minix_statfs (struct dentry *dentry,struct kstatfs *buf);
@@ -104,16 +105,22 @@ static const struct super_operations minix_sops = {static int minix_remount (struct super_block * sb,int * flags,char * data) { -struct minix_sb_info * sbi =minix_sb (sb); +struct minix_sb_info * sbi;struct minix_super_block * ms; +lock_kernel (); + sbi =minix_sb (sb); ms = sbi->s_ms; -if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) +if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) { +unlock_kernel ();return 0 ; + }if (*flags &MS_RDONLY ) {if (ms->s_state &MINIX_VALID_FS || - !(sbi->s_mount_state &MINIX_VALID_FS )) + !(sbi->s_mount_state &MINIX_VALID_FS )) { +unlock_kernel ();return 0 ; + }/* Mounting a rw partition read-only. */ if (sbi->s_version !=MINIX_V3 ) ms->s_state = sbi->s_mount_state;
@@ -135,6 +142,7 @@ static int minix_remount (struct super_block * sb, int * flags, char * data)printk ("MINIX-fs warning: remounting fs with errors, " "running fsck is recommended\n" ); } +unlock_kernel ();return 0 ; }
fs/namespace.c +0 -2
@@ -1092,9 +1092,7 @@ static int do_umount(struct vfsmount *mnt, int flags)*/ down_write (&sb->s_umount);if (!(sb->s_flags &MS_RDONLY )) { -lock_kernel (); retval =do_remount_sb (sb,MS_RDONLY ,NULL ,0 ); -unlock_kernel (); }up_write (&sb->s_umount);return retval;
fs/ncpfs/inode.c +2 -0
@@ -91,7 +91,9 @@ static void destroy_inodecache(void)static int ncp_remount (struct super_block *sb,int *flags,char * data) { +lock_kernel (); *flags |=MS_NODIRATIME ; +unlock_kernel ();return 0 ; }
fs/nfs/super.c +15 -5
@@ -1792,10 +1792,15 @@ static int nfs_remount(struct super_block *sb, int *flags, char *raw_data) { int error; -struct nfs_server *nfss = sb->s_fs_info; +struct nfs_server *nfss;struct nfs_parsed_mount_data *data; -struct nfs_mount_data *options = (struct nfs_mount_data *)raw_data; -struct nfs4_mount_data *options4 = (struct nfs4_mount_data *)raw_data; +struct nfs_mount_data *options; +struct nfs4_mount_data *options4; + +lock_kernel (); + nfss = sb->s_fs_info; + options = (struct nfs_mount_data *)raw_data; + options4 = (struct nfs4_mount_data *)raw_data;u32 nfsvers = nfss->nfs_client->rpc_ops->version;/*
@@ -1806,12 +1811,16 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)*/ if ((nfsvers ==4 && (!options4 || options4->version ==1 )) || (nfsvers <=3 && (!options || (options->version >=1 && - options->version <=6 )))) + options->version <=6 )))) { +unlock_kernel ();return 0 ; + } data =kzalloc (sizeof (*data),GFP_KERNEL ); -if (data ==NULL ) +if (data ==NULL ) { +unlock_kernel ();return -ENOMEM ; + }/* fill out struct with values from existing mount */ data->flags = nfss->flags;
@@ -1837,6 +1846,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) error =nfs_compare_remount_data (nfss, data); out:kfree (data); +unlock_kernel ();return error; }
fs/nilfs2/super.c +8 -2
@@ -891,13 +891,17 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent,static int nilfs_remount (struct super_block *sb,int *flags,char *data) { -struct nilfs_sb_info *sbi =NILFS_SB (sb); +struct nilfs_sb_info *sbi;struct nilfs_super_block *sbp; -struct the_nilfs *nilfs = sbi->s_nilfs; +struct the_nilfs *nilfs;unsigned long old_sb_flags;struct nilfs_mount_options old_opts;int err; +lock_kernel (); + sbi =NILFS_SB (sb); + nilfs = sbi->s_nilfs; + old_sb_flags = sb->s_flags; old_opts.mount_opt = sbi->s_mount_opt; old_opts.snapshot_cno = sbi->s_snapshot_cno;
@@ -977,6 +981,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)up (&sb->s_bdev->bd_mount_sem); } out: +unlock_kernel ();return 0 ; rw_remount_failed:
@@ -985,6 +990,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data) sb->s_flags = old_sb_flags; sbi->s_mount_opt = old_opts.mount_opt; sbi->s_snapshot_cno = old_opts.snapshot_cno; +unlock_kernel ();return err; }
fs/ntfs/super.c +16 -2
@@ -440,9 +440,12 @@ static inline int ntfs_clear_volume_flags(ntfs_volume *vol, VOLUME_FLAGS flags)*/ static int ntfs_remount (struct super_block *sb,int *flags,char *opt) { -ntfs_volume *vol =NTFS_SB (sb); +ntfs_volume *vol;ntfs_debug ("Entering with remount options string: %s" , opt); + +lock_kernel (); + vol =NTFS_SB (sb);#ifndef NTFS_RW /* For read-only compiled driver, enforce read-only flag. */ *flags |=MS_RDONLY ;
@@ -466,15 +469,18 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)if (NVolErrors (vol)) {ntfs_error (sb,"Volume has errors and is read-only%s" , es); +unlock_kernel ();return -EROFS ; }if (vol->vol_flags &VOLUME_IS_DIRTY ) {ntfs_error (sb,"Volume is dirty and read-only%s" , es); +unlock_kernel ();return -EROFS ; }if (vol->vol_flags &VOLUME_MODIFIED_BY_CHKDSK ) {ntfs_error (sb,"Volume has been modified by chkdsk " "and is read-only%s" , es); +unlock_kernel ();return -EROFS ; }if (vol->vol_flags &VOLUME_MUST_MOUNT_RO_MASK ) {
@@ -482,11 +488,13 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)"(0x%x) and is read-only%s" , (unsigned )le16_to_cpu (vol->vol_flags), es); +unlock_kernel ();return -EROFS ; }if (ntfs_set_volume_flags (vol,VOLUME_IS_DIRTY )) {ntfs_error (sb,"Failed to set dirty bit in volume " "information flags%s" , es); +unlock_kernel ();return -EROFS ; }#if 0
@@ -506,18 +514,21 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)ntfs_error (sb,"Failed to empty journal $LogFile%s" , es);NVolSetErrors (vol); +unlock_kernel ();return -EROFS ; }if (!ntfs_mark_quotas_out_of_date (vol)) {ntfs_error (sb,"Failed to mark quotas out of date%s" , es);NVolSetErrors (vol); +unlock_kernel ();return -EROFS ; }if (!ntfs_stamp_usnjrnl (vol)) {ntfs_error (sb,"Failed to stamp transation log " "($UsnJrnl)%s" , es);NVolSetErrors (vol); +unlock_kernel ();return -EROFS ; } }else if (!(sb->s_flags &MS_RDONLY ) && (*flags &MS_RDONLY )) {
@@ -533,8 +544,11 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)// TODO: Deal with *flags. -if (!parse_options (vol, opt)) +if (!parse_options (vol, opt)) { +unlock_kernel ();return -EINVAL ; + } +unlock_kernel ();ntfs_debug ("Done." );return 0 ; }
fs/ocfs2/super.c +6 -1
@@ -42,6 +42,7 @@#include <linux/mount.h> #include <linux/seq_file.h> #include <linux/quotaops.h> +#include <linux/smp_lock.h> #define MLOG_MASK_PREFIX ML_SUPER#include <cluster/masklog.h>
@@ -593,7 +594,10 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data)int incompat_features;int ret =0 ;struct mount_options parsed_options; -struct ocfs2_super *osb =OCFS2_SB (sb); +struct ocfs2_super *osb; + +lock_kernel (); + osb =OCFS2_SB (sb);if (!ocfs2_parse_options (sb, data, &parsed_options,1 )) { ret = -EINVAL ;
@@ -698,6 +702,7 @@ unlock_osb:ocfs2_set_journal_params (osb); } out: +unlock_kernel ();return ret; }
fs/openpromfs/inode.c +3 -0
@@ -12,6 +12,7 @@#include <linux/slab.h> #include <linux/seq_file.h> #include <linux/magic.h> +#include <linux/smp_lock.h> #include <asm/openprom.h> #include <asm/oplib.h>
@@ -369,7 +370,9 @@ static struct inode *openprom_iget(struct super_block *sb, ino_t ino)static int openprom_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_NOATIME ; +unlock_kernel ();return 0 ; }
fs/qnx4/inode.c +3 -0
@@ -146,17 +146,20 @@ static int qnx4_remount(struct super_block *sb, int *flags, char *data) {struct qnx4_sb_info *qs; +lock_kernel (); qs =qnx4_sb (sb); qs->Version =QNX4_VERSION ;#ifndef CONFIG_QNX4FS_RW *flags |=MS_RDONLY ;#endif if (*flags &MS_RDONLY ) { +unlock_kernel ();return 0 ; }mark_buffer_dirty (qs->sb_buf); +unlock_kernel ();return 0 ; }
fs/reiserfs/super.c +10 -2
@@ -28,6 +28,7 @@#include <linux/mount.h> #include <linux/namei.h> #include <linux/crc32.h> +#include <linux/smp_lock.h> struct file_system_type reiserfs_fs_type;
@@ -1181,17 +1182,22 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)struct reiserfs_super_block *rs;struct reiserfs_transaction_handle th;unsigned long blocks; -unsigned long mount_options =REISERFS_SB (s)->s_mount_opt; +unsigned long mount_options;unsigned long safe_mask =0 ;unsigned int commit_max_age = (unsigned int )-1 ; -struct reiserfs_journal *journal =SB_JOURNAL (s); +struct reiserfs_journal *journal;char *new_opts =kstrdup (arg,GFP_KERNEL );int err;char *qf_names[MAXQUOTAS ];unsigned int qfmt =0 ;#ifdef CONFIG_QUOTA int i; +#endif +lock_kernel (); + mount_options =REISERFS_SB (s)->s_mount_opt; + journal =SB_JOURNAL (s); +#ifdef CONFIG_QUOTA memcpy (qf_names,REISERFS_SB (s)->s_qf_names,sizeof (qf_names));#endif
@@ -1318,10 +1324,12 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) out_ok:kfree (s->s_options); s->s_options = new_opts; +unlock_kernel ();return 0 ; out_err:kfree (new_opts); +unlock_kernel ();return err; }
fs/romfs/super.c +3 -0
@@ -72,6 +72,7 @@#include <linux/highmem.h> #include <linux/pagemap.h> #include <linux/uaccess.h> +#include <linux/smp_lock.h> #include "internal.h" static struct kmem_cache *romfs_inode_cachep;
@@ -427,7 +428,9 @@ static int romfs_statfs(struct dentry *dentry, struct kstatfs *buf)*/ static int romfs_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_RDONLY ; +unlock_kernel ();return 0 ; }
fs/smbfs/inode.c +2 -0
@@ -93,7 +93,9 @@ static void destroy_inodecache(void)static int smb_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_NODIRATIME ; +unlock_kernel ();return 0 ; }
fs/squashfs/super.c +3 -0
@@ -36,6 +36,7 @@#include <linux/module.h> #include <linux/zlib.h> #include <linux/magic.h> +#include <linux/smp_lock.h> #include "squashfs_fs.h" #include "squashfs_fs_sb.h"
@@ -321,7 +322,9 @@ static int squashfs_statfs(struct dentry *dentry, struct kstatfs *buf)static int squashfs_remount (struct super_block *sb,int *flags,char *data) { +lock_kernel (); *flags |=MS_RDONLY ; +unlock_kernel ();return 0 ; }
fs/super.c +0 -4
@@ -686,13 +686,9 @@ static void do_emergency_remount(struct work_struct *work)down_read (&sb->s_umount);if (sb->s_root && sb->s_bdev && !(sb->s_flags &MS_RDONLY )) {/* -* ->remount_fs needs lock_kernel(). -* * What lock protects sb->s_flags?? */ -lock_kernel ();do_remount_sb (sb,MS_RDONLY ,NULL ,1 ); -unlock_kernel (); }drop_super (sb);spin_lock (&sb_lock);
fs/sysv/inode.c +6 -1
@@ -28,6 +28,7 @@#include <linux/buffer_head.h> #include <linux/vfs.h> #include <linux/namei.h> +#include <linux/smp_lock.h> #include <asm/byteorder.h> #include "sysv.h"
@@ -60,11 +61,15 @@ clean: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; + +lock_kernel (); + sbi =SYSV_SB (sb);if (sbi->s_forced_ro) *flags |=MS_RDONLY ;if (!(*flags &MS_RDONLY )) sb->s_dirt =1 ; +unlock_kernel ();return 0 ; }
fs/ubifs/super.c +11 -2
@@ -36,6 +36,7 @@#include <linux/mount.h> #include <linux/math64.h> #include <linux/writeback.h> +#include <linux/smp_lock.h> #include "ubifs.h" /*
@@ -1758,27 +1759,34 @@ static void ubifs_put_super(struct super_block *sb)static int ubifs_remount_fs (struct super_block *sb,int *flags,char *data) {int err; -struct ubifs_info *c = sb->s_fs_info; +struct ubifs_info *c;dbg_gen ("old flags %#lx, new flags %#x" , sb->s_flags, *flags); +lock_kernel (); + c = sb->s_fs_info; err =ubifs_parse_options (c, data,1 );if (err) {ubifs_err ("invalid or unknown remount parameter" ); +unlock_kernel ();return err; }if ((sb->s_flags &MS_RDONLY ) && !(*flags &MS_RDONLY )) {if (c->ro_media) {ubifs_msg ("cannot re-mount due to prior errors" ); +unlock_kernel ();return -EROFS ; } err =ubifs_remount_rw (c); -if (err) +if (err) { +unlock_kernel ();return err; + } }else if (!(sb->s_flags &MS_RDONLY ) && (*flags &MS_RDONLY )) {if (c->ro_media) {ubifs_msg ("cannot re-mount due to prior errors" ); +unlock_kernel ();return -EROFS ; }ubifs_remount_ro (c);
@@ -1793,6 +1801,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) }ubifs_assert (c->lst.taken_empty_lebs >0 ); +unlock_kernel ();return 0 ; }
fs/udf/super.c +10 -3
@@ -556,8 +556,10 @@ static int udf_parse_options(char *options, struct udf_options *uopt,static int udf_remount_fs (struct super_block *sb,int *flags,char *options) {struct udf_options uopt; -struct udf_sb_info *sbi =UDF_SB (sb); +struct udf_sb_info *sbi; +lock_kernel (); + sbi =UDF_SB (sb); uopt.flags = sbi->s_flags; uopt.uid = sbi->s_uid; uopt.gid = sbi->s_gid;
@@ -565,8 +567,10 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options) uopt.fmode = sbi->s_fmode; uopt.dmode = sbi->s_dmode; -if (!udf_parse_options (options, &uopt, true)) +if (!udf_parse_options (options, &uopt, true)) { +unlock_kernel ();return -EINVAL ; + } sbi->s_flags = uopt.flags; sbi->s_uid = uopt.uid;
@@ -581,13 +585,16 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options) *flags |=MS_RDONLY ; } -if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) +if ((*flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) { +unlock_kernel ();return 0 ; + }if (*flags &MS_RDONLY )udf_close_lvid (sb);else udf_open_lvid (sb); +unlock_kernel ();return 0 ; }
fs/ufs/super.c +10 -1
@@ -1172,6 +1172,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)unsigned new_mount_opt, ufstype;unsigned flags; +lock_kernel (); uspi =UFS_SB (sb)->s_uspi; flags =UFS_SB (sb)->s_flags; usb1 =ubh_get_usb_first (uspi);
@@ -1184,17 +1185,21 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) ufstype =UFS_SB (sb)->s_mount_opt &UFS_MOUNT_UFSTYPE ; new_mount_opt =0 ;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_kernel ();return -EINVAL ; + }if (!(new_mount_opt &UFS_MOUNT_UFSTYPE )) { new_mount_opt |= ufstype; }else if ((new_mount_opt &UFS_MOUNT_UFSTYPE ) != ufstype) {printk ("ufstype can't be changed during remount\n" ); +unlock_kernel ();return -EINVAL ; }if ((*mount_flags &MS_RDONLY ) == (sb->s_flags &MS_RDONLY )) {UFS_SB (sb)->s_mount_opt = new_mount_opt; +unlock_kernel ();return 0 ; }
@@ -1219,6 +1224,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)#ifndef CONFIG_UFS_FS_WRITE printk ("ufs was compiled with read-only support, " "can't be mounted as read-write\n" ); +unlock_kernel ();return -EINVAL ;#else if (ufstype != UFS_MOUNT_UFSTYPE_SUN &&
@@ -1227,16 +1233,19 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && ufstype != UFS_MOUNT_UFSTYPE_UFS2) {printk ("this ufstype is read-only supported\n" ); +unlock_kernel ();return -EINVAL ; }if (!ufs_read_cylinder_structures (sb)) {printk ("failed during remounting\n" ); +unlock_kernel ();return -EPERM ; } sb->s_flags &= ~MS_RDONLY ;#endif }UFS_SB (sb)->s_mount_opt = new_mount_opt; +unlock_kernel ();return 0 ; }
fs/xfs/linux-2.6/xfs_super.c +6 -1
@@ -67,6 +67,7 @@#include <linux/kthread.h> #include <linux/freezer.h> #include <linux/parser.h> +#include <linux/smp_lock.h> static struct super_operations xfs_super_operations;static kmem_zone_t *xfs_ioend_zone;
@@ -1206,11 +1207,13 @@ xfs_fs_remount(int *flags, char *options) { - struct xfs_mount *mp = XFS_M(sb); + struct xfs_mount *mp;substring_t args[MAX_OPT_ARGS ];char *p;int error; +lock_kernel (); + mp =XFS_M (sb);while ((p =strsep (&options,"," )) !=NULL ) {int token;
@@ -1275,6 +1278,7 @@ xfs_fs_remount(if (error) {cmn_err (CE_WARN ,"XFS: failed to write sb changes" ); +unlock_kernel ();return error; } mp->m_update_flags =0 ;
@@ -1288,6 +1292,7 @@ xfs_fs_remount( mp->m_flags |=XFS_MOUNT_RDONLY ; } +unlock_kernel ();return 0 ; }
kernel/cgroup.c +7 -2
@@ -46,6 +46,7 @@#include <linux/cgroupstats.h> #include <linux/hash.h> #include <linux/namei.h> +#include <linux/smp_lock.h> #include <asm/atomic.h>
@@ -896,10 +897,13 @@ static int parse_cgroupfs_options(char *data,static int cgroup_remount (struct super_block *sb,int *flags,char *data) {int ret =0 ; -struct cgroupfs_root *root = sb->s_fs_info; -struct cgroup *cgrp = &root->top_cgroup; +struct cgroupfs_root *root; +struct cgroup *cgrp;struct cgroup_sb_opts opts; +lock_kernel (); + root = sb->s_fs_info; + cgrp = &root->top_cgroup;mutex_lock (&cgrp->dentry->d_inode->i_mutex);mutex_lock (&cgroup_mutex);
@@ -927,6 +931,7 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data)kfree (opts.release_agent);mutex_unlock (&cgroup_mutex);mutex_unlock (&cgrp->dentry->d_inode->i_mutex); +unlock_kernel ();return ret; }
mm/shmem.c +10 -3
@@ -30,6 +30,7 @@#include <linux/module.h> #include <linux/swap.h> #include <linux/ima.h> +#include <linux/smp_lock.h> static struct vfsmount *shm_mnt;
@@ -2227,14 +2228,19 @@ bad_val:static int shmem_remount_fs (struct super_block *sb,int *flags,char *data) { -struct shmem_sb_info *sbinfo =SHMEM_SB (sb); -struct shmem_sb_info config = *sbinfo; +struct shmem_sb_info *sbinfo; +struct shmem_sb_info config;unsigned long blocks;unsigned long inodes;int error = -EINVAL ; -if (shmem_parse_options (data, &config, true)) +lock_kernel (); + sbinfo =SHMEM_SB (sb); + config = *sbinfo; +if (shmem_parse_options (data, &config, true)) { +unlock_kernel ();return error; + }spin_lock (&sbinfo->stat_lock); blocks = sbinfo->max_blocks - sbinfo->free_blocks;
@@ -2264,6 +2270,7 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) sbinfo->mpol = config.mpol;/* transfers initial ref */ out:spin_unlock (&sbinfo->stat_lock); +unlock_kernel ();return error; }
Signature · 1 line
1.6.0.4
Quoted 1 line · Alessio Igor Bogani
Push BKL down into ->remount_fs()
Please also push down lock_super, no need to have two locking changes in this area just after another.
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Alessio Igor Bogani
Push BKL down into ->remount_fs()
Please also push down
lock_super, no need to have two locking changes in this area just after another.
Do you plan to do that respin? I will need the lock_super pushdown for some sync work. I can wait for you if you plan to submit it, otherwise I'll out it on my TODO list.
Dear Sir Hellwig,
2009/5/5 Christoph Hellwig <[email protected]>:
Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Alessio Igor Bogani
Quoted 1 line
Push BKL down into ->remount_fs()
Please also push down
lock_super, no need to have two locking changes in this area just after another.Do you plan to do that respin? I will need the
lock_superpushdown for some sync work. I can wait for you if you plan to submit it, otherwise I'll out it on my TODO list.
Apologize I have completely missed your first replay.
Let me two days for finish that task and for do build and boot tests.
Thanks!
Ciao,
Alessio
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Alessio Igor Bogani
Quoted 6 lines
Quoted 2 lines
Please also push down
lock_super, no need to have two locking changes in this area just after another.Do you plan to do that respin? ?I will need the
lock_superpushdown for some sync work. ?I can wait for you if you plan to submit it, otherwise I'll out it on my TODO list.Apologize I have completely missed your first replay.
Let me two days for finish that task and for do build and boot tests.
Great! Thanks a lot for the effort.
Al Viro
maintainerQuoted 8 lines · Christoph Hellwig
Quoted 7 lines · Alessio Igor Bogani
Quoted 6 lines
Quoted 2 lines
Please also push down
lock_super, no need to have two locking changes in this area just after another.Do you plan to do that respin? ?I will need the
lock_superpushdown for some sync work. ?I can wait for you if you plan to submit it, otherwise I'll out it on my TODO list.
Quoted 5 lines
Quoted 3 lines
Apologize I have completely missed your first replay.
Let me two days for finish that task and for do build and boot tests.
Great! Thanks a lot for the effort.
Actually, I'm not sure that you are right. Especially if we go for your "always hold s_umount for sync_filesystem()"; in that case we are guaranteed that we'll have an exclusion between ->write_super() and that sucker, so there's no reason to push it down into filesystems that do not use lock_super() at all. And that'd be most of them...
Note that I've taken all callers of remount under exclusive s_umount (see #untested in the vfs tree).
Quoted 4 lines · Al Viro
Actually, I'm not sure that you are right. Especially if we go for your "always hold
s_umountforsync_filesystem()"; in that case we are guaranteed that we'll have an exclusion between ->write_super() and that sucker, so there's no reason to push it down into filesystems that do not uselock_super()
The interesting cases are locking against internal s_lock which at least extN needs or ->write_super. And I'd really be rather safe than sorry and audit individual filesystems than introducing bug in an obscure one.
Al Viro
maintainerQuoted 9 lines · Christoph Hellwig
Quoted 4 lines · Al Viro
Actually, I'm not sure that you are right. Especially if we go for your "always hold
s_umountforsync_filesystem()"; in that case we are guaranteed that we'll have an exclusion between ->write_super() and that sucker, so there's no reason to push it down into filesystems that do not uselock_super()The interesting cases are locking against internal
s_lockwhich at least extN needs or ->write_super. And I'd really be rather safe than sorry and audit individual filesystems than introducing bug in an obscure one.
write_super() can *not* get contention against remount. That's the point. And other that write_super, we have very few filesystems that even mention lock_super() anywhere. Yes, ext3 and ext4. Also fat, sysv, ufs and hpfs. That's it. Compare with the number of suckers that have write_super() and especially remount_fs()...