diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-05 16:35:16 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-05 22:16:45 -0500 |
commit | 5a0ec8acb945e302ce819b4a9787796ccf284548 (patch) | |
tree | da14a82a655160b85440bc6981b91e25f9303299 /fs/nfs/nfs4proc.c | |
parent | 472e259449819d939b5a5188b6f4c7d59aa4304c (diff) |
NFSv4.1: Pin the inode and super block in asynchronous layoutreturns
If we're sending an asynchronous layoutreturn, then we need to ensure
that the inode and the super block remain pinned.
Cc: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Reviewed-by: Peng Tao <tao.peng@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e092b8540e2e..2e7c9f7a6f7c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -7856,6 +7856,7 @@ static void nfs4_layoutreturn_release(void *calldata) | |||
7856 | lo->plh_block_lgets--; | 7856 | lo->plh_block_lgets--; |
7857 | spin_unlock(&lo->plh_inode->i_lock); | 7857 | spin_unlock(&lo->plh_inode->i_lock); |
7858 | pnfs_put_layout_hdr(lrp->args.layout); | 7858 | pnfs_put_layout_hdr(lrp->args.layout); |
7859 | nfs_iput_and_deactive(lrp->inode); | ||
7859 | kfree(calldata); | 7860 | kfree(calldata); |
7860 | dprintk("<-- %s\n", __func__); | 7861 | dprintk("<-- %s\n", __func__); |
7861 | } | 7862 | } |
@@ -7880,23 +7881,25 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync) | |||
7880 | .rpc_message = &msg, | 7881 | .rpc_message = &msg, |
7881 | .callback_ops = &nfs4_layoutreturn_call_ops, | 7882 | .callback_ops = &nfs4_layoutreturn_call_ops, |
7882 | .callback_data = lrp, | 7883 | .callback_data = lrp, |
7883 | .flags = RPC_TASK_ASYNC, | ||
7884 | }; | 7884 | }; |
7885 | int status = 0; | 7885 | int status = 0; |
7886 | 7886 | ||
7887 | dprintk("--> %s\n", __func__); | 7887 | dprintk("--> %s\n", __func__); |
7888 | if (!sync) { | ||
7889 | lrp->inode = nfs_igrab_and_active(lrp->args.inode); | ||
7890 | if (!lrp->inode) { | ||
7891 | nfs4_layoutreturn_release(lrp); | ||
7892 | return -EAGAIN; | ||
7893 | } | ||
7894 | task_setup_data.flags |= RPC_TASK_ASYNC; | ||
7895 | } | ||
7888 | nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1); | 7896 | nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1); |
7889 | task = rpc_run_task(&task_setup_data); | 7897 | task = rpc_run_task(&task_setup_data); |
7890 | if (IS_ERR(task)) | 7898 | if (IS_ERR(task)) |
7891 | return PTR_ERR(task); | 7899 | return PTR_ERR(task); |
7892 | if (sync == false) | 7900 | if (sync) |
7893 | goto out; | 7901 | status = task->tk_status; |
7894 | status = nfs4_wait_for_completion_rpc_task(task); | ||
7895 | if (status != 0) | ||
7896 | goto out; | ||
7897 | status = task->tk_status; | ||
7898 | trace_nfs4_layoutreturn(lrp->args.inode, status); | 7902 | trace_nfs4_layoutreturn(lrp->args.inode, status); |
7899 | out: | ||
7900 | dprintk("<-- %s status=%d\n", __func__, status); | 7903 | dprintk("<-- %s status=%d\n", __func__, status); |
7901 | rpc_put_task(task); | 7904 | rpc_put_task(task); |
7902 | return status; | 7905 | return status; |