NFSv4: Clean up pNFS return-on-close error handling

Both close and delegreturn have identical code to handle pNFS
return-on-close. This patch refactors that code and places it
in pnfs.c

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Trond Myklebust
2019-09-20 07:23:41 -04:00
committed by Anna Schumaker
parent 9c47b18cf7
commit 287a9c558b
3 changed files with 50 additions and 56 deletions

View File

@@ -1440,6 +1440,33 @@ out_noroc:
return false;
}
int pnfs_roc_done(struct rpc_task *task, struct inode *inode,
struct nfs4_layoutreturn_args **argpp,
struct nfs4_layoutreturn_res **respp,
int *ret)
{
struct nfs4_layoutreturn_args *arg = *argpp;
int retval = -EAGAIN;
if (!arg)
return 0;
/* Handle Layoutreturn errors */
switch (*ret) {
case 0:
retval = 0;
break;
case -NFS4ERR_OLD_STATEID:
if (!nfs4_layoutreturn_refresh_stateid(&arg->stateid,
&arg->range, inode))
break;
*ret = -NFS4ERR_NOMATCHING_LAYOUT;
return -EAGAIN;
}
*argpp = NULL;
*respp = NULL;
return retval;
}
void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
struct nfs4_layoutreturn_res *res,
int ret)