#include <windows.h>
#include <process.h>
#include <stdio.h>
#include "nfs41_ops.h"
#include "nfs41_callback.h"
#include "util.h"
#include "daemon_debug.h"
Go to the source code of this file.
|
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) |
|
void | nfs41_session_bump_seq (IN nfs41_session *session, IN uint32_t slotid, IN uint32_t target_highest_slotid) |
|
void | nfs41_session_free_slot (IN nfs41_session *session, IN uint32_t slotid) |
|
void | nfs41_session_get_slot (IN nfs41_session *session, OUT uint32_t *slot, OUT uint32_t *seqid, OUT uint32_t *highest) |
|
int | nfs41_session_recall_slot (IN nfs41_session *session, IN OUT uint32_t target_highest_slotid) |
|
int | nfs41_session_bad_slot (IN nfs41_session *session, IN OUT nfs41_sequence_args *args) |
|
void | nfs41_session_sequence (nfs41_sequence_args *args, nfs41_session *session, bool_t cachethis) |
|
static unsigned int WINAPI | renew_session (void *args) |
|
static int | session_alloc (IN nfs41_client *client, OUT nfs41_session **session_out) |
|
int | nfs41_session_create (IN nfs41_client *client, IN nfs41_session **session_out) |
|
int | nfs41_session_renew (IN nfs41_session *session) |
|
int | nfs41_session_set_lease (IN nfs41_session *session, IN uint32_t lease_time) |
|
void | nfs41_session_free (IN nfs41_session *session) |
|
◆ MAX_SLOTS_DELAY
#define MAX_SLOTS_DELAY 2000 /* in milliseconds */ |
◆ init_slot_table()
Definition at line 45 of file nfs41_session.c.
55 table->target_delay = 0;
#define NFS41_MAX_NUM_SLOTS
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static int slot_table_avail(IN const nfs41_slot_table *table)
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
VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE ConditionVariable)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
Referenced by nfs41_session_renew(), and session_alloc().
◆ nfs41_session_bad_slot()
Definition at line 185 of file nfs41_session.c.
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);
void eprintf(LPCSTR format,...)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
ULONGLONG WINAPI GetTickCount64(VOID)
void nfs41_session_get_slot(IN nfs41_session *session, OUT uint32_t *slot, OUT uint32_t *seqid, OUT uint32_t *highest)
void nfs41_session_free_slot(IN nfs41_session *session, IN uint32_t slotid)
static void resize_slot_table(IN nfs41_slot_table *table, IN uint32_t target_highest_slotid)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static SERVICE_STATUS status
◆ nfs41_session_bump_seq()
Definition at line 80 of file nfs41_session.c.
91 table->seq_nums[slotid]++;
#define NFS41_MAX_NUM_SLOTS
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
ULONGLONG WINAPI GetTickCount64(VOID)
VOID WINAPI AcquireSRWLockShared(PSRWLOCK Lock)
static void resize_slot_table(IN nfs41_slot_table *table, IN uint32_t target_highest_slotid)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
VOID WINAPI ReleaseSRWLockShared(PSRWLOCK Lock)
Referenced by compound_encode_send_decode().
◆ nfs41_session_create()
Definition at line 278 of file nfs41_session.c.
void eprintf(LPCSTR format,...)
#define ERROR_BAD_NET_RESP
VOID WINAPI AcquireSRWLockShared(PSRWLOCK Lock)
VOID WINAPI ReleaseSRWLockExclusive(PSRWLOCK Lock)
#define CREATE_SESSION4_FLAG_PERSIST
static int session_alloc(IN nfs41_client *client, OUT nfs41_session **session_out)
#define CREATE_SESSION4_FLAG_CONN_BACK_CHAN
int nfs41_create_session(nfs41_client *clnt, nfs41_session *session, bool_t try_recovery)
void nfs41_session_free(IN nfs41_session *session)
static SERVICE_STATUS status
VOID WINAPI ReleaseSRWLockShared(PSRWLOCK Lock)
VOID WINAPI AcquireSRWLockExclusive(PSRWLOCK Lock)
Referenced by root_client_create().
◆ nfs41_session_free()
Definition at line 363 of file nfs41_session.c.
368 dprintf(1,
"nfs41_session_free: terminating session renewal thread\n");
370 eprintf(
"failed to terminate renewal thread %p\n",
BOOL WINAPI TerminateThread(IN HANDLE hThread, IN DWORD dwExitCode)
void eprintf(LPCSTR format,...)
__inline int valid_handle(HANDLE handle)
VOID WINAPI ReleaseSRWLockExclusive(PSRWLOCK Lock)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
int nfs41_destroy_session(IN nfs41_session *session)
VOID WINAPI AcquireSRWLockExclusive(PSRWLOCK Lock)
Referenced by nfs41_client_free(), and nfs41_session_create().
◆ nfs41_session_free_slot()
Definition at line 102 of file nfs41_session.c.
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);
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static int slot_table_avail(IN const nfs41_slot_table *table)
VOID WINAPI AcquireSRWLockShared(PSRWLOCK Lock)
VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE ConditionVariable)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
VOID WINAPI ReleaseSRWLockShared(PSRWLOCK Lock)
Referenced by compound_encode_send_decode(), and nfs41_session_bad_slot().
◆ nfs41_session_get_slot()
Definition at line 132 of file nfs41_session.c.
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",
BOOL WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE ConditionVariable, PCRITICAL_SECTION CriticalSection, DWORD Timeout)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static int slot_table_avail(IN const nfs41_slot_table *table)
VOID WINAPI AcquireSRWLockShared(PSRWLOCK Lock)
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
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
VOID WINAPI ReleaseSRWLockShared(PSRWLOCK Lock)
Referenced by compound_encode_send_decode(), nfs41_session_bad_slot(), and nfs41_session_sequence().
◆ nfs41_session_recall_slot()
Definition at line 169 of file nfs41_session.c.
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
ULONGLONG WINAPI GetTickCount64(VOID)
VOID WINAPI AcquireSRWLockShared(PSRWLOCK Lock)
static void resize_slot_table(IN nfs41_slot_table *table, IN uint32_t target_highest_slotid)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
VOID WINAPI ReleaseSRWLockShared(PSRWLOCK Lock)
Referenced by handle_cb_recall_slot().
◆ nfs41_session_renew()
Definition at line 318 of file nfs41_session.c.
324 session->cb_session.cb_seqnum = 0;
static void init_slot_table(nfs41_slot_table *table)
VOID WINAPI ReleaseSRWLockExclusive(PSRWLOCK Lock)
int nfs41_create_session(nfs41_client *clnt, nfs41_session *session, bool_t try_recovery)
static SERVICE_STATUS status
VOID WINAPI AcquireSRWLockExclusive(PSRWLOCK Lock)
Referenced by nfs41_recover_session().
◆ nfs41_session_sequence()
Definition at line 214 of file nfs41_session.c.
220 &
args->sa_sequenceid, &
args->sa_highest_slotid);
222 args->sa_cachethis = cachethis;
void nfs41_session_get_slot(IN nfs41_session *session, OUT uint32_t *slot, OUT uint32_t *seqid, OUT uint32_t *highest)
Referenced by lookup_rpc(), nfs41_access(), nfs41_close(), nfs41_commit(), nfs41_create(), nfs41_delegpurge(), nfs41_delegreturn(), nfs41_free_stateid(), nfs41_fs_locations(), nfs41_getattr(), nfs41_link(), nfs41_lock(), nfs41_open(), nfs41_read(), nfs41_readdir(), nfs41_readlink(), nfs41_reclaim_complete(), nfs41_remove(), nfs41_rename(), nfs41_rpc_openattr(), nfs41_secinfo(), nfs41_secinfo_noname(), nfs41_send_sequence(), nfs41_setattr(), nfs41_superblock_getattr(), nfs41_test_stateid(), nfs41_unlock(), nfs41_want_delegation(), nfs41_write(), pnfs_rpc_getdeviceinfo(), pnfs_rpc_layoutcommit(), pnfs_rpc_layoutget(), pnfs_rpc_layoutreturn(), and rpc_array_putfh().
◆ nfs41_session_set_lease()
Definition at line 332 of file nfs41_session.c.
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;
#define ERROR_INVALID_PARAMETER
DWORD WINAPI GetLastError(VOID)
void eprintf(LPCSTR format,...)
_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)
__inline int valid_handle(HANDLE handle)
static unsigned int WINAPI renew_session(void *args)
static SERVICE_STATUS status
Referenced by session_get_lease().
◆ renew_session()
Definition at line 227 of file nfs41_session.c.
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);
int nfs41_send_sequence(IN nfs41_session *session)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
static SERVICE_STATUS status
Referenced by nfs41_session_set_lease().
◆ resize_slot_table()
◆ session_alloc()
Definition at line 246 of file nfs41_session.c.
void nfs41_callback_session_init(IN nfs41_session *session)
#define INVALID_HANDLE_VALUE
DWORD WINAPI GetLastError(VOID)
static void init_slot_table(nfs41_slot_table *table)
VOID WINAPI InitializeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
VOID WINAPI InitializeSRWLock(PSRWLOCK Lock)
static SERVICE_STATUS status
Referenced by nfs41_session_create().
◆ slot_table_avail()