Print this page
XXXXX convert NLM's single-count semaphore to a mutex


 294          * procedure which is called by the native rpc.statd.
 295          *
 296          * The Linux RPC call to "unmonitor" a host expects the same arguments
 297          * as we pass to monitor, so that is also handled here by this same
 298          * brand hook.
 299          */
 300         nlm_netbuf_to_netobj(&host->nh_addr, &family, &obj);
 301         nsm = &g->nlm_nsm;
 302 
 303         bzero(&args, sizeof (args));
 304 
 305         mip->mon_name = host->nh_name;
 306         mip->my_id.my_name = uts_nodename();
 307         mip->my_id.my_prog = NLM_PROG;
 308         mip->my_id.my_vers = NLM_SM;
 309         mip->my_id.my_proc = LX_NLMPROC_NSM_NOTIFY;
 310         if (op == SM_MON) {
 311                 bcopy(&host->nh_sysid, args.priv, sizeof (uint16_t));
 312         }
 313 
 314         sema_p(&nsm->ns_sem);
 315         nlm_nsm_clnt_init(nsm->ns_handle, nsm);
 316         if (op == SM_MON) {
 317                 struct sm_stat_res mres;
 318 
 319                 bzero(&mres, sizeof (mres));
 320                 stat = sm_mon_1(&args, &mres, nsm->ns_handle);
 321         } else {
 322                 struct sm_stat ures;
 323 
 324                 ASSERT(op == SM_UNMON);
 325                 bzero(&ures, sizeof (ures));
 326                 stat = sm_unmon_1(mip, &ures, nsm->ns_handle);
 327         }
 328         sema_v(&nsm->ns_sem);
 329 
 330         if (stat != RPC_SUCCESS) {
 331                 NLM_WARN("Failed to contact local statd, stat=%d", stat);
 332                 if (op == SM_MON) {
 333                         mutex_enter(&g->lock);
 334                         host->nh_flags &= ~NLM_NH_MONITORED;
 335                         mutex_exit(&g->lock);
 336                 }
 337         }
 338 }


 294          * procedure which is called by the native rpc.statd.
 295          *
 296          * The Linux RPC call to "unmonitor" a host expects the same arguments
 297          * as we pass to monitor, so that is also handled here by this same
 298          * brand hook.
 299          */
 300         nlm_netbuf_to_netobj(&host->nh_addr, &family, &obj);
 301         nsm = &g->nlm_nsm;
 302 
 303         bzero(&args, sizeof (args));
 304 
 305         mip->mon_name = host->nh_name;
 306         mip->my_id.my_name = uts_nodename();
 307         mip->my_id.my_prog = NLM_PROG;
 308         mip->my_id.my_vers = NLM_SM;
 309         mip->my_id.my_proc = LX_NLMPROC_NSM_NOTIFY;
 310         if (op == SM_MON) {
 311                 bcopy(&host->nh_sysid, args.priv, sizeof (uint16_t));
 312         }
 313 
 314         mutex_enter(&nsm->ns_lock);
 315         nlm_nsm_clnt_init(nsm->ns_handle, nsm);
 316         if (op == SM_MON) {
 317                 struct sm_stat_res mres;
 318 
 319                 bzero(&mres, sizeof (mres));
 320                 stat = sm_mon_1(&args, &mres, nsm->ns_handle);
 321         } else {
 322                 struct sm_stat ures;
 323 
 324                 ASSERT(op == SM_UNMON);
 325                 bzero(&ures, sizeof (ures));
 326                 stat = sm_unmon_1(mip, &ures, nsm->ns_handle);
 327         }
 328         mutex_exit(&nsm->ns_lock);
 329 
 330         if (stat != RPC_SUCCESS) {
 331                 NLM_WARN("Failed to contact local statd, stat=%d", stat);
 332                 if (op == SM_MON) {
 333                         mutex_enter(&g->lock);
 334                         host->nh_flags &= ~NLM_NH_MONITORED;
 335                         mutex_exit(&g->lock);
 336                 }
 337         }
 338 }