Print this page
Dan mods to NFS desgin problems re. multiple zone keys
Do rfs4_ss_fini() BEFORE rfs4_servinst_destroy_all().
Go ahead and destroy the NFSv4 database tables

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs4_state.c
          +++ new/usr/src/uts/common/fs/nfs/nfs4_state.c
↓ open down ↓ 1488 lines elided ↑ open up ↑
1489 1489   */
1490 1490  void
1491 1491  rfs4_state_zone_fini()
1492 1492  {
1493 1493          rfs4_database_t *dbp;
1494 1494          nfs4_srv_t *nsrv4;
1495 1495          nsrv4 = nfs4_get_srv();
1496 1496  
1497 1497          rfs4_set_deleg_policy(nsrv4, SRV_NEVER_DELEGATE);
1498 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 +
1499 1507          mutex_enter(&nsrv4->state_lock);
1500 1508  
1501 1509          if (nsrv4->nfs4_server_state == NULL) {
1502 1510                  mutex_exit(&nsrv4->state_lock);
1503 1511                  return;
1504 1512          }
1505 1513  
1506 1514          /* destroy server instances and current instance ptr */
1507 1515          rfs4_servinst_destroy_all(nsrv4);
1508 1516  
↓ open down ↓ 1 lines elided ↑ open up ↑
1510 1518          nsrv4->seen_first_compound = 0;
1511 1519  
1512 1520          dbp = nsrv4->nfs4_server_state;
1513 1521          nsrv4->nfs4_server_state = NULL;
1514 1522  
1515 1523          rw_destroy(&nsrv4->rfs4_findclient_lock);
1516 1524  
1517 1525          /* First stop all of the reaper threads in the database */
1518 1526          rfs4_database_shutdown(dbp);
1519 1527          /*
1520      -         * XXX workaround
1521      -         * Skip destrying the state database yet just in case there
1522      -         * are unfinished operations depending on it.
     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.
1523 1533           */
1524 1534          /* Now destroy/release the database tables */
1525      -        /* rfs4_database_destroy(dbp); */
     1535 +        rfs4_database_destroy(dbp);
1526 1536  
1527 1537          /* Reset the cache timers for next time */
1528 1538          nsrv4->rfs4_client_cache_time = 0;
1529 1539          nsrv4->rfs4_openowner_cache_time = 0;
1530 1540          nsrv4->rfs4_state_cache_time = 0;
1531 1541          nsrv4->rfs4_lo_state_cache_time = 0;
1532 1542          nsrv4->rfs4_lockowner_cache_time = 0;
1533 1543          nsrv4->rfs4_file_cache_time = 0;
1534 1544          nsrv4->rfs4_deleg_state_cache_time = 0;
1535 1545  
1536 1546          mutex_exit(&nsrv4->state_lock);
1537      -
1538      -        /* clean up any dangling stable storage structures */
1539      -        rfs4_ss_fini(nsrv4);
1540 1547  }
1541 1548  
1542 1549  typedef union {
1543 1550          struct {
1544 1551                  uint32_t start_time;
1545 1552                  uint32_t c_id;
1546 1553          } impl_id;
1547 1554          clientid4 id4;
1548 1555  } cid;
1549 1556  
↓ open down ↓ 2566 lines elided ↑ open up ↑
4116 4123          ASSERT(ng->nfs_zoneid == exi->exi_zoneid);
4117 4124          nsrv4 = ng->nfs4_srv;
4118 4125  
4119 4126          mutex_enter(&nsrv4->state_lock);
4120 4127  
4121 4128          if (nsrv4->nfs4_server_state == NULL) {
4122 4129                  mutex_exit(&nsrv4->state_lock);
4123 4130                  return;
4124 4131          }
4125 4132  
4126      -        /* CSTYLED */
4127      -        rfs4_dbe_walk(nsrv4->rfs4_lo_state_tab, rfs4_lo_state_walk_callout, exi);
     4133 +        rfs4_dbe_walk(nsrv4->rfs4_lo_state_tab,
     4134 +            rfs4_lo_state_walk_callout, exi);
4128 4135          rfs4_dbe_walk(nsrv4->rfs4_state_tab, rfs4_state_walk_callout, exi);
4129      -        /* CSTYLED */
4130      -        rfs4_dbe_walk(nsrv4->rfs4_deleg_state_tab, rfs4_deleg_state_walk_callout, exi);
     4136 +        rfs4_dbe_walk(nsrv4->rfs4_deleg_state_tab,
     4137 +            rfs4_deleg_state_walk_callout, exi);
4131 4138          rfs4_dbe_walk(nsrv4->rfs4_file_tab, rfs4_file_walk_callout, exi);
4132 4139  
4133 4140          mutex_exit(&nsrv4->state_lock);
4134 4141  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX