2961 /*
2962 * This table is used to determine whether the client should attempt
2963 * failover based on the clnt_stat value returned by CLNT_CALL. The
2964 * clnt_stat is used as an index into the table. If
2965 * the error value that corresponds to the clnt_stat value in the
2966 * table is non-zero, then that is the error to be returned AND
2967 * that signals that failover should be attempted.
2968 *
2969 * Special note: If the RPC_ values change, then direct indexing of the
2970 * table is no longer valid, but having the RPC_ values in the table
2971 * allow the functions to detect the change and issue a warning.
2972 * In this case, the code will always attempt failover as a defensive
2973 * measure.
2974 */
2975
2976 static struct try_failover_tab {
2977 enum clnt_stat cstat;
2978 int error;
2979 } try_failover_table [] = {
2980
2981 RPC_SUCCESS, 0,
2982 RPC_CANTENCODEARGS, 0,
2983 RPC_CANTDECODERES, 0,
2984 RPC_CANTSEND, ECOMM,
2985 RPC_CANTRECV, ECOMM,
2986 RPC_TIMEDOUT, ETIMEDOUT,
2987 RPC_VERSMISMATCH, 0,
2988 RPC_AUTHERROR, 0,
2989 RPC_PROGUNAVAIL, 0,
2990 RPC_PROGVERSMISMATCH, 0,
2991 RPC_PROCUNAVAIL, 0,
2992 RPC_CANTDECODEARGS, 0,
2993 RPC_SYSTEMERROR, ENOSR,
2994 RPC_UNKNOWNHOST, EHOSTUNREACH,
2995 RPC_RPCBFAILURE, ENETUNREACH,
2996 RPC_PROGNOTREGISTERED, ECONNREFUSED,
2997 RPC_FAILED, ETIMEDOUT,
2998 RPC_UNKNOWNPROTO, EHOSTUNREACH,
2999 RPC_INTR, 0,
3000 RPC_UNKNOWNADDR, EHOSTUNREACH,
3001 RPC_TLIERROR, 0,
3002 RPC_NOBROADCAST, EHOSTUNREACH,
3003 RPC_N2AXLATEFAILURE, ECONNREFUSED,
3004 RPC_UDERROR, 0,
3005 RPC_INPROGRESS, 0,
3006 RPC_STALERACHANDLE, EINVAL,
3007 RPC_CANTCONNECT, ECONNREFUSED,
3008 RPC_XPRTFAILED, ECONNABORTED,
3009 RPC_CANTCREATESTREAM, ECONNREFUSED,
3010 RPC_CANTSTORE, ENOBUFS
3011 };
3012
3013 /*
3014 * nfs4_try_failover - determine whether the client should
3015 * attempt failover based on the values stored in the nfs4_error_t.
3016 */
3017 int
3018 nfs4_try_failover(nfs4_error_t *ep)
3019 {
3020 if (ep->error == ETIMEDOUT || ep->stat == NFS4ERR_RESOURCE)
3021 return (TRUE);
3022
3023 if (ep->error && ep->rpc_status != RPC_SUCCESS)
3024 return (try_failover(ep->rpc_status) != 0 ? TRUE : FALSE);
3025
3026 return (FALSE);
3027 }
3028
3029 /*
3030 * try_failover - internal version of nfs4_try_failover, called
|
2961 /*
2962 * This table is used to determine whether the client should attempt
2963 * failover based on the clnt_stat value returned by CLNT_CALL. The
2964 * clnt_stat is used as an index into the table. If
2965 * the error value that corresponds to the clnt_stat value in the
2966 * table is non-zero, then that is the error to be returned AND
2967 * that signals that failover should be attempted.
2968 *
2969 * Special note: If the RPC_ values change, then direct indexing of the
2970 * table is no longer valid, but having the RPC_ values in the table
2971 * allow the functions to detect the change and issue a warning.
2972 * In this case, the code will always attempt failover as a defensive
2973 * measure.
2974 */
2975
2976 static struct try_failover_tab {
2977 enum clnt_stat cstat;
2978 int error;
2979 } try_failover_table [] = {
2980
2981 { RPC_SUCCESS, 0 },
2982 { RPC_CANTENCODEARGS, 0 },
2983 { RPC_CANTDECODERES, 0 },
2984 { RPC_CANTSEND, ECOMM },
2985 { RPC_CANTRECV, ECOMM },
2986 { RPC_TIMEDOUT, ETIMEDOUT },
2987 { RPC_VERSMISMATCH, 0 },
2988 { RPC_AUTHERROR, 0 },
2989 { RPC_PROGUNAVAIL, 0 },
2990 { RPC_PROGVERSMISMATCH, 0 },
2991 { RPC_PROCUNAVAIL, 0 },
2992 { RPC_CANTDECODEARGS, 0 },
2993 { RPC_SYSTEMERROR, ENOSR },
2994 { RPC_UNKNOWNHOST, EHOSTUNREACH },
2995 { RPC_RPCBFAILURE, ENETUNREACH },
2996 { RPC_PROGNOTREGISTERED, ECONNREFUSED },
2997 { RPC_FAILED, ETIMEDOUT },
2998 { RPC_UNKNOWNPROTO, EHOSTUNREACH },
2999 { RPC_INTR, 0 },
3000 { RPC_UNKNOWNADDR, EHOSTUNREACH },
3001 { RPC_TLIERROR, 0 },
3002 { RPC_NOBROADCAST, EHOSTUNREACH },
3003 { RPC_N2AXLATEFAILURE, ECONNREFUSED },
3004 { RPC_UDERROR, 0 },
3005 { RPC_INPROGRESS, 0 },
3006 { RPC_STALERACHANDLE, EINVAL },
3007 { RPC_CANTCONNECT, ECONNREFUSED },
3008 { RPC_XPRTFAILED, ECONNABORTED },
3009 { RPC_CANTCREATESTREAM, ECONNREFUSED },
3010 { RPC_CANTSTORE, ENOBUFS }
3011 };
3012
3013 /*
3014 * nfs4_try_failover - determine whether the client should
3015 * attempt failover based on the values stored in the nfs4_error_t.
3016 */
3017 int
3018 nfs4_try_failover(nfs4_error_t *ep)
3019 {
3020 if (ep->error == ETIMEDOUT || ep->stat == NFS4ERR_RESOURCE)
3021 return (TRUE);
3022
3023 if (ep->error && ep->rpc_status != RPC_SUCCESS)
3024 return (try_failover(ep->rpc_status) != 0 ? TRUE : FALSE);
3025
3026 return (FALSE);
3027 }
3028
3029 /*
3030 * try_failover - internal version of nfs4_try_failover, called
|