#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"
                return -EINVAL;
        }
 
+       lock_kernel();
+
        if (usbfs_mount && usbfs_mount->mnt_sb)
                update_sb(usbfs_mount->mnt_sb);
 
+       unlock_kernel();
+
        return 0;
 }
 
 
 #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;
                kfree(new_opts);
                return -EINVAL;
        }
+       lock_kernel();
        replace_mount_options(sb, new_opts);
 
        sbi->s_flags = mount_flags;
        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)
        } else
                res = affs_init_bitmap(sb, flags);
 
+       unlock_kernel();
        return res;
 }
 
 
        unsigned long old_sb_flags;
        int err;
 
+       lock_kernel();
+
        /* Store the old options */
        old_sb_flags = sb->s_flags;
        old_opts.s_mount_opt = sbi->s_mount_opt;
                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.
                        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;
 }
 
 
        int i;
 #endif
 
+       lock_kernel();
+
        /* Store the original options */
        lock_super(sb);
        old_sb_flags = sb->s_flags;
                        kfree(old_opts.s_qf_names[i]);
 #endif
        unlock_super(sb);
+       unlock_kernel();
        return 0;
 restore_opts:
        sb->s_flags = old_sb_flags;
        }
 #endif
        unlock_super(sb);
+       unlock_kernel();
        return err;
 }
 
 
        int i;
 #endif
 
+       lock_kernel();
+
        /* Store the original options */
        lock_super(sb);
        old_sb_flags = sb->s_flags;
                        kfree(old_opts.s_qf_names[i]);
 #endif
        unlock_super(sb);
+       unlock_kernel();
        return 0;
 
 restore_opts:
        }
 #endif
        unlock_super(sb);
+       unlock_kernel();
        return err;
 }
 
 
 #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 */
 
        
        *flags |= MS_NOATIME;
        
+       lock_kernel();
        lock_super(s);
        uid = sbi->sb_uid; gid = sbi->sb_gid;
        umask = 0777 & ~sbi->sb_mode;
        replace_mount_options(s, new_opts);
 
        unlock_super(s);
+       unlock_kernel();
        return 0;
 
 out_err:
        unlock_super(s);
+       unlock_kernel();
        kfree(new_opts);
        return -EINVAL;
 }
 
 #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);
           This also catches the case where it was stopped and this
           is just a remount to restart it.
           Flush the writebuffer, if neccecary, else we loose it */
+       lock_kernel();
        if (!(sb->s_flags & MS_RDONLY)) {
                jffs2_stop_garbage_collect_thread(c);
                mutex_lock(&c->alloc_sem);
 
        *flags |= MS_NOATIME;
 
+       unlock_kernel();
        return 0;
 }
 
 
 #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"
        s64 newLVSize = 0;
        int rc = 0;
        int flag = JFS_SBI(sb)->flag;
+       int ret;
 
        if (!parse_options(data, sb, &newLVSize, &flag)) {
                return -EINVAL;
        }
+       lock_kernel();
        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)) {
                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;
 }
 
 
        if (data == NULL)
                return -ENOMEM;
 
+       lock_kernel();
        /* fill out struct with values from existing mount */
        data->flags = nfss->flags;
        data->rsize = nfss->rsize;
        error = nfs_compare_remount_data(nfss, data);
 out:
        kfree(data);
+       unlock_kernel();
        return error;
 }
 
 
        struct nilfs_mount_options old_opts;
        int err;
 
+       lock_kernel();
+
        old_sb_flags = sb->s_flags;
        old_opts.mount_opt = sbi->s_mount_opt;
        old_opts.snapshot_cno = sbi->s_snapshot_cno;
                up(&sb->s_bdev->bd_mount_sem);
        }
  out:
+       unlock_kernel();
        return 0;
 
  rw_remount_failed:
        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;
 }
 
 
        ntfs_volume *vol = NTFS_SB(sb);
 
        ntfs_debug("Entering with remount options string: %s", opt);
+
+       lock_kernel();
 #ifndef NTFS_RW
        /* For read-only compiled driver, enforce read-only flag. */
        *flags |= MS_RDONLY;
                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) {
                                        "(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
                        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)) {
 
        // 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;
 }
 
 #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>
        struct mount_options parsed_options;
        struct ocfs2_super *osb = OCFS2_SB(sb);
 
+       lock_kernel();
+
        if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) {
                ret = -EINVAL;
                goto out;
                        ocfs2_set_journal_params(osb);
        }
 out:
