Merge git://git.infradead.org/mtd-2.6
[pandora-kernel.git] / fs / jfs / super.c
index d9b0e92..09b1b6e 100644 (file)
@@ -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"
@@ -183,6 +184,9 @@ static void jfs_put_super(struct super_block *sb)
        int rc;
 
        jfs_info("In jfs_put_super");
+
+       lock_kernel();
+
        rc = jfs_umount(sb);
        if (rc)
                jfs_err("jfs_umount failed with return code %d", rc);
@@ -195,6 +199,8 @@ static void jfs_put_super(struct super_block *sb)
        sbi->direct_inode = NULL;
 
        kfree(sbi);
+
+       unlock_kernel();
 }
 
 enum {
@@ -370,19 +376,24 @@ 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 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)) {
@@ -393,23 +404,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;
 }