38 #include <rpc/xdr.h>
39 #include <rpc/pmap_prot.h>
40 #include <rpc/pmap_clnt.h>
41 #include <rpc/rpcb_prot.h>
42
43 #include <rpcsvc/nlm_prot.h>
44 #include <rpcsvc/sm_inter.h>
45
46 #include "nlm_impl.h"
47
48 /*
49 * The following errors codes from nlm_null_rpc indicate that the port we have
50 * cached for the client's NLM service is stale and that we need to establish
51 * a new RPC client.
52 */
53 #define NLM_STALE_CLNT(_status) \
54 ((_status) == RPC_PROGUNAVAIL || \
55 (_status) == RPC_PROGVERSMISMATCH || \
56 (_status) == RPC_PROCUNAVAIL || \
57 (_status) == RPC_CANTCONNECT || \
58 (_status) == RPC_XPRTFAILED)
59
60 static struct kmem_cache *nlm_rpch_cache = NULL;
61
62 static int nlm_rpch_ctor(void *, void *, int);
63 static void nlm_rpch_dtor(void *, void *);
64 static void destroy_rpch(nlm_rpc_t *);
65 static nlm_rpc_t *get_nlm_rpc_fromcache(struct nlm_host *, int);
66 static void update_host_rpcbinding(struct nlm_host *, int);
67 static int refresh_nlm_rpc(struct nlm_host *, nlm_rpc_t *);
68 static void nlm_host_rele_rpc_locked(struct nlm_host *, nlm_rpc_t *);
69
70 static nlm_rpc_t *
71 get_nlm_rpc_fromcache(struct nlm_host *hostp, int vers)
72 {
73 nlm_rpc_t *rpcp;
74 bool_t found = FALSE;
75
76 ASSERT(MUTEX_HELD(&hostp->nh_lock));
77 if (TAILQ_EMPTY(&hostp->nh_rpchc))
|
38 #include <rpc/xdr.h>
39 #include <rpc/pmap_prot.h>
40 #include <rpc/pmap_clnt.h>
41 #include <rpc/rpcb_prot.h>
42
43 #include <rpcsvc/nlm_prot.h>
44 #include <rpcsvc/sm_inter.h>
45
46 #include "nlm_impl.h"
47
48 /*
49 * The following errors codes from nlm_null_rpc indicate that the port we have
50 * cached for the client's NLM service is stale and that we need to establish
51 * a new RPC client.
52 */
53 #define NLM_STALE_CLNT(_status) \
54 ((_status) == RPC_PROGUNAVAIL || \
55 (_status) == RPC_PROGVERSMISMATCH || \
56 (_status) == RPC_PROCUNAVAIL || \
57 (_status) == RPC_CANTCONNECT || \
58 (_status) == RPC_TIMEDOUT || \
59 (_status) == RPC_XPRTFAILED)
60
61 static struct kmem_cache *nlm_rpch_cache = NULL;
62
63 static int nlm_rpch_ctor(void *, void *, int);
64 static void nlm_rpch_dtor(void *, void *);
65 static void destroy_rpch(nlm_rpc_t *);
66 static nlm_rpc_t *get_nlm_rpc_fromcache(struct nlm_host *, int);
67 static void update_host_rpcbinding(struct nlm_host *, int);
68 static int refresh_nlm_rpc(struct nlm_host *, nlm_rpc_t *);
69 static void nlm_host_rele_rpc_locked(struct nlm_host *, nlm_rpc_t *);
70
71 static nlm_rpc_t *
72 get_nlm_rpc_fromcache(struct nlm_host *hostp, int vers)
73 {
74 nlm_rpc_t *rpcp;
75 bool_t found = FALSE;
76
77 ASSERT(MUTEX_HELD(&hostp->nh_lock));
78 if (TAILQ_EMPTY(&hostp->nh_rpchc))
|