Skip to content

Commit 6109bcf

Browse files
trondmyamschuma-ntap
authored andcommitted
NFSv4: Handle RPC level errors in LAYOUTRETURN
Handle RPC level errors by assuming that the RPC call was successful. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 078a432 commit 6109bcf

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

fs/nfs/nfs4proc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9051,6 +9051,15 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
90519051
if (!nfs41_sequence_process(task, &lrp->res.seq_res))
90529052
return;
90539053

9054+
/*
9055+
* Was there an RPC level error? Assume the call succeeded,
9056+
* and that we need to release the layout
9057+
*/
9058+
if (task->tk_rpc_status != 0 && RPC_WAS_SENT(task)) {
9059+
lrp->res.lrs_present = 0;
9060+
return;
9061+
}
9062+
90549063
server = NFS_SERVER(lrp->args.inode);
90559064
switch (task->tk_status) {
90569065
case -NFS4ERR_OLD_STATEID:

fs/nfs/pnfs.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,21 @@ int pnfs_roc_done(struct rpc_task *task, struct inode *inode,
14551455
case 0:
14561456
retval = 0;
14571457
break;
1458+
case -NFS4ERR_NOMATCHING_LAYOUT:
1459+
/* Was there an RPC level error? If not, retry */
1460+
if (task->tk_rpc_status == 0)
1461+
break;
1462+
/* If the call was not sent, let caller handle it */
1463+
if (!RPC_WAS_SENT(task))
1464+
return 0;
1465+
/*
1466+
* Otherwise, assume the call succeeded and
1467+
* that we need to release the layout
1468+
*/
1469+
*ret = 0;
1470+
(*respp)->lrs_present = 0;
1471+
retval = 0;
1472+
break;
14581473
case -NFS4ERR_DELAY:
14591474
/* Let the caller handle the retry */
14601475
*ret = -NFS4ERR_NOMATCHING_LAYOUT;

0 commit comments

Comments
 (0)