NFSv4: Fix up the return values of nfs4_open_delegation_recall
[linux-2.6-block.git] / fs / nfs / super.c
index aa5315bb3666817657e01323e84cb36c8c9f0078..befbae0cce41748b07d02ccbda71afc4c9a91c82 100644 (file)
@@ -54,7 +54,6 @@
 #include <linux/parser.h>
 #include <linux/nsproxy.h>
 #include <linux/rcupdate.h>
-#include <linux/kthread.h>
 
 #include <asm/uaccess.h>
 
@@ -418,54 +417,6 @@ void nfs_sb_deactive(struct super_block *sb)
 }
 EXPORT_SYMBOL_GPL(nfs_sb_deactive);
 
-static int nfs_deactivate_super_async_work(void *ptr)
-{
-       struct super_block *sb = ptr;
-
-       deactivate_super(sb);
-       module_put_and_exit(0);
-       return 0;
-}
-
-/*
- * same effect as deactivate_super, but will do final unmount in kthread
- * context
- */
-static void nfs_deactivate_super_async(struct super_block *sb)
-{
-       struct task_struct *task;
-       char buf[INET6_ADDRSTRLEN + 1];
-       struct nfs_server *server = NFS_SB(sb);
-       struct nfs_client *clp = server->nfs_client;
-
-       if (!atomic_add_unless(&sb->s_active, -1, 1)) {
-               rcu_read_lock();
-               snprintf(buf, sizeof(buf),
-                       rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR));
-               rcu_read_unlock();
-
-               __module_get(THIS_MODULE);
-               task = kthread_run(nfs_deactivate_super_async_work, sb,
-                               "%s-deactivate-super", buf);
-               if (IS_ERR(task)) {
-                       pr_err("%s: kthread_run: %ld\n",
-                               __func__, PTR_ERR(task));
-                       /* make synchronous call and hope for the best */
-                       deactivate_super(sb);
-                       module_put(THIS_MODULE);
-               }
-       }
-}
-
-void nfs_sb_deactive_async(struct super_block *sb)
-{
-       struct nfs_server *server = NFS_SB(sb);
-
-       if (atomic_dec_and_test(&server->active))
-               nfs_deactivate_super_async(sb);
-}
-EXPORT_SYMBOL_GPL(nfs_sb_deactive_async);
-
 /*
  * Deliver file system statistics to userspace
  */
@@ -1152,7 +1103,7 @@ static int nfs_get_option_str(substring_t args[], char **option)
 {
        kfree(*option);
        *option = match_strdup(args);
-       return !option;
+       return !*option;
 }
 
 static int nfs_get_option_ul(substring_t args[], unsigned long *option)
@@ -2375,19 +2326,30 @@ static void nfs_get_cache_cookie(struct super_block *sb,
                                 struct nfs_parsed_mount_data *parsed,
                                 struct nfs_clone_mount *cloned)
 {
+       struct nfs_server *nfss = NFS_SB(sb);
        char *uniq = NULL;
        int ulen = 0;
 
-       if (parsed && parsed->fscache_uniq) {
-               uniq = parsed->fscache_uniq;
-               ulen = strlen(parsed->fscache_uniq);
+       nfss->fscache_key = NULL;
+       nfss->fscache = NULL;
+
+       if (parsed) {
+               if (!(parsed->options & NFS_OPTION_FSCACHE))
+                       return;
+               if (parsed->fscache_uniq) {
+                       uniq = parsed->fscache_uniq;
+                       ulen = strlen(parsed->fscache_uniq);
+               }
        } else if (cloned) {
                struct nfs_server *mnt_s = NFS_SB(cloned->sb);
+               if (!(mnt_s->options & NFS_OPTION_FSCACHE))
+                       return;
                if (mnt_s->fscache_key) {
                        uniq = mnt_s->fscache_key->key.uniquifier;
                        ulen = mnt_s->fscache_key->key.uniq_len;
                };
-       }
+       } else
+               return;
 
        nfs_fscache_get_super_cookie(sb, uniq, ulen);
 }
@@ -2578,27 +2540,23 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags,
        struct nfs_server *server;
        struct dentry *mntroot = ERR_PTR(-ENOMEM);
        struct nfs_subversion *nfs_mod = NFS_SB(data->sb)->nfs_client->cl_nfs_mod;
-       int error;
 
-       dprintk("--> nfs_xdev_mount_common()\n");
+       dprintk("--> nfs_xdev_mount()\n");
 
        mount_info.mntfh = mount_info.cloned->fh;
 
        /* create a new volume representation */
        server = nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor);
-       if (IS_ERR(server)) {
-               error = PTR_ERR(server);
-               goto out_err;
-       }
 
-       mntroot = nfs_fs_mount_common(server, flags, dev_name, &mount_info, nfs_mod);
-       dprintk("<-- nfs_xdev_mount_common() = 0\n");
-out:
-       return mntroot;
+       if (IS_ERR(server))
+               mntroot = ERR_CAST(server);
+       else
+               mntroot = nfs_fs_mount_common(server, flags,
+                               dev_name, &mount_info, nfs_mod);
 
-out_err:
-       dprintk("<-- nfs_xdev_mount_common() = %d [error]\n", error);
-       goto out;
+       dprintk("<-- nfs_xdev_mount() = %ld\n",
+                       IS_ERR(mntroot) ? PTR_ERR(mntroot) : 0L);
+       return mntroot;
 }
 
 #if IS_ENABLED(CONFIG_NFS_V4)