Revert "NFS: add nfs_sb_deactive_async to avoid deadlock"
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 11 Jan 2013 21:39:51 +0000 (16:39 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 1 Feb 2013 15:13:48 +0000 (10:13 -0500)
This reverts commit 324d003b0cd82151adbaecefef57b73f7959a469.

The deadlock turned out to be caused by a workqueue limitation that has
now been worked around in the RPC code (see comment in rpc_free_task).

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/inode.c
fs/nfs/internal.h
fs/nfs/nfs4proc.c
fs/nfs/super.c
fs/nfs/unlink.c

index ebeb94ce1b0bd5355cc28042ad2bb67753324a88..6acc73c80d7f26421d7f2c1b7ca47236eb2a969d 100644 (file)
@@ -694,10 +694,7 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)
        if (ctx->cred != NULL)
                put_rpccred(ctx->cred);
        dput(ctx->dentry);
-       if (is_sync)
-               nfs_sb_deactive(sb);
-       else
-               nfs_sb_deactive_async(sb);
+       nfs_sb_deactive(sb);
        kfree(ctx->mdsthreshold);
        kfree(ctx);
 }
index f0e6c7df1a072a07313de2a92203260b70f9da52..541c9ebdbc5a3e905f07798e2207bf5eec028081 100644 (file)
@@ -329,7 +329,6 @@ extern int __init register_nfs_fs(void);
 extern void __exit unregister_nfs_fs(void);
 extern void nfs_sb_active(struct super_block *sb);
 extern void nfs_sb_deactive(struct super_block *sb);
-extern void nfs_sb_deactive_async(struct super_block *sb);
 
 /* namespace.c */
 #define NFS_PATH_CANONICAL 1
index cf747ef8665078a2a684b256402ab63484a77665..62fa4001e47ae1846cda297a26b0ca035c56dc4d 100644 (file)
@@ -2088,7 +2088,7 @@ static void nfs4_free_closedata(void *data)
        nfs4_put_open_state(calldata->state);
        nfs_free_seqid(calldata->arg.seqid);
        nfs4_put_state_owner(sp);
-       nfs_sb_deactive_async(sb);
+       nfs_sb_deactive(sb);
        kfree(calldata);
 }
 
index b056b1628722218bbbadce33e86255e6953c8994..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
  */
index 3f79c77153b8fe827cd24310209301e0132b96ad..13cea637eff82288f2f5508023a592e60db3fa7a 100644 (file)
@@ -95,7 +95,7 @@ static void nfs_async_unlink_release(void *calldata)
 
        nfs_dec_sillycount(data->dir);
        nfs_free_unlinkdata(data);
-       nfs_sb_deactive_async(sb);
+       nfs_sb_deactive(sb);
 }
 
 static void nfs_unlink_prepare(struct rpc_task *task, void *calldata)