open: nfs41_rpc_open() takes open_claim4 and open_delegation4
combined nfs41_open() and nfs41_open_reclaim() into nfs41_rpc_open() by factoring out the open_claim4 argument. new function nfs41_open() in open.c deals with the nfs41_open_state, adding it to the client's list, and handles any delegations granted added xdr for OPEN CLAIM types CLAIM_DELEGATE_CUR, CLAIM_DELEG_CUR_FH, CLAIM_DELEGATE_PREV, CLAIM_DELEG_PREV_FH (the _FH types are new to 4.1, and not supported by linux server) Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
2b5a5fb071
commit
0c874a66ba
7 changed files with 187 additions and 182 deletions
|
|
@ -139,6 +139,38 @@ void client_state_remove(
|
|||
LeaveCriticalSection(&client->state.lock);
|
||||
}
|
||||
|
||||
int nfs41_open(
|
||||
IN OUT nfs41_open_state *state,
|
||||
IN uint32_t create,
|
||||
IN uint32_t createhow,
|
||||
IN uint32_t mode,
|
||||
IN bool_t try_recovery,
|
||||
OUT OPTIONAL nfs41_file_info *info)
|
||||
{
|
||||
open_claim4 claim;
|
||||
open_delegation4 delegation = { 0 };
|
||||
int status;
|
||||
|
||||
claim.claim = CLAIM_NULL;
|
||||
claim.u.null.filename = &state->file.name;
|
||||
|
||||
status = nfs41_rpc_open(state->session, &state->parent, &state->file,
|
||||
&state->owner, &claim, state->share_access, state->share_deny,
|
||||
create, createhow, mode, TRUE, &state->stateid, &delegation, info);
|
||||
if (status)
|
||||
goto out;
|
||||
|
||||
if (delegation.type == OPEN_DELEGATE_READ ||
|
||||
delegation.type == OPEN_DELEGATE_WRITE)
|
||||
nfs41_delegreturn(state->session, &state->file, &delegation.stateid);
|
||||
|
||||
/* register the client's open state on success */
|
||||
client_state_add(state);
|
||||
state->do_close = 1;
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* NFS41_OPEN */
|
||||
static int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||
|
|
@ -477,17 +509,11 @@ static int handle_open(nfs41_upcall *upcall)
|
|||
args->std_info.Directory = 1;
|
||||
args->created = status == NFS4_OK ? TRUE : FALSE;
|
||||
} else {
|
||||
status = nfs41_open(state->session, state->share_access,
|
||||
state->share_deny, create, createhowmode, args->mode,
|
||||
TRUE, state, &info);
|
||||
|
||||
status = nfs41_open(state, create, createhowmode,
|
||||
args->mode, TRUE, &info);
|
||||
if (status == NFS4_OK) {
|
||||
/* add to the client's list of state for recovery */
|
||||
client_state_add(state);
|
||||
|
||||
nfs_to_basic_info(&info, &args->basic_info);
|
||||
nfs_to_standard_info(&info, &args->std_info);
|
||||
state->do_close = 1;
|
||||
args->mode = info.mode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue