diff --git a/daemon/nfs41.h b/daemon/nfs41.h index f1436d2..ce8e8a8 100644 --- a/daemon/nfs41.h +++ b/daemon/nfs41.h @@ -414,6 +414,11 @@ void nfs41_open_stateid_arg( IN nfs41_open_state *state, 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 */ void nfs41_lock_stateid_arg( IN nfs41_open_state *state, diff --git a/daemon/open.c b/daemon/open.c index d4c8b07..021e1bb 100644 --- a/daemon/open.c +++ b/daemon/open.c @@ -118,9 +118,8 @@ void nfs41_open_stateid_arg( arg->open = state; } - /* client list of associated open state */ -static void client_state_add( +void client_state_add( IN nfs41_open_state *state) { nfs41_client *client = state->session->client; @@ -130,7 +129,7 @@ static void client_state_add( LeaveCriticalSection(&client->state.lock); } -static void client_state_remove( +void client_state_remove( IN nfs41_open_state *state) { nfs41_client *client = state->session->client; diff --git a/daemon/setattr.c b/daemon/setattr.c index 367e59a..7803ceb 100644 --- a/daemon/setattr.c +++ b/daemon/setattr.c @@ -452,7 +452,8 @@ static int handle_setattr(nfs41_upcall *upcall) dprintf(1, "nfs41_open() failed with %s\n", nfs_error_string(status)); status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND); goto out; - } + } else + client_state_add(state); state->do_close = 1; } } @@ -481,6 +482,11 @@ static int handle_setattr(nfs41_upcall *upcall) break; } + switch (args->set_class) { + case FileAllocationInformation: + case FileEndOfFileInformation: + client_state_remove(state); + } out: free(args->buf); return status;