Print this page
Do rfs4_ss_fini() BEFORE rfs4_servinst_destroy_all().


1479 
1480         /*
1481          * Init the stable storage.
1482          */
1483         rfs4_ss_init(nsrv4);
1484 }
1485 
1486 /*
1487  * Used at server shutdown to cleanup all of NFSv4 server's zone structures
1488  * and state.
1489  */
1490 void
1491 rfs4_state_zone_fini()
1492 {
1493         rfs4_database_t *dbp;
1494         nfs4_srv_t *nsrv4;
1495         nsrv4 = zone_getspecific(rfs4_zone_key, curzone);
1496 
1497         rfs4_set_deleg_policy(nsrv4, SRV_NEVER_DELEGATE);
1498 








1499         mutex_enter(&nsrv4->state_lock);
1500 
1501         if (nsrv4->nfs4_server_state == NULL) {
1502                 mutex_exit(&nsrv4->state_lock);
1503                 return;
1504         }
1505 
1506         /* destroy server instances and current instance ptr */
1507         rfs4_servinst_destroy_all(nsrv4);
1508 
1509         /* reset the "first NFSv4 request" status */
1510         nsrv4->seen_first_compound = 0;
1511 
1512         dbp = nsrv4->nfs4_server_state;
1513         nsrv4->nfs4_server_state = NULL;
1514 
1515         rw_destroy(&nsrv4->rfs4_findclient_lock);
1516 
1517         /* First stop all of the reaper threads in the database */
1518         rfs4_database_shutdown(dbp);
1519         /*
1520          * WARNING: There may be consumers of the rfs4 database still
1521          * active as we destroy these.  IF that's the case, consider putting
1522          * some of their _zone_fini()-like functions into the zsd key as
1523          * ~~SHUTDOWN~~ functions instead of ~~DESTROY~~ functions.  We can
1524          * maintain some ordering guarantees better that way.
1525          */
1526         /* Now destroy/release the database tables */
1527         rfs4_database_destroy(dbp);
1528 
1529         /* Reset the cache timers for next time */
1530         nsrv4->rfs4_client_cache_time = 0;
1531         nsrv4->rfs4_openowner_cache_time = 0;
1532         nsrv4->rfs4_state_cache_time = 0;
1533         nsrv4->rfs4_lo_state_cache_time = 0;
1534         nsrv4->rfs4_lockowner_cache_time = 0;
1535         nsrv4->rfs4_file_cache_time = 0;
1536         nsrv4->rfs4_deleg_state_cache_time = 0;
1537 
1538         mutex_exit(&nsrv4->state_lock);
1539 
1540         /* clean up any dangling stable storage structures */
1541         rfs4_ss_fini(nsrv4);
1542 }
1543 
1544 typedef union {
1545         struct {
1546                 uint32_t start_time;
1547                 uint32_t c_id;
1548         } impl_id;
1549         clientid4 id4;
1550 } cid;
1551 
1552 static int foreign_stateid(stateid_t *id);
1553 static int foreign_clientid(cid *cidp);
1554 static void embed_nodeid(cid *cidp);
1555 
1556 typedef union {
1557         struct {
1558                 uint32_t c_id;
1559                 uint32_t gen_num;
1560         } cv_impl;
1561         verifier4       confirm_verf;




1479 
1480         /*
1481          * Init the stable storage.
1482          */
1483         rfs4_ss_init(nsrv4);
1484 }
1485 
1486 /*
1487  * Used at server shutdown to cleanup all of NFSv4 server's zone structures
1488  * and state.
1489  */
1490 void
1491 rfs4_state_zone_fini()
1492 {
1493         rfs4_database_t *dbp;
1494         nfs4_srv_t *nsrv4;
1495         nsrv4 = zone_getspecific(rfs4_zone_key, curzone);
1496 
1497         rfs4_set_deleg_policy(nsrv4, SRV_NEVER_DELEGATE);
1498 
1499         /*
1500          * Clean up any dangling stable storage structures BEFORE calling
1501          * rfs4_servinst_destroy_all() so there are no dangling structures
1502          * (i.e. the srvinsts are all cleared of danglers BEFORE they get
1503          * freed).
1504          */
1505         rfs4_ss_fini(nsrv4);
1506 
1507         mutex_enter(&nsrv4->state_lock);
1508 
1509         if (nsrv4->nfs4_server_state == NULL) {
1510                 mutex_exit(&nsrv4->state_lock);
1511                 return;
1512         }
1513 
1514         /* destroy server instances and current instance ptr */
1515         rfs4_servinst_destroy_all(nsrv4);
1516 
1517         /* reset the "first NFSv4 request" status */
1518         nsrv4->seen_first_compound = 0;
1519 
1520         dbp = nsrv4->nfs4_server_state;
1521         nsrv4->nfs4_server_state = NULL;
1522 
1523         rw_destroy(&nsrv4->rfs4_findclient_lock);
1524 
1525         /* First stop all of the reaper threads in the database */
1526         rfs4_database_shutdown(dbp);
1527         /*
1528          * WARNING: There may be consumers of the rfs4 database still
1529          * active as we destroy these.  IF that's the case, consider putting
1530          * some of their _zone_fini()-like functions into the zsd key as
1531          * ~~SHUTDOWN~~ functions instead of ~~DESTROY~~ functions.  We can
1532          * maintain some ordering guarantees better that way.
1533          */
1534         /* Now destroy/release the database tables */
1535         rfs4_database_destroy(dbp);
1536 
1537         /* Reset the cache timers for next time */
1538         nsrv4->rfs4_client_cache_time = 0;
1539         nsrv4->rfs4_openowner_cache_time = 0;
1540         nsrv4->rfs4_state_cache_time = 0;
1541         nsrv4->rfs4_lo_state_cache_time = 0;
1542         nsrv4->rfs4_lockowner_cache_time = 0;
1543         nsrv4->rfs4_file_cache_time = 0;
1544         nsrv4->rfs4_deleg_state_cache_time = 0;
1545 
1546         mutex_exit(&nsrv4->state_lock);



1547 }
1548 
1549 typedef union {
1550         struct {
1551                 uint32_t start_time;
1552                 uint32_t c_id;
1553         } impl_id;
1554         clientid4 id4;
1555 } cid;
1556 
1557 static int foreign_stateid(stateid_t *id);
1558 static int foreign_clientid(cid *cidp);
1559 static void embed_nodeid(cid *cidp);
1560 
1561 typedef union {
1562         struct {
1563                 uint32_t c_id;
1564                 uint32_t gen_num;
1565         } cv_impl;
1566         verifier4       confirm_verf;