Merge commit 'v2.6.30' into for-2.6.31
[safe/jmp/linux-2.6] / fs / afs / super.c
index 8d47ad8..76828e5 100644 (file)
@@ -10,7 +10,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  * Authors: David Howells <dhowells@redhat.com>
- *          David Woodhouse <dwmw2@redhat.com>
+ *          David Woodhouse <dwmw2@infradead.org>
  *
  */
 
 #include <linux/pagemap.h>
 #include <linux/parser.h>
 #include <linux/statfs.h>
+#include <linux/sched.h>
 #include "internal.h"
 
 #define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
 
-static void afs_i_init_once(void *foo, struct kmem_cache *cachep,
-                           unsigned long flags);
+static void afs_i_init_once(void *foo);
 static int afs_get_sb(struct file_system_type *fs_type,
                      int flags, const char *dev_name,
                      void *data, struct vfsmount *mnt);
@@ -50,8 +50,8 @@ static const struct super_operations afs_super_ops = {
        .write_inode    = afs_write_inode,
        .destroy_inode  = afs_destroy_inode,
        .clear_inode    = afs_clear_inode,
-       .umount_begin   = afs_umount_begin,
        .put_super      = afs_put_super,
+       .show_options   = generic_show_options,
 };
 
 static struct kmem_cache *afs_inode_cachep;
@@ -64,7 +64,7 @@ enum {
        afs_opt_vol,
 };
 
-static match_table_t afs_options_list = {
+static const match_table_t afs_options_list = {
        { afs_opt_cell,         "cell=%s"       },
        { afs_opt_rwpath,       "rwpath"        },
        { afs_opt_vol,          "vol=%s"        },
@@ -88,8 +88,7 @@ int __init afs_fs_init(void)
                                             sizeof(struct afs_vnode),
                                             0,
                                             SLAB_HWCACHE_ALIGN,
-                                            afs_i_init_once,
-                                            NULL);
+                                            afs_i_init_once);
        if (!afs_inode_cachep) {
                printk(KERN_NOTICE "kAFS: Failed to allocate inode cache\n");
                return ret;
@@ -358,6 +357,7 @@ static int afs_get_sb(struct file_system_type *fs_type,
        struct super_block *sb;
        struct afs_volume *vol;
        struct key *key;
+       char *new_opts = kstrdup(options, GFP_KERNEL);
        int ret;
 
        _enter(",,%s,%p", dev_name, options);
@@ -405,10 +405,10 @@ static int afs_get_sb(struct file_system_type *fs_type,
                sb->s_flags = flags;
                ret = afs_fill_super(sb, &params);
                if (ret < 0) {
-                       up_write(&sb->s_umount);
-                       deactivate_super(sb);
+                       deactivate_locked_super(sb);
                        goto error;
                }
+               save_mount_options(sb, new_opts);
                sb->s_flags |= MS_ACTIVE;
        } else {
                _debug("reuse");
@@ -418,6 +418,7 @@ static int afs_get_sb(struct file_system_type *fs_type,
        simple_set_mnt(mnt, sb);
        afs_put_volume(params.volume);
        afs_put_cell(params.cell);
+       kfree(new_opts);
        _leave(" = 0 [%p]", sb);
        return 0;
 
@@ -425,6 +426,7 @@ error:
        afs_put_volume(params.volume);
        afs_put_cell(params.cell);
        key_put(params.key);
+       kfree(new_opts);
        _leave(" = %d", ret);
        return ret;
 }
@@ -446,8 +448,7 @@ static void afs_put_super(struct super_block *sb)
 /*
  * initialise an inode cache slab element prior to any use
  */
-static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
-                           unsigned long flags)
+static void afs_i_init_once(void *_vnode)
 {
        struct afs_vnode *vnode = _vnode;
 
@@ -459,6 +460,9 @@ static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
        spin_lock_init(&vnode->writeback_lock);
        spin_lock_init(&vnode->lock);
        INIT_LIST_HEAD(&vnode->writebacks);
+       INIT_LIST_HEAD(&vnode->pending_locks);
+       INIT_LIST_HEAD(&vnode->granted_locks);
+       INIT_DELAYED_WORK(&vnode->lock_work, afs_lock_work);
        INIT_WORK(&vnode->cb_broken_work, afs_broken_callback_work);
 }