1049 /*
1050 * DSS: distributed stable storage.
1051 * Unpack the list of paths passed by nfsd.
1052 * Use nvlist_alloc(9F) to manage the data.
1053 * The caller is responsible for allocating and freeing the buffer.
1054 */
1055 int
1056 rfs4_dss_setpaths(char *buf, size_t buflen)
1057 {
1058 int error;
1059
1060 /*
1061 * If this is a "warm start", i.e. we previously had DSS paths,
1062 * preserve the old paths.
1063 */
1064 if (rfs4_dss_paths != NULL) {
1065 /*
1066 * Before we lose the ptr, destroy the nvlist and pathnames
1067 * array from the warm start before this one.
1068 */
1069 if (rfs4_dss_oldpaths)
1070 nvlist_free(rfs4_dss_oldpaths);
1071 rfs4_dss_oldpaths = rfs4_dss_paths;
1072 }
1073
1074 /* unpack the buffer into a searchable nvlist */
1075 error = nvlist_unpack(buf, buflen, &rfs4_dss_paths, KM_SLEEP);
1076 if (error)
1077 return (error);
1078
1079 /*
1080 * Search the nvlist for the pathnames nvpair (which is the only nvpair
1081 * in the list, and record its location.
1082 */
1083 error = nvlist_lookup_string_array(rfs4_dss_paths, NFS4_DSS_NVPAIR_NAME,
1084 &rfs4_dss_newpaths, &rfs4_dss_numnewpaths);
1085 return (error);
1086 }
1087
1088 /*
1089 * Ultimately the nfssys() call NFS4_CLR_STATE endsup here
1448 rfs4_database_destroy(dbp);
1449
1450 /* Reset the cache timers for next time */
1451 rfs4_client_cache_time = 0;
1452 rfs4_openowner_cache_time = 0;
1453 rfs4_state_cache_time = 0;
1454 rfs4_lo_state_cache_time = 0;
1455 rfs4_lockowner_cache_time = 0;
1456 rfs4_file_cache_time = 0;
1457 rfs4_deleg_state_cache_time = 0;
1458
1459 mutex_exit(&rfs4_state_lock);
1460
1461 /* destroy server instances and current instance ptr */
1462 rfs4_servinst_destroy_all();
1463
1464 /* reset the "first NFSv4 request" status */
1465 rfs4_seen_first_compound = 0;
1466
1467 /* DSS: distributed stable storage */
1468 if (rfs4_dss_oldpaths)
1469 nvlist_free(rfs4_dss_oldpaths);
1470 if (rfs4_dss_paths)
1471 nvlist_free(rfs4_dss_paths);
1472 rfs4_dss_paths = rfs4_dss_oldpaths = NULL;
1473 }
1474
1475 typedef union {
1476 struct {
1477 uint32_t start_time;
1478 uint32_t c_id;
1479 } impl_id;
1480 clientid4 id4;
1481 } cid;
1482
1483 static int foreign_stateid(stateid_t *id);
1484 static int foreign_clientid(cid *cidp);
1485 static void embed_nodeid(cid *cidp);
1486
1487 typedef union {
1488 struct {
1489 uint32_t c_id;
1490 uint32_t gen_num;
|
1049 /*
1050 * DSS: distributed stable storage.
1051 * Unpack the list of paths passed by nfsd.
1052 * Use nvlist_alloc(9F) to manage the data.
1053 * The caller is responsible for allocating and freeing the buffer.
1054 */
1055 int
1056 rfs4_dss_setpaths(char *buf, size_t buflen)
1057 {
1058 int error;
1059
1060 /*
1061 * If this is a "warm start", i.e. we previously had DSS paths,
1062 * preserve the old paths.
1063 */
1064 if (rfs4_dss_paths != NULL) {
1065 /*
1066 * Before we lose the ptr, destroy the nvlist and pathnames
1067 * array from the warm start before this one.
1068 */
1069 nvlist_free(rfs4_dss_oldpaths);
1070 rfs4_dss_oldpaths = rfs4_dss_paths;
1071 }
1072
1073 /* unpack the buffer into a searchable nvlist */
1074 error = nvlist_unpack(buf, buflen, &rfs4_dss_paths, KM_SLEEP);
1075 if (error)
1076 return (error);
1077
1078 /*
1079 * Search the nvlist for the pathnames nvpair (which is the only nvpair
1080 * in the list, and record its location.
1081 */
1082 error = nvlist_lookup_string_array(rfs4_dss_paths, NFS4_DSS_NVPAIR_NAME,
1083 &rfs4_dss_newpaths, &rfs4_dss_numnewpaths);
1084 return (error);
1085 }
1086
1087 /*
1088 * Ultimately the nfssys() call NFS4_CLR_STATE endsup here
1447 rfs4_database_destroy(dbp);
1448
1449 /* Reset the cache timers for next time */
1450 rfs4_client_cache_time = 0;
1451 rfs4_openowner_cache_time = 0;
1452 rfs4_state_cache_time = 0;
1453 rfs4_lo_state_cache_time = 0;
1454 rfs4_lockowner_cache_time = 0;
1455 rfs4_file_cache_time = 0;
1456 rfs4_deleg_state_cache_time = 0;
1457
1458 mutex_exit(&rfs4_state_lock);
1459
1460 /* destroy server instances and current instance ptr */
1461 rfs4_servinst_destroy_all();
1462
1463 /* reset the "first NFSv4 request" status */
1464 rfs4_seen_first_compound = 0;
1465
1466 /* DSS: distributed stable storage */
1467 nvlist_free(rfs4_dss_oldpaths);
1468 nvlist_free(rfs4_dss_paths);
1469 rfs4_dss_paths = rfs4_dss_oldpaths = NULL;
1470 }
1471
1472 typedef union {
1473 struct {
1474 uint32_t start_time;
1475 uint32_t c_id;
1476 } impl_id;
1477 clientid4 id4;
1478 } cid;
1479
1480 static int foreign_stateid(stateid_t *id);
1481 static int foreign_clientid(cid *cidp);
1482 static void embed_nodeid(cid *cidp);
1483
1484 typedef union {
1485 struct {
1486 uint32_t c_id;
1487 uint32_t gen_num;
|