tracking open state in setattr for reboot recovery

This commit is contained in:
unknown 2010-12-10 11:25:01 -05:00
parent a645f7030c
commit 2ae743efe7
3 changed files with 14 additions and 4 deletions

View file

@ -414,6 +414,11 @@ 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);
void client_state_add(
IN nfs41_open_state *state);
void client_state_remove(
IN nfs41_open_state *state);
/* lock.c */ /* lock.c */
void nfs41_lock_stateid_arg( void nfs41_lock_stateid_arg(
IN nfs41_open_state *state, IN nfs41_open_state *state,

View file

@ -118,9 +118,8 @@ void nfs41_open_stateid_arg(
arg->open = state; arg->open = state;
} }
/* client list of associated open state */ /* client list of associated open state */
static void client_state_add( void client_state_add(
IN nfs41_open_state *state) IN nfs41_open_state *state)
{ {
nfs41_client *client = state->session->client; nfs41_client *client = state->session->client;
@ -130,7 +129,7 @@ static void client_state_add(
LeaveCriticalSection(&client->state.lock); LeaveCriticalSection(&client->state.lock);
} }
static void client_state_remove( void client_state_remove(
IN nfs41_open_state *state) IN nfs41_open_state *state)
{ {
nfs41_client *client = state->session->client; nfs41_client *client = state->session->client;

View file

@ -452,7 +452,8 @@ static int handle_setattr(nfs41_upcall *upcall)
dprintf(1, "nfs41_open() failed with %s\n", nfs_error_string(status)); dprintf(1, "nfs41_open() failed with %s\n", nfs_error_string(status));
status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND); status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND);
goto out; goto out;
} } else
client_state_add(state);
state->do_close = 1; state->do_close = 1;
} }
} }
@ -481,6 +482,11 @@ static int handle_setattr(nfs41_upcall *upcall)
break; break;
} }
switch (args->set_class) {
case FileAllocationInformation:
case FileEndOfFileInformation:
client_state_remove(state);
}
out: out:
free(args->buf); free(args->buf);
return status; return status;