]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
NFSv4: Handle fatal ENETDOWN and ENETUNREACH errors
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 6 Apr 2025 08:38:52 +0000 (10:38 +0200)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 28 Apr 2025 03:25:44 +0000 (23:25 -0400)
Ensure that the NFSv4 error handling code recognises the
RPC_TASK_NETUNREACH_FATAL flag, and handles the ENETDOWN and ENETUNREACH
errors accordingly.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
fs/nfs/nfs4proc.c

index 970f28dbf2539e3a1c54fd43011672059a528a61..1f7cc260b007eff4a18f120cbe421963c7add609 100644 (file)
@@ -671,6 +671,15 @@ nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server,
        struct nfs_client *clp = server->nfs_client;
        int ret;
 
+       if ((task->tk_rpc_status == -ENETDOWN ||
+            task->tk_rpc_status == -ENETUNREACH) &&
+           task->tk_flags & RPC_TASK_NETUNREACH_FATAL) {
+               exception->delay = 0;
+               exception->recovering = 0;
+               exception->retry = 0;
+               return -EIO;
+       }
+
        ret = nfs4_do_handle_exception(server, errorcode, exception);
        if (exception->delay) {
                int ret2 = nfs4_exception_should_retrans(server, exception);