提交 c8bf7073 编写于 作者: T Trond Myklebust

pNFS: Don't send layoutreturn if the layout is already invalid

If the layout was invalidated due to a reboot, then don't try to send
a layoutreturn for it.
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
上级 2dbf8dff
...@@ -3294,6 +3294,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) ...@@ -3294,6 +3294,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
struct nfs4_closedata *calldata = data; struct nfs4_closedata *calldata = data;
struct nfs4_state *state = calldata->state; struct nfs4_state *state = calldata->state;
struct inode *inode = calldata->inode; struct inode *inode = calldata->inode;
struct pnfs_layout_hdr *lo;
bool is_rdonly, is_wronly, is_rdwr; bool is_rdonly, is_wronly, is_rdwr;
int call_close = 0; int call_close = 0;
...@@ -3337,6 +3338,12 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) ...@@ -3337,6 +3338,12 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
goto out_wait; goto out_wait;
} }
lo = calldata->arg.lr_args ? calldata->arg.lr_args->layout : NULL;
if (lo && !pnfs_layout_is_valid(lo)) {
calldata->arg.lr_args = NULL;
calldata->res.lr_res = NULL;
}
if (calldata->arg.fmode == 0) if (calldata->arg.fmode == 0)
task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE]; task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE];
...@@ -5972,12 +5979,19 @@ static void nfs4_delegreturn_release(void *calldata) ...@@ -5972,12 +5979,19 @@ static void nfs4_delegreturn_release(void *calldata)
static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data) static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data)
{ {
struct nfs4_delegreturndata *d_data; struct nfs4_delegreturndata *d_data;
struct pnfs_layout_hdr *lo;
d_data = (struct nfs4_delegreturndata *)data; d_data = (struct nfs4_delegreturndata *)data;
if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task)) if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task))
return; return;
lo = d_data->args.lr_args ? d_data->args.lr_args->layout : NULL;
if (lo && !pnfs_layout_is_valid(lo)) {
d_data->args.lr_args = NULL;
d_data->res.lr_res = NULL;
}
nfs4_setup_sequence(d_data->res.server->nfs_client, nfs4_setup_sequence(d_data->res.server->nfs_client,
&d_data->args.seq_args, &d_data->args.seq_args,
&d_data->res.seq_res, &d_data->res.seq_res,
...@@ -8820,6 +8834,8 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata) ...@@ -8820,6 +8834,8 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata)
&lrp->args.seq_args, &lrp->args.seq_args,
&lrp->res.seq_res, &lrp->res.seq_res,
task); task);
if (!pnfs_layout_is_valid(lrp->args.layout))
rpc_exit(task, 0);
} }
static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
......
...@@ -801,6 +801,11 @@ static inline void nfs4_lgopen_release(struct nfs4_layoutget *lgp) ...@@ -801,6 +801,11 @@ static inline void nfs4_lgopen_release(struct nfs4_layoutget *lgp)
{ {
} }
static inline bool pnfs_layout_is_valid(const struct pnfs_layout_hdr *lo)
{
return false;
}
#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4_1 */
#if IS_ENABLED(CONFIG_NFS_V4_2) #if IS_ENABLED(CONFIG_NFS_V4_2)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册