Skip to content

Commit

Permalink
NFSv4/pnfs: Layoutreturn on close must handle fatal networking errors
Browse files Browse the repository at this point in the history
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 <trond.myklebust@hammerspace.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
  • Loading branch information
Trond Myklebust committed Apr 28, 2025
1 parent 2d7f844 commit 440caf8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,18 @@ int pnfs_roc_done(struct rpc_task *task, struct nfs4_layoutreturn_args **argpp,
/* Was there an RPC level error? If not, retry */
if (task->tk_rpc_status == 0)
break;
/*
* Is there a fatal network level error?
* If so release the layout, but flag the error.
*/
if ((task->tk_rpc_status == -ENETDOWN ||
task->tk_rpc_status == -ENETUNREACH) &&
task->tk_flags & RPC_TASK_NETUNREACH_FATAL) {
*ret = 0;
(*respp)->lrs_present = 0;
retval = -EIO;
break;
}
/* If the call was not sent, let caller handle it */
if (!RPC_WAS_SENT(task))
return 0;
Expand Down

0 comments on commit 440caf8

Please sign in to comment.