recovery: use normal OPEN/LOCK on ERR_NO_GRACE

if we see NFS4ERR_NO_GRACE from recovery operations, it means we lost our state due to a lease expiration rather than a server reboot.  in this case, it's possible that conflicting locks were granted to other clients, so we have to try normal OPEN/LOCK operations to recover our state.  because they're sent during recovery, nfs41_open() and nfs41_lock() take a new 'bool_t try_recovery' argument so we can avoid recursion

if these operations fail due to conflicting locks, we have no choice but to return errors to the application.  using a stateid that was revoked due to lease expiration results in NFS4ERR_EXPIRED, and we map this error to ERROR_FILE_INVALID: The volume for a file has been externally altered so that the opened file is no longer valid.

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-11-30 13:10:30 -05:00 committed by unknown
parent 222c1bf020
commit 0a309c4350
8 changed files with 46 additions and 17 deletions

View file

@ -440,14 +440,14 @@ static int handle_setattr(nfs41_upcall *upcall)
case FileEndOfFileInformation:
if (!state->do_close) {
// get a stateid
uint32_t allow = 0, deny = 0;
StringCchPrintfA((LPSTR)state->owner.owner, NFS4_OPAQUE_LIMIT,
"%u", args->open_owner_id);
state->owner.owner_len = (uint32_t)strlen(
(const char*)state->owner.owner);
map_access_2_allowdeny(args->access_mask, args->access_mode, &allow, &deny);
status = nfs41_open(state->session, allow, deny,
OPEN4_NOCREATE, 0, state, NULL);
map_access_2_allowdeny(args->access_mask, args->access_mode,
&state->share_access, &state->share_deny);
status = nfs41_open(state->session, state->share_access,
state->share_deny, OPEN4_NOCREATE, 0, TRUE, state, NULL);
if (status) {
dprintf(1, "nfs41_open() failed with %s\n", nfs_error_string(status));
status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND);