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


 371         struct nlm_shres        *nh_shrlist;            /* (l) */
 372         kthread_t               *nh_reclaimer;          /* (l) */
 373 };
 374 TAILQ_HEAD(nlm_host_list, nlm_host);
 375 
 376 /*
 377  * nlm_nsm structure describes RPC client handle that can be
 378  * used to communicate with local NSM via kRPC.
 379  *
 380  * We need to wrap handle with nlm_nsm structure because kRPC
 381  * can not share one handle between several threads. It's assumed
 382  * that NLM uses only one NSM handle per zone, thus all RPC operations
 383  * on NSM's handle are serialized using nlm_nsm->sem semaphore.
 384  *
 385  * nlm_nsm also contains refcnt field used for reference counting.
 386  * It's used because there exist a possibility of simultaneous
 387  * execution of NLM shutdown operation and host monitor/unmonitor
 388  * operations.
 389  *
 390  * struct nlm_nsm:
 391  *  ns_sem: a semaphore for serialization network operations to statd
 392  *  ns_knc: a kneconfig describing transport that is used for communication
 393  *  ns_addr: an address of local statd we're talking to
 394  *  ns_handle: an RPC handle used for talking to local statd using the status
 395  *      monitor protocol (SM_PROG)
 396  *  ns_addr_handle: an RPC handle used for talking to local statd using the
 397  *      address registration protocol (NSM_ADDR_PROGRAM)
 398  */
 399 struct nlm_nsm {
 400         ksema_t                 ns_sem;
 401         struct knetconfig       ns_knc;          /* (c) */
 402         struct netbuf           ns_addr;         /* (c) */
 403         CLIENT                  *ns_handle;      /* (c) */
 404         CLIENT                  *ns_addr_handle; /* (c) */
 405 };
 406 
 407 /*
 408  * Could use flock.h flk_nlm_status_t instead, but
 409  * prefer our own enum with initial zero...
 410  */
 411 typedef enum {
 412         NLM_ST_DOWN = 0,
 413         NLM_ST_STOPPING,
 414         NLM_ST_UP,
 415         NLM_ST_STARTING
 416 } nlm_run_status_t;
 417 
 418 /*
 419  * nlm_globals structure allows NLM be zone aware. The structure
 420  * collects all "global variables" NLM has for each zone.




 371         struct nlm_shres        *nh_shrlist;            /* (l) */
 372         kthread_t               *nh_reclaimer;          /* (l) */
 373 };
 374 TAILQ_HEAD(nlm_host_list, nlm_host);
 375 
 376 /*
 377  * nlm_nsm structure describes RPC client handle that can be
 378  * used to communicate with local NSM via kRPC.
 379  *
 380  * We need to wrap handle with nlm_nsm structure because kRPC
 381  * can not share one handle between several threads. It's assumed
 382  * that NLM uses only one NSM handle per zone, thus all RPC operations
 383  * on NSM's handle are serialized using nlm_nsm->sem semaphore.
 384  *
 385  * nlm_nsm also contains refcnt field used for reference counting.
 386  * It's used because there exist a possibility of simultaneous
 387  * execution of NLM shutdown operation and host monitor/unmonitor
 388  * operations.
 389  *
 390  * struct nlm_nsm:
 391  *  ns_lock: a mutex for serialization network operations to statd
 392  *  ns_knc: a kneconfig describing transport that is used for communication
 393  *  ns_addr: an address of local statd we're talking to
 394  *  ns_handle: an RPC handle used for talking to local statd using the status
 395  *      monitor protocol (SM_PROG)
 396  *  ns_addr_handle: an RPC handle used for talking to local statd using the
 397  *      address registration protocol (NSM_ADDR_PROGRAM)
 398  */
 399 struct nlm_nsm {
 400         kmutex_t                ns_lock;
 401         struct knetconfig       ns_knc;          /* (c) */
 402         struct netbuf           ns_addr;         /* (c) */
 403         CLIENT                  *ns_handle;      /* (c) */
 404         CLIENT                  *ns_addr_handle; /* (c) */
 405 };
 406 
 407 /*
 408  * Could use flock.h flk_nlm_status_t instead, but
 409  * prefer our own enum with initial zero...
 410  */
 411 typedef enum {
 412         NLM_ST_DOWN = 0,
 413         NLM_ST_STOPPING,
 414         NLM_ST_UP,
 415         NLM_ST_STARTING
 416 } nlm_run_status_t;
 417 
 418 /*
 419  * nlm_globals structure allows NLM be zone aware. The structure
 420  * collects all "global variables" NLM has for each zone.