Skip to content

Commit 440caf8

Browse files
author
Trond Myklebust
committed
NFSv4/pnfs: Layoutreturn on close must handle fatal networking errors
If we have a fatal ENETDOWN or ENETUNREACH error, then the layoutreturn on close code should also handle that as fatal, and free the layouts. Signed-off-by: Trond Myklebust <[email protected]> Reviewed-by: Jeff Layton <[email protected]>
1 parent 2d7f844 commit 440caf8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

fs/nfs/pnfs.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,18 @@ int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp,
16611661
/* Was there an RPC level error? If not, retry */
16621662
if (task->tk_rpc_status == 0)
16631663
break;
1664+
/*
1665+
* Is there a fatal network level error?
1666+
* If so release the layout, but flag the error.
1667+
*/
1668+
if ((task->tk_rpc_status == -ENETDOWN ||
1669+
task->tk_rpc_status == -ENETUNREACH) &&
1670+
task->tk_flags & RPC_TASK_NETUNREACH_FATAL) {
1671+
*ret = 0;
1672+
(*respp)->lrs_present = 0;
1673+
retval = -EIO;
1674+
break;
1675+
}
16641676
/* If the call was not sent, let caller handle it */
16651677
if (!RPC_WAS_SENT(task))
16661678
return 0;

0 commit comments

Comments
 (0)