34#define MAX_SLOTS_DELAY 2000
55 table->target_delay = 0;
70 if (
table->max_slots != target_highest_slotid + 1) {
71 dprintf(2,
"updated max_slots %u to %u\n",
72 table->max_slots, target_highest_slotid + 1);
73 table->max_slots = target_highest_slotid + 1;
91 table->seq_nums[slotid]++;
112 if (slotid < NFS41_MAX_NUM_SLOTS && table->used_slots[slotid]) {
113 table->used_slots[slotid] = 0;
117 if (slotid ==
table->highest_used) {
119 table->highest_used--;
121 dprintf(3,
"freeing slot#=%d used=%d highest=%d\n",
122 slotid,
table->num_used,
table->highest_used);
148 for (
i = 0;
i <
table->max_slots;
i++) {
154 if (
i >
table->highest_used)
158 *seqid =
table->seq_nums[
i];
159 *highest =
table->highest_used;
165 dprintf(2,
"session %p: using slot#=%d with seq#=%d highest=%d\n",
192 if (
args->sa_slotid == 0) {
193 eprintf(
"server bug detected: NFS4ERR_BADSLOT for slotid=0\n");
199 if (
table->max_slots >
args->sa_slotid) {
208 &
args->sa_sequenceid, &
args->sa_highest_slotid);
220 &
args->sa_sequenceid, &
args->sa_highest_slotid);
222 args->sa_cachethis = cachethis;
234 dprintf(1,
"Creating renew_session thread: %p\n",
session->renew_thread);
236 dprintf(1,
"Going to sleep for %dmsecs\n", sleep_time);
240 dprintf(1,
"renewal thread: nfs41_send_sequence failed %d\n",
status);
324 session->cb_session.cb_seqnum = 0;
340 eprintf(
"nfs41_session_set_lease(): session "
341 "renewal thread already started!\n");
345 if (lease_time == 0) {
346 eprintf(
"nfs41_session_set_lease(): invalid lease_time=0\n");
351 session->lease_time = lease_time;
368 dprintf(1,
"nfs41_session_free: terminating session renewal thread\n");
370 eprintf(
"failed to terminate renewal thread %p\n",
ULONGLONG WINAPI GetTickCount64(VOID)
__inline int valid_handle(HANDLE handle)
void nfs41_callback_session_init(IN nfs41_session *session)
void eprintf(LPCSTR format,...)
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
BOOL WINAPI TerminateThread(IN HANDLE hThread, IN DWORD dwExitCode)
VOID WINAPI ReleaseSRWLockShared(PSRWLOCK Lock)
VOID WINAPI AcquireSRWLockExclusive(PSRWLOCK Lock)
VOID WINAPI AcquireSRWLockShared(PSRWLOCK Lock)
VOID WINAPI ReleaseSRWLockExclusive(PSRWLOCK Lock)
BOOL WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE ConditionVariable, PCRITICAL_SECTION CriticalSection, DWORD Timeout)
VOID WINAPI InitializeSRWLock(PSRWLOCK Lock)
VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE ConditionVariable)
VOID WINAPI InitializeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define NFS41_MAX_NUM_SLOTS
#define CREATE_SESSION4_FLAG_PERSIST
#define CREATE_SESSION4_FLAG_CONN_BACK_CHAN
int nfs41_send_sequence(IN nfs41_session *session)
int nfs41_destroy_session(IN nfs41_session *session)
int nfs41_create_session(nfs41_client *clnt, nfs41_session *session, bool_t try_recovery)
void nfs41_session_get_slot(IN nfs41_session *session, OUT uint32_t *slot, OUT uint32_t *seqid, OUT uint32_t *highest)
int nfs41_session_bad_slot(IN nfs41_session *session, IN OUT nfs41_sequence_args *args)
int nfs41_session_recall_slot(IN nfs41_session *session, IN OUT uint32_t target_highest_slotid)
void nfs41_session_free_slot(IN nfs41_session *session, IN uint32_t slotid)
static int session_alloc(IN nfs41_client *client, OUT nfs41_session **session_out)
int nfs41_session_set_lease(IN nfs41_session *session, IN uint32_t lease_time)
static unsigned int WINAPI renew_session(void *args)
void nfs41_session_free(IN nfs41_session *session)
static int slot_table_avail(IN const nfs41_slot_table *table)
static void init_slot_table(nfs41_slot_table *table)
static void resize_slot_table(IN nfs41_slot_table *table, IN uint32_t target_highest_slotid)
int nfs41_session_create(IN nfs41_client *client, IN nfs41_session **session_out)
int nfs41_session_renew(IN nfs41_session *session)
void nfs41_session_sequence(nfs41_sequence_args *args, nfs41_session *session, bool_t cachethis)
void nfs41_session_bump_seq(IN nfs41_session *session, IN uint32_t slotid, IN uint32_t target_highest_slotid)
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
DWORD WINAPI GetLastError(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define ERROR_BAD_NET_RESP