Print this page
4965 nlm null rpc returns RPC_TIMEDOUT with shorter timeout value


 107 
 108 /*
 109  * Given an integer x, the macro returns
 110  * -1 if x is negative,
 111  *  0 if x is zero
 112  *  1 if x is positive
 113  */
 114 #define SIGN(x) (((x) > 0) - ((x) < 0))
 115 
 116 #define ARRSIZE(arr)    (sizeof (arr) / sizeof ((arr)[0]))
 117 #define NLM_KNCS        ARRSIZE(nlm_netconfigs)
 118 
 119 krwlock_t lm_lck;
 120 
 121 /*
 122  * Zero timeout for asynchronous NLM RPC operations
 123  */
 124 static const struct timeval nlm_rpctv_zero = { 0,  0 };
 125 
 126 /*





 127  * List of all Zone globals nlm_globals instences
 128  * linked together.
 129  */
 130 static struct nlm_globals_list nlm_zones_list; /* (g) */
 131 
 132 /*
 133  * NLM kmem caches
 134  */
 135 static struct kmem_cache *nlm_hosts_cache = NULL;
 136 static struct kmem_cache *nlm_vhold_cache = NULL;
 137 
 138 /*
 139  * A bitmap for allocation of new sysids.
 140  * Sysid is a unique number between LM_SYSID
 141  * and LM_SYSID_MAX. Sysid represents unique remote
 142  * host that does file locks on the given host.
 143  */
 144 static ulong_t  nlm_sysid_bmap[NLM_BMAP_WORDS]; /* (g) */
 145 static int      nlm_sysid_nidx;                 /* (g) */
 146 


 510     caddr_t argsp, xdrproc_t xdr_result, caddr_t resultp, struct timeval wait)
 511 {
 512         k_sigset_t oldmask;
 513         enum clnt_stat stat;
 514         bool_t sig_blocked = FALSE;
 515 
 516         /*
 517          * If NLM RPC procnum is one of the NLM _RES procedures
 518          * that are used to reply to asynchronous NLM RPC
 519          * (MSG calls), explicitly set RPC timeout to zero.
 520          * Client doesn't send a reply to RES procedures, so
 521          * we don't need to wait anything.
 522          *
 523          * NOTE: we ignore NLM4_*_RES procnums because they are
 524          * equal to NLM_*_RES numbers.
 525          */
 526         if (procnum >= NLM_TEST_RES && procnum <= NLM_GRANTED_RES)
 527                 wait = nlm_rpctv_zero;
 528 
 529         /*














 530          * We need to block signals in case of NLM_CANCEL RPC
 531          * in order to prevent interruption of network RPC
 532          * calls.
 533          */
 534         if (procnum == NLM_CANCEL) {
 535                 k_sigset_t newmask;
 536 
 537                 sigfillset(&newmask);
 538                 sigreplace(&newmask, &oldmask);
 539                 sig_blocked = TRUE;
 540         }
 541 
 542         stat = clnt_call(clnt, procnum, xdr_args,
 543             argsp, xdr_result, resultp, wait);
 544 
 545         /*
 546          * Restore signal mask back if signals were blocked
 547          */
 548         if (sig_blocked)
 549                 sigreplace(&oldmask, (k_sigset_t *)NULL);




 107 
 108 /*
 109  * Given an integer x, the macro returns
 110  * -1 if x is negative,
 111  *  0 if x is zero
 112  *  1 if x is positive
 113  */
 114 #define SIGN(x) (((x) > 0) - ((x) < 0))
 115 
 116 #define ARRSIZE(arr)    (sizeof (arr) / sizeof ((arr)[0]))
 117 #define NLM_KNCS        ARRSIZE(nlm_netconfigs)
 118 
 119 krwlock_t lm_lck;
 120 
 121 /*
 122  * Zero timeout for asynchronous NLM RPC operations
 123  */
 124 static const struct timeval nlm_rpctv_zero = { 0,  0 };
 125 
 126 /*
 127  * Initial timeout for NLM NULL RPC
 128  */
 129 static volatile struct timeval nlm_nullrpc_wait = { 0, 200000 };
 130 
 131 /*
 132  * List of all Zone globals nlm_globals instences
 133  * linked together.
 134  */
 135 static struct nlm_globals_list nlm_zones_list; /* (g) */
 136 
 137 /*
 138  * NLM kmem caches
 139  */
 140 static struct kmem_cache *nlm_hosts_cache = NULL;
 141 static struct kmem_cache *nlm_vhold_cache = NULL;
 142 
 143 /*
 144  * A bitmap for allocation of new sysids.
 145  * Sysid is a unique number between LM_SYSID
 146  * and LM_SYSID_MAX. Sysid represents unique remote
 147  * host that does file locks on the given host.
 148  */
 149 static ulong_t  nlm_sysid_bmap[NLM_BMAP_WORDS]; /* (g) */
 150 static int      nlm_sysid_nidx;                 /* (g) */
 151 


 515     caddr_t argsp, xdrproc_t xdr_result, caddr_t resultp, struct timeval wait)
 516 {
 517         k_sigset_t oldmask;
 518         enum clnt_stat stat;
 519         bool_t sig_blocked = FALSE;
 520 
 521         /*
 522          * If NLM RPC procnum is one of the NLM _RES procedures
 523          * that are used to reply to asynchronous NLM RPC
 524          * (MSG calls), explicitly set RPC timeout to zero.
 525          * Client doesn't send a reply to RES procedures, so
 526          * we don't need to wait anything.
 527          *
 528          * NOTE: we ignore NLM4_*_RES procnums because they are
 529          * equal to NLM_*_RES numbers.
 530          */
 531         if (procnum >= NLM_TEST_RES && procnum <= NLM_GRANTED_RES)
 532                 wait = nlm_rpctv_zero;
 533 
 534         /*
 535          * Default timeout value of 25 seconds can take
 536          * nlm_null_rpc() 150 seconds to return RPC_TIMEDOUT 
 537          * if it uses UDP and the destination port is 
 538          * unreachable.
 539          *
 540          * A shorter timeout value, e.g. 200 milliseconds,
 541          * will cause nlm_null_rpc() to time out after
 542          * 200 * (1 + 2 + 4 + 8 + 16 + 32) = 12.6 seconds
 543          * (with retries set to 5)
 544          */
 545         if (procnum == NLM_NULL)
 546                 wait = nlm_nullrpc_wait;
 547 
 548         /*
 549          * We need to block signals in case of NLM_CANCEL RPC
 550          * in order to prevent interruption of network RPC
 551          * calls.
 552          */
 553         if (procnum == NLM_CANCEL) {
 554                 k_sigset_t newmask;
 555 
 556                 sigfillset(&newmask);
 557                 sigreplace(&newmask, &oldmask);
 558                 sig_blocked = TRUE;
 559         }
 560 
 561         stat = clnt_call(clnt, procnum, xdr_args,
 562             argsp, xdr_result, resultp, wait);
 563 
 564         /*
 565          * Restore signal mask back if signals were blocked
 566          */
 567         if (sig_blocked)
 568                 sigreplace(&oldmask, (k_sigset_t *)NULL);