@@ -512,6 +512,8 @@ static struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
512512 clnt -> cl_discrtry = 1 ;
513513 if (!(args -> flags & RPC_CLNT_CREATE_QUIET ))
514514 clnt -> cl_chatty = 1 ;
515+ if (args -> flags & RPC_CLNT_CREATE_NETUNREACH_FATAL )
516+ clnt -> cl_netunreach_fatal = 1 ;
515517
516518 return clnt ;
517519}
@@ -662,6 +664,7 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args,
662664 new -> cl_noretranstimeo = clnt -> cl_noretranstimeo ;
663665 new -> cl_discrtry = clnt -> cl_discrtry ;
664666 new -> cl_chatty = clnt -> cl_chatty ;
667+ new -> cl_netunreach_fatal = clnt -> cl_netunreach_fatal ;
665668 new -> cl_principal = clnt -> cl_principal ;
666669 new -> cl_max_connect = clnt -> cl_max_connect ;
667670 return new ;
@@ -1195,6 +1198,8 @@ void rpc_task_set_client(struct rpc_task *task, struct rpc_clnt *clnt)
11951198 task -> tk_flags |= RPC_TASK_TIMEOUT ;
11961199 if (clnt -> cl_noretranstimeo )
11971200 task -> tk_flags |= RPC_TASK_NO_RETRANS_TIMEOUT ;
1201+ if (clnt -> cl_netunreach_fatal )
1202+ task -> tk_flags |= RPC_TASK_NETUNREACH_FATAL ;
11981203 atomic_inc (& clnt -> cl_task_count );
11991204}
12001205
@@ -2102,14 +2107,17 @@ call_bind_status(struct rpc_task *task)
21022107 case - EPROTONOSUPPORT :
21032108 trace_rpcb_bind_version_err (task );
21042109 goto retry_timeout ;
2110+ case - ENETDOWN :
2111+ case - ENETUNREACH :
2112+ if (task -> tk_flags & RPC_TASK_NETUNREACH_FATAL )
2113+ break ;
2114+ fallthrough ;
21052115 case - ECONNREFUSED : /* connection problems */
21062116 case - ECONNRESET :
21072117 case - ECONNABORTED :
21082118 case - ENOTCONN :
21092119 case - EHOSTDOWN :
2110- case - ENETDOWN :
21112120 case - EHOSTUNREACH :
2112- case - ENETUNREACH :
21132121 case - EPIPE :
21142122 trace_rpcb_unreachable_err (task );
21152123 if (!RPC_IS_SOFTCONN (task )) {
@@ -2191,19 +2199,22 @@ call_connect_status(struct rpc_task *task)
21912199
21922200 task -> tk_status = 0 ;
21932201 switch (status ) {
2202+ case - ENETDOWN :
2203+ case - ENETUNREACH :
2204+ if (task -> tk_flags & RPC_TASK_NETUNREACH_FATAL )
2205+ break ;
2206+ fallthrough ;
21942207 case - ECONNREFUSED :
21952208 case - ECONNRESET :
21962209 /* A positive refusal suggests a rebind is needed. */
2197- if (RPC_IS_SOFTCONN (task ))
2198- break ;
21992210 if (clnt -> cl_autobind ) {
22002211 rpc_force_rebind (clnt );
2212+ if (RPC_IS_SOFTCONN (task ))
2213+ break ;
22012214 goto out_retry ;
22022215 }
22032216 fallthrough ;
22042217 case - ECONNABORTED :
2205- case - ENETDOWN :
2206- case - ENETUNREACH :
22072218 case - EHOSTUNREACH :
22082219 case - EPIPE :
22092220 case - EPROTO :
@@ -2455,10 +2466,13 @@ call_status(struct rpc_task *task)
24552466 trace_rpc_call_status (task );
24562467 task -> tk_status = 0 ;
24572468 switch (status ) {
2458- case - EHOSTDOWN :
24592469 case - ENETDOWN :
2460- case - EHOSTUNREACH :
24612470 case - ENETUNREACH :
2471+ if (task -> tk_flags & RPC_TASK_NETUNREACH_FATAL )
2472+ goto out_exit ;
2473+ fallthrough ;
2474+ case - EHOSTDOWN :
2475+ case - EHOSTUNREACH :
24622476 case - EPERM :
24632477 if (RPC_IS_SOFTCONN (task ))
24642478 goto out_exit ;
0 commit comments