recovery: operations take stateid_arg instead of stateid4

operations that require a stateid now take stateid_arg for recovery information.  these operations include close, setattr, lock/unlock, layoutget, and read/write (including pnfs)

nfs41_open_stateid_arg() locks nfs41_open_state and copies its stateid into a stateid_arg
nfs41_lock_stateid_arg() locks nfs41_open_state.last_lock and copies its stateid into a stateid_arg; if there is no lock state, it falls back to nfs41_open_stateid_arg()

pnfs_read/write() now take nfs41_open_state so they can generate stateid_args

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-11-15 14:59:49 -05:00 committed by unknown
parent d59d17c3b4
commit 3ecd38e414
12 changed files with 205 additions and 227 deletions

View file

@ -94,6 +94,17 @@ void nfs41_open_state_deref(
free(state);
}
void nfs41_open_stateid_arg(
IN nfs41_open_state *state,
OUT stateid_arg *arg)
{
AcquireSRWLockShared(&state->lock);
memcpy(&arg->stateid, &state->stateid, sizeof(stateid4));
ReleaseSRWLockShared(&state->lock);
arg->type = STATEID_OPEN;
arg->open = state;
}
/* client list of associated open state */
static void client_state_add(
@ -491,7 +502,10 @@ static void cancel_open(IN nfs41_upcall *upcall)
goto out; /* if handle_open() failed, the state was already freed */
if (state->do_close) {
status = nfs41_close(state->session, state);
stateid_arg stateid;
nfs41_open_stateid_arg(state, &stateid);
status = nfs41_close(state->session, &state->file, &stateid);
if (status)
dprintf(1, "cancel_open: nfs41_close() failed with %s\n",
nfs_error_string(status));
@ -569,7 +583,10 @@ static int handle_close(nfs41_upcall *upcall)
}
if (state->do_close) {
status = nfs41_close(state->session, state);
stateid_arg stateid;
nfs41_open_stateid_arg(state, &stateid);
status = nfs41_close(state->session, &state->file, &stateid);
if (status) {
dprintf(1, "nfs41_close() failed with error %s.\n",
nfs_error_string(status));