diff --git a/daemon/delegation.c b/daemon/delegation.c index 022698d..84df452 100644 --- a/daemon/delegation.c +++ b/daemon/delegation.c @@ -391,7 +391,7 @@ int nfs41_delegation_to_open( claim.u.deleg_cur.delegate_stateid = &deleg_stateid; 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, OPEN4_NOCREATE, 0, 0, try_recovery, &open_stateid, &ignore, NULL); if (status) diff --git a/daemon/nfs41.h b/daemon/nfs41.h index ef24343..4c84b2c 100644 --- a/daemon/nfs41.h +++ b/daemon/nfs41.h @@ -471,12 +471,4 @@ void nfs41_open_stateid_arg( IN nfs41_open_state *state, 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__ */ diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c index fddc0c1..5106b50 100644 --- a/daemon/nfs41_ops.c +++ b/daemon/nfs41_ops.c @@ -302,7 +302,7 @@ out: return status; } -int nfs41_rpc_open( +int nfs41_open( IN nfs41_session *session, IN nfs41_path_fh *parent, IN nfs41_path_fh *file, diff --git a/daemon/nfs41_ops.h b/daemon/nfs41_ops.h index 2ef876d..3981a31 100644 --- a/daemon/nfs41_ops.h +++ b/daemon/nfs41_ops.h @@ -997,7 +997,7 @@ int nfs41_lookup( OUT OPTIONAL nfs41_file_info *info_out, OUT nfs41_session **session_out); -int nfs41_rpc_open( +int nfs41_open( IN nfs41_session *session, IN nfs41_path_fh *parent, IN nfs41_path_fh *file, diff --git a/daemon/open.c b/daemon/open.c index 21a88c9..54bc7d0 100644 --- a/daemon/open.c +++ b/daemon/open.c @@ -185,13 +185,13 @@ static void client_state_remove( LeaveCriticalSection(&client->state.lock); } -int nfs41_open( +static int do_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) + OUT nfs41_file_info *info) { open_claim4 claim; stateid4 open_stateid; @@ -202,7 +202,7 @@ int nfs41_open( claim.claim = CLAIM_NULL; 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, create, createhow, mode, TRUE, &open_stateid, &delegation, info); if (status) @@ -239,7 +239,7 @@ static int open_or_delegate( /* get an open stateid if we have no delegation stateid */ 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 */ if (status == NFS4_OK) diff --git a/daemon/recovery.c b/daemon/recovery.c index fa4ae4a..a447e8b 100644 --- a/daemon/recovery.c +++ b/daemon/recovery.c @@ -78,26 +78,28 @@ static int recover_open( claim.claim = CLAIM_PREVIOUS; 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, OPEN4_NOCREATE, 0, 0, FALSE, &stateid.stateid, &delegation, NULL); - if (status == NFS4_OK) { - /* update the open stateid on success */ - memcpy(&open->stateid, &stateid.stateid, sizeof(stateid4)); - - } else if (status == NFS4ERR_NO_GRACE) { + if (status == NFS4ERR_NO_GRACE) { 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 */ - memcpy(&stateid.stateid, &open->stateid, sizeof(stateid4)); + claim.claim = CLAIM_NULL; + 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) goto out; AcquireSRWLockExclusive(&open->lock); + /* update the open stateid on success */ + memcpy(&open->stateid, &stateid.stateid, sizeof(stateid4)); + open->layout = NULL; stateid.type = STATEID_OPEN; stateid.open = open;