diff options
author | Peng Tao <tao.peng@primarydata.com> | 2014-11-16 20:30:40 -0500 |
---|---|---|
committer | Tom Haynes <loghyr@primarydata.com> | 2015-02-03 14:06:49 -0500 |
commit | 6c16605d6ef0dfb2e154119700d58b85c6b4dc71 (patch) | |
tree | c29cbc5029e0a21f0c40d6b2a5d9349bb258ca78 /fs/nfs | |
parent | 15eb67c15342d212b0c8a540b6d6bd2dfad52a63 (diff) |
nfs41: allow async version layoutreturn
Signed-off-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 11 | ||||
-rw-r--r-- | fs/nfs/pnfs.c | 11 | ||||
-rw-r--r-- | fs/nfs/pnfs.h | 2 |
3 files changed, 16 insertions, 8 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e19b5dbe535a..2397c0f080d3 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -7810,7 +7810,7 @@ static const struct rpc_call_ops nfs4_layoutreturn_call_ops = { | |||
7810 | .rpc_release = nfs4_layoutreturn_release, | 7810 | .rpc_release = nfs4_layoutreturn_release, |
7811 | }; | 7811 | }; |
7812 | 7812 | ||
7813 | int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp) | 7813 | int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync) |
7814 | { | 7814 | { |
7815 | struct rpc_task *task; | 7815 | struct rpc_task *task; |
7816 | struct rpc_message msg = { | 7816 | struct rpc_message msg = { |
@@ -7824,16 +7824,23 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp) | |||
7824 | .rpc_message = &msg, | 7824 | .rpc_message = &msg, |
7825 | .callback_ops = &nfs4_layoutreturn_call_ops, | 7825 | .callback_ops = &nfs4_layoutreturn_call_ops, |
7826 | .callback_data = lrp, | 7826 | .callback_data = lrp, |
7827 | .flags = RPC_TASK_ASYNC, | ||
7827 | }; | 7828 | }; |
7828 | int status; | 7829 | int status = 0; |
7829 | 7830 | ||
7830 | dprintk("--> %s\n", __func__); | 7831 | dprintk("--> %s\n", __func__); |
7831 | nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1); | 7832 | nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1); |
7832 | task = rpc_run_task(&task_setup_data); | 7833 | task = rpc_run_task(&task_setup_data); |
7833 | if (IS_ERR(task)) | 7834 | if (IS_ERR(task)) |
7834 | return PTR_ERR(task); | 7835 | return PTR_ERR(task); |
7836 | if (sync == false) | ||
7837 | goto out; | ||
7838 | status = nfs4_wait_for_completion_rpc_task(task); | ||
7839 | if (status != 0) | ||
7840 | goto out; | ||
7835 | status = task->tk_status; | 7841 | status = task->tk_status; |
7836 | trace_nfs4_layoutreturn(lrp->args.inode, status); | 7842 | trace_nfs4_layoutreturn(lrp->args.inode, status); |
7843 | out: | ||
7837 | dprintk("<-- %s status=%d\n", __func__, status); | 7844 | dprintk("<-- %s status=%d\n", __func__, status); |
7838 | rpc_put_task(task); | 7845 | rpc_put_task(task); |
7839 | return status; | 7846 | return status; |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 9549b89e494b..0a0e209e8262 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -52,7 +52,7 @@ static LIST_HEAD(pnfs_modules_tbl); | |||
52 | 52 | ||
53 | static int | 53 | static int |
54 | pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, | 54 | pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, |
55 | enum pnfs_iomode iomode); | 55 | enum pnfs_iomode iomode, bool sync); |
56 | 56 | ||
57 | /* Return the registered pnfs layout driver module matching given id */ | 57 | /* Return the registered pnfs layout driver module matching given id */ |
58 | static struct pnfs_layoutdriver_type * | 58 | static struct pnfs_layoutdriver_type * |
@@ -392,7 +392,8 @@ pnfs_put_lseg(struct pnfs_layout_segment *lseg) | |||
392 | spin_unlock(&inode->i_lock); | 392 | spin_unlock(&inode->i_lock); |
393 | pnfs_free_lseg(lseg); | 393 | pnfs_free_lseg(lseg); |
394 | if (need_return) | 394 | if (need_return) |
395 | pnfs_send_layoutreturn(lo, stateid, iomode); | 395 | pnfs_send_layoutreturn(lo, stateid, iomode, |
396 | true); | ||
396 | else | 397 | else |
397 | pnfs_put_layout_hdr(lo); | 398 | pnfs_put_layout_hdr(lo); |
398 | } | 399 | } |
@@ -897,7 +898,7 @@ static void pnfs_clear_layoutcommit(struct inode *inode, | |||
897 | 898 | ||
898 | static int | 899 | static int |
899 | pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, | 900 | pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, |
900 | enum pnfs_iomode iomode) | 901 | enum pnfs_iomode iomode, bool sync) |
901 | { | 902 | { |
902 | struct inode *ino = lo->plh_inode; | 903 | struct inode *ino = lo->plh_inode; |
903 | struct nfs4_layoutreturn *lrp; | 904 | struct nfs4_layoutreturn *lrp; |
@@ -923,7 +924,7 @@ pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, | |||
923 | lrp->clp = NFS_SERVER(ino)->nfs_client; | 924 | lrp->clp = NFS_SERVER(ino)->nfs_client; |
924 | lrp->cred = lo->plh_lc_cred; | 925 | lrp->cred = lo->plh_lc_cred; |
925 | 926 | ||
926 | status = nfs4_proc_layoutreturn(lrp); | 927 | status = nfs4_proc_layoutreturn(lrp, sync); |
927 | out: | 928 | out: |
928 | if (status) { | 929 | if (status) { |
929 | spin_lock(&ino->i_lock); | 930 | spin_lock(&ino->i_lock); |
@@ -989,7 +990,7 @@ _pnfs_return_layout(struct inode *ino) | |||
989 | spin_unlock(&ino->i_lock); | 990 | spin_unlock(&ino->i_lock); |
990 | pnfs_free_lseg_list(&tmp_list); | 991 | pnfs_free_lseg_list(&tmp_list); |
991 | 992 | ||
992 | status = pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY); | 993 | status = pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY, true); |
993 | out: | 994 | out: |
994 | dprintk("<-- %s status: %d\n", __func__, status); | 995 | dprintk("<-- %s status: %d\n", __func__, status); |
995 | return status; | 996 | return status; |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 84c25cd476f8..b79f494d59ac 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -219,7 +219,7 @@ extern int nfs4_proc_getdeviceinfo(struct nfs_server *server, | |||
219 | struct pnfs_device *dev, | 219 | struct pnfs_device *dev, |
220 | struct rpc_cred *cred); | 220 | struct rpc_cred *cred); |
221 | extern struct pnfs_layout_segment* nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags); | 221 | extern struct pnfs_layout_segment* nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags); |
222 | extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp); | 222 | extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync); |
223 | 223 | ||
224 | /* pnfs.c */ | 224 | /* pnfs.c */ |
225 | void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo); | 225 | void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo); |