switch reiserfs to usual conventions for caching ACLs
[pandora-kernel.git] / fs / reiserfs / super.c
index 1b52daa..b194451 100644 (file)
@@ -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;
 
@@ -64,18 +65,15 @@ static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf);
 
 static int reiserfs_sync_fs(struct super_block *s, int wait)
 {
-       if (!(s->s_flags & MS_RDONLY)) {
-               struct reiserfs_transaction_handle th;
-               reiserfs_write_lock(s);
-               if (!journal_begin(&th, s, 1))
-                       if (!journal_end_sync(&th, s, 1))
-                               reiserfs_flush_old_commits(s);
-               s->s_dirt = 0;  /* Even if it's not true.
-                                * We'll loop forever in sync_supers otherwise */
-               reiserfs_write_unlock(s);
-       } else {
-               s->s_dirt = 0;
-       }
+       struct reiserfs_transaction_handle th;
+
+       reiserfs_write_lock(s);
+       if (!journal_begin(&th, s, 1))
+               if (!journal_end_sync(&th, s, 1))
+                       reiserfs_flush_old_commits(s);
+       s->s_dirt = 0;  /* Even if it's not true.
+                        * We'll loop forever in sync_supers otherwise */
+       reiserfs_write_unlock(s);
        return 0;
 }
 
@@ -468,6 +466,8 @@ static void reiserfs_put_super(struct super_block *s)
        struct reiserfs_transaction_handle th;
        th.t_trans_id = 0;
 
+       lock_kernel();
+
        if (s->s_dirt)
                reiserfs_write_super(s);
 
@@ -503,7 +503,7 @@ static void reiserfs_put_super(struct super_block *s)
        kfree(s->s_fs_info);
        s->s_fs_info = NULL;
 
-       return;
+       unlock_kernel();
 }
 
 static struct kmem_cache *reiserfs_inode_cachep;
@@ -530,8 +530,8 @@ static void init_once(void *foo)
        INIT_LIST_HEAD(&ei->i_prealloc_list);
        inode_init_once(&ei->vfs_inode);
 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
-       ei->i_acl_access = NULL;
-       ei->i_acl_default = NULL;
+       ei->i_acl_access = ACL_NOT_CACHED;
+       ei->i_acl_default = ACL_NOT_CACHED;
 #endif
 }
 
@@ -586,14 +586,14 @@ static void reiserfs_clear_inode(struct inode *inode)
        struct posix_acl *acl;
 
        acl = REISERFS_I(inode)->i_acl_access;
-       if (acl && !IS_ERR(acl))
+       if (acl && acl != ACL_NOT_CACHED)
                posix_acl_release(acl);
-       REISERFS_I(inode)->i_acl_access = NULL;
+       REISERFS_I(inode)->i_acl_access = ACL_NOT_CACHED;
 
        acl = REISERFS_I(inode)->i_acl_default;
-       if (acl && !IS_ERR(acl))
+       if (acl && acl != ACL_NOT_CACHED)
                posix_acl_release(acl);
-       REISERFS_I(inode)->i_acl_default = NULL;
+       REISERFS_I(inode)->i_acl_default = ACL_NOT_CACHED;
 }
 #else
 #define reiserfs_clear_inode NULL
@@ -1197,6 +1197,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
        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
@@ -1319,10 +1320,12 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
 
 out_ok:
        replace_mount_options(s, new_opts);
+       unlock_kernel();
        return 0;
 
 out_err:
        kfree(new_opts);
+       unlock_kernel();
        return err;
 }