open: clean up patch for nfs41_rpc_open()

nfs41_open() in open.c is no longer used for recovery, so made static and renamed to do_open().  renamed nfs41_rpc_open() back to nfs41_open()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-07-18 15:50:17 -04:00 committed by unknown
parent 8ef3ec9247
commit 6878e71ec0
6 changed files with 18 additions and 24 deletions

View file

@ -391,7 +391,7 @@ int nfs41_delegation_to_open(
claim.u.deleg_cur.delegate_stateid = &deleg_stateid; claim.u.deleg_cur.delegate_stateid = &deleg_stateid;
claim.u.deleg_cur.name = &open->file.name; claim.u.deleg_cur.name = &open->file.name;
status = nfs41_rpc_open(open->session, &open->parent, &open->file, status = nfs41_open(open->session, &open->parent, &open->file,
&open->owner, &claim, open->share_access, open->share_deny, &open->owner, &claim, open->share_access, open->share_deny,
OPEN4_NOCREATE, 0, 0, try_recovery, &open_stateid, &ignore, NULL); OPEN4_NOCREATE, 0, 0, try_recovery, &open_stateid, &ignore, NULL);
if (status) if (status)

View file

@ -471,12 +471,4 @@ void nfs41_open_stateid_arg(
IN nfs41_open_state *state, IN nfs41_open_state *state,
OUT struct __stateid_arg *arg); OUT struct __stateid_arg *arg);
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);
#endif /* __NFS41__ */ #endif /* __NFS41__ */

View file

@ -302,7 +302,7 @@ out:
return status; return status;
} }
int nfs41_rpc_open( int nfs41_open(
IN nfs41_session *session, IN nfs41_session *session,
IN nfs41_path_fh *parent, IN nfs41_path_fh *parent,
IN nfs41_path_fh *file, IN nfs41_path_fh *file,

View file

@ -997,7 +997,7 @@ int nfs41_lookup(
OUT OPTIONAL nfs41_file_info *info_out, OUT OPTIONAL nfs41_file_info *info_out,
OUT nfs41_session **session_out); OUT nfs41_session **session_out);
int nfs41_rpc_open( int nfs41_open(
IN nfs41_session *session, IN nfs41_session *session,
IN nfs41_path_fh *parent, IN nfs41_path_fh *parent,
IN nfs41_path_fh *file, IN nfs41_path_fh *file,

View file

@ -185,13 +185,13 @@ static void client_state_remove(
LeaveCriticalSection(&client->state.lock); LeaveCriticalSection(&client->state.lock);
} }
int nfs41_open( static int do_open(
IN OUT nfs41_open_state *state, IN OUT nfs41_open_state *state,
IN uint32_t create, IN uint32_t create,
IN uint32_t createhow, IN uint32_t createhow,
IN uint32_t mode, IN uint32_t mode,
IN bool_t try_recovery, IN bool_t try_recovery,
OUT OPTIONAL nfs41_file_info *info) OUT nfs41_file_info *info)
{ {
open_claim4 claim; open_claim4 claim;
stateid4 open_stateid; stateid4 open_stateid;
@ -202,7 +202,7 @@ int nfs41_open(
claim.claim = CLAIM_NULL; claim.claim = CLAIM_NULL;
claim.u.null.filename = &state->file.name; claim.u.null.filename = &state->file.name;
status = nfs41_rpc_open(state->session, &state->parent, &state->file, status = nfs41_open(state->session, &state->parent, &state->file,
&state->owner, &claim, state->share_access, state->share_deny, &state->owner, &claim, state->share_access, state->share_deny,
create, createhow, mode, TRUE, &open_stateid, &delegation, info); create, createhow, mode, TRUE, &open_stateid, &delegation, info);
if (status) if (status)
@ -239,7 +239,7 @@ static int open_or_delegate(
/* get an open stateid if we have no delegation stateid */ /* get an open stateid if we have no delegation stateid */
if (status) if (status)
status = nfs41_open(state, create, createhow, mode, try_recovery, info); status = do_open(state, create, createhow, mode, try_recovery, info);
/* register the client's open state on success */ /* register the client's open state on success */
if (status == NFS4_OK) if (status == NFS4_OK)

View file

@ -78,26 +78,28 @@ static int recover_open(
claim.claim = CLAIM_PREVIOUS; claim.claim = CLAIM_PREVIOUS;
claim.u.prev.delegate_type = OPEN_DELEGATE_NONE; claim.u.prev.delegate_type = OPEN_DELEGATE_NONE;
status = nfs41_rpc_open(session, &open->parent, &open->file, status = nfs41_open(session, &open->parent, &open->file,
&open->owner, &claim, open->share_access, open->share_deny, &open->owner, &claim, open->share_access, open->share_deny,
OPEN4_NOCREATE, 0, 0, FALSE, &stateid.stateid, &delegation, NULL); OPEN4_NOCREATE, 0, 0, FALSE, &stateid.stateid, &delegation, NULL);
if (status == NFS4_OK) { if (status == NFS4ERR_NO_GRACE) {
/* update the open stateid on success */
memcpy(&open->stateid, &stateid.stateid, sizeof(stateid4));
} else if (status == NFS4ERR_NO_GRACE) {
dprintf(1, "not in grace period, retrying a normal open\n"); dprintf(1, "not in grace period, retrying a normal open\n");
status = nfs41_open(open, OPEN4_NOCREATE, 0, 0, FALSE, NULL);
/* update the stateid arg with the new open->stateid */ claim.claim = CLAIM_NULL;
memcpy(&stateid.stateid, &open->stateid, sizeof(stateid4)); claim.u.null.filename = &open->file.name;
status = nfs41_open(session, &open->parent, &open->file,
&open->owner, &claim, open->share_access, open->share_deny,
OPEN4_NOCREATE, 0, 0, FALSE, &stateid.stateid, &delegation, NULL);
} }
if (status) if (status)
goto out; goto out;
AcquireSRWLockExclusive(&open->lock); AcquireSRWLockExclusive(&open->lock);
/* update the open stateid on success */
memcpy(&open->stateid, &stateid.stateid, sizeof(stateid4));
open->layout = NULL; open->layout = NULL;
stateid.type = STATEID_OPEN; stateid.type = STATEID_OPEN;
stateid.open = open; stateid.open = open;