+       unlock_kernel();
        return ret;
 }
 
 
 #include <linux/mount.h>
 #include <linux/namei.h>
 #include <linux/crc32.h>
+#include <linux/smp_lock.h>
 
 struct file_system_type reiserfs_fs_type;
 
        memcpy(qf_names, REISERFS_SB(s)->s_qf_names, sizeof(qf_names));
 #endif
 
+       lock_kernel();
        rs = SB_DISK_SUPER_BLOCK(s);
 
        if (!reiserfs_parse_options
 
 out_ok:
        replace_mount_options(s, new_opts);
+       unlock_kernel();
        return 0;
 
 out_err:
        kfree(new_opts);
+       unlock_kernel();
        return err;
 }
 
 
        shrink_dcache_sb(sb);
        sync_filesystem(sb);
 
-       lock_kernel();
        /* If we are remounting RDONLY and current sb is read/write,
           make sure there are no rw files opened */
        if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) {
                }
        }
        sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
-       unlock_kernel();
        if (remount_rw)
                vfs_dq_quota_on_remount(sb);
        return 0;
 
 #include <linux/mount.h>
 #include <linux/math64.h>
 #include <linux/writeback.h>
+#include <linux/smp_lock.h>
 #include "ubifs.h"
 
 /*
                return err;
        }
 
+       lock_kernel();
        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);
        }
 
        ubifs_assert(c->lst.taken_empty_lebs > 0);
+       unlock_kernel();
        return 0;
 }
 
 
        if (!udf_parse_options(options, &uopt, true))
                return -EINVAL;
 
+       lock_kernel();
        sbi->s_flags = uopt.flags;
        sbi->s_uid   = uopt.uid;
        sbi->s_gid   = uopt.gid;
                        *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;
 }
 
 
        struct ufs_super_block_first * usb1;
        va_list args;
        
+       lock_kernel();
        uspi = UFS_SB(sb)->s_uspi;
        usb1 = ubh_get_usb_first(uspi);
        
        struct ufs_super_block_third * usb3;
        unsigned new_mount_opt, ufstype;
        unsigned flags;
-       
+
+       lock_kernel();
        lock_super(sb);
        uspi = UFS_SB(sb)->s_uspi;
        flags = UFS_SB(sb)->s_flags;
        ufs_set_opt (new_mount_opt, ONERROR_LOCK);
        if (!ufs_parse_options (data, &new_mount_opt)) {
                unlock_super(sb);
+               unlock_kernel();
                return -EINVAL;
        }
        if (!(new_mount_opt & UFS_MOUNT_UFSTYPE)) {
        } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) {
                printk("ufstype can't be changed during remount\n");
                unlock_super(sb);
+               unlock_kernel();
                return -EINVAL;
        }
 
        if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
                UFS_SB(sb)->s_mount_opt = new_mount_opt;
                unlock_super(sb);
+               unlock_kernel();
                return 0;
        }
        
                printk("ufs was compiled with read-only support, "
                "can't be mounted as read-write\n");
                unlock_super(sb);
+               unlock_kernel();
                return -EINVAL;
 #else
                if (ufstype != UFS_MOUNT_UFSTYPE_SUN && 
                    ufstype != UFS_MOUNT_UFSTYPE_UFS2) {
                        printk("this ufstype is read-only supported\n");
                        unlock_super(sb);
+                       unlock_kernel();
                        return -EINVAL;
                }
                if (!ufs_read_cylinder_structures(sb)) {
                        printk("failed during remounting\n");
                        unlock_super(sb);
+                       unlock_kernel();
                        return -EPERM;
                }
                sb->s_flags &= ~MS_RDONLY;
        }
        UFS_SB(sb)->s_mount_opt = new_mount_opt;
        unlock_super(sb);
+       unlock_kernel();
        return 0;
 }
 
 
 #include <linux/cgroupstats.h>
 #include <linux/hash.h>
 #include <linux/namei.h>
+#include <linux/smp_lock.h>
 
 #include <asm/atomic.h>
 
        struct cgroup *cgrp = &root->top_cgroup;
        struct cgroup_sb_opts opts;
 
+       lock_kernel();
        mutex_lock(&cgrp->dentry->d_inode->i_mutex);
        mutex_lock(&cgroup_mutex);
 
        kfree(opts.release_agent);
        mutex_unlock(&cgroup_mutex);
        mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
+       unlock_kernel();
        return ret;
 }