Skip to content

Commit

Permalink
Merge branch 'tp/stateid-ibm-next' into ibm_next_tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
Venkateswararao Jujjuri committed May 10, 2012
2 parents f91576c + ea03f37 commit 826e0fc
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 197 deletions.
17 changes: 9 additions & 8 deletions src/MainNFSD/nfs_init.c
Expand Up @@ -82,7 +82,11 @@

/* nfs_parameter_t nfs_param = {0}; */
nfs_parameter_t nfs_param;
time_t ServerBootTime = 0;

/* ServerEpoch is ServerBootTime unless overriden by -E command line option */
time_t ServerBootTime;
time_t ServerEpoch;

nfs_worker_data_t *workers_data = NULL;
hash_table_t *fh_to_cache_entry_ht = NULL; /* Cache inode handle lookup table */
verifier4 NFS4_write_verifier; /* NFS V4 write verifier */
Expand Down Expand Up @@ -500,16 +504,16 @@ void nfs_set_param_default()
nfs_param.state_id_param.hash_param.index_size = PRIME_STATE_ID;
nfs_param.state_id_param.hash_param.alphabet_length = 10; /* ipaddr is a numerical decimal value */
nfs_param.state_id_param.hash_param.nb_node_prealloc = NB_PREALLOC_HASH_STATE_ID;
nfs_param.state_id_param.hash_param.hash_func_key = NULL ;
nfs_param.state_id_param.hash_param.hash_func_rbt = NULL ;
nfs_param.state_id_param.hash_param.hash_func_both = state_id_hash_both ;
nfs_param.state_id_param.hash_param.hash_func_key = state_id_value_hash_func;
nfs_param.state_id_param.hash_param.hash_func_rbt = state_id_rbt_hash_func;
nfs_param.state_id_param.hash_param.hash_func_both = NULL;
nfs_param.state_id_param.hash_param.compare_key = compare_state_id;
nfs_param.state_id_param.hash_param.key_to_str = display_state_id_key;
nfs_param.state_id_param.hash_param.val_to_str = display_state_id_val;
nfs_param.state_id_param.hash_param.name = "State ID";

#ifdef _USE_NFS4_1
/* NFSv4 State Id hash */
/* NFSv4 Session Id hash */
nfs_param.session_id_param.hash_param.index_size = PRIME_STATE_ID;
nfs_param.session_id_param.hash_param.alphabet_length = 10; /* ipaddr is a numerical decimal value */
nfs_param.session_id_param.hash_param.nb_node_prealloc = NB_PREALLOC_HASH_STATE_ID;
Expand Down Expand Up @@ -2010,9 +2014,6 @@ void nfs_start(nfs_start_info_t * p_start_info)
/* Print the worker parameters in log */
Print_param_worker_in_log(&(nfs_param.worker_param));

/* Set the server's boot time */
ServerBootTime = time(NULL);

/* Set the write verifiers */
memset(NFS3_write_verifier, 0, sizeof(writeverf3));
memcpy(NFS3_write_verifier, &ServerBootTime, sizeof(time_t));
Expand Down
11 changes: 10 additions & 1 deletion src/MainNFSD/nfs_main.c
Expand Up @@ -70,7 +70,7 @@ char ganesha_exec_path[MAXPATHLEN];

/* command line syntax */

char options[] = "h@RTdS:F:S:P:f:L:N:p:";
char options[] = "h@RTdS:F:S:P:f:L:N:E:p:";
char usage[] =
"Usage: %s [-hd][-L <logfile>][-N <dbg_lvl>][-f <config_file>]\n"
"\t[-h] display this help\n"
Expand All @@ -81,6 +81,7 @@ char usage[] =
"\t[-d] the daemon starts in background, in a new process group\n"
"\t[-R] daemon will manage RPCSEC_GSS (default is no RPCSEC_GSS)\n"
"\t[-T] dump the default configuration on stdout\n"
"\t[-E] <epoch<] overrides ServerBootTime for ServerEpoch\n"
"----------------- Signals ----------------\n"
"SIGUSR1 : Enable/Disable File Content Cache forced flush\n"
"SIGTERM : Cleanly terminate the program\n"
Expand Down Expand Up @@ -112,6 +113,10 @@ int main(int argc, char *argv[])
#endif
sigset_t signals_to_block;

/* Set the server's boot time and epoch */
ServerBootTime = time(NULL);
ServerEpoch = ServerBootTime;

/* retrieve executable file's name */
strncpy(ganesha_exec_path, argv[0], MAXPATHLEN);

Expand Down Expand Up @@ -198,6 +203,10 @@ int main(int argc, char *argv[])
my_nfs_start_info.dump_default_config = TRUE;
break;

case 'E':
ServerEpoch = (time_t) atoll(optarg);
break;

case '?':
case 'h':
default:
Expand Down
20 changes: 2 additions & 18 deletions src/SAL/nfs4_state.c
Expand Up @@ -199,24 +199,8 @@ state_status_t state_add_impl(cache_entry_t * pentry,
}
}

/* Add the stateid.other, this will increment pentry->object.file.state_current_counter */
if(!nfs4_BuildStateId_Other(pentry,
pcontext,
powner_input,
pnew_state->stateid_other))
{
LogDebug(COMPONENT_STATE,
"Can't create a new state id for the pentry %p (E)", pentry);

ReleaseToPool(pnew_state, &pclient->pool_state_v4);

*pstatus = STATE_STATE_ERROR;

if(got_pinned)
cache_inode_dec_pin_ref(pentry);

return *pstatus;
}
/* Add the stateid.other, this will increment state_id_counter */
nfs4_BuildStateId_Other(pnew_state->stateid_other);

/* Set the type and data for this state */
memcpy(&(pnew_state->state_data), pstate_data, sizeof(state_data_t));
Expand Down

0 comments on commit 826e0fc

Please sign in to comment.