nfs-ganesha 1.4
Defines | Functions | Variables

nfs_worker_thread.c File Reference

The file that contain the 'worker_thread' routine for the nfsd. More...

#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/signal.h>
#include <poll.h>
#include "HashData.h"
#include "HashTable.h"
#include "log.h"
#include "ganesha_rpc.h"
#include "nfs23.h"
#include "nfs4.h"
#include "mount.h"
#include "nlm4.h"
#include "rquota.h"
#include "nfs_core.h"
#include "cache_inode.h"
#include "nfs_exports.h"
#include "nfs_creds.h"
#include "nfs_proto_functions.h"
#include "nfs_dupreq.h"
#include "nfs_file_handle.h"
#include "nfs_stat.h"
#include "nfs_tcb.h"
#include "SemN.h"

Go to the source code of this file.

Defines

#define nlm4_Unsupported   nlm_Null
#define nlm4_Unsupported_Free   nlm_Null_Free
#define DISP_LOCK(x)
#define DISP_UNLOCK(x)

Functions

int nfs_Init_gc_counter (void)
struct timeval time_diff (struct timeval time_from, struct timeval time_to)
int is_rpc_call_valid (SVCXPRT *xprt, struct svc_req *preq)
const nfs_function_desc_tnfs_rpc_get_funcdesc (nfs_request_data_t *preqnfs)
int nfs_rpc_get_args (nfs_request_data_t *preqnfs, const nfs_function_desc_t *pfuncdesc)
int nfs_Init_worker_data (nfs_worker_data_t *pdata)
void DispatchWorkNFS (request_data_t *nfsreq, unsigned int worker_index)
enum auth_stat AuthenticateRequest (nfs_request_data_t *nfsreq, bool_t *no_dispatch)
process_status_t nfs_worker_process_rpc_requests (nfs_worker_data_t *pmydata, request_data_t *nfsreq)
void * worker_thread (void *IndexArg)

Variables

nfs_worker_data_tworkers_data
pool_trequest_pool
pool_trequest_data_pool
pool_tdupreq_pool
pool_tip_stats_pool
unsigned int nb_current_gc_workers
pthread_mutex_t lock_nb_current_gc_workers
const nfs_function_desc_t invalid_funcdesc
const nfs_function_desc_tINVALID_FUNCDESC = &invalid_funcdesc
const nfs_function_desc_t nfs2_func_desc []
const nfs_function_desc_t nfs3_func_desc []
const nfs_function_desc_t nfs4_func_desc []
const nfs_function_desc_t mnt1_func_desc []
const nfs_function_desc_t mnt3_func_desc []
const char * pause_state_str []

Detailed Description

The file that contain the 'worker_thread' routine for the nfsd.

Author:
$Author$
Date:
$Date$
Version:
$Revision$ nfs_worker_thread.c : The file that contain the 'worker_thread' routine for the nfsd (and all the related stuff).

Definition in file nfs_worker_thread.c.


Define Documentation

#define DISP_LOCK (   x)
Value:
do { \
    if (! locked) { \
        svc_dplx_lock_x(xprt, &pmydata->sigmask); \
        locked = TRUE; \
      }\
    } while (0);

nfs_worker_process_rpc_requests: read and process a sequence of RPC requests.

Definition at line 1788 of file nfs_worker_thread.c.

#define DISP_UNLOCK (   x)
Value:
do { \
    if (locked) { \
        svc_dplx_unlock_x(xprt, &pmydata->sigmask); \
        locked = FALSE; \
      }\
    } while (0);

Definition at line 1795 of file nfs_worker_thread.c.

#define nlm4_Unsupported   nlm_Null

Definition at line 271 of file nfs_worker_thread.c.

#define nlm4_Unsupported_Free   nlm_Null_Free

Definition at line 272 of file nfs_worker_thread.c.


Function Documentation

enum auth_stat AuthenticateRequest ( nfs_request_data_t nfsreq,
bool_t *  no_dispatch 
)

Definition at line 1642 of file nfs_worker_thread.c.

void DispatchWorkNFS ( request_data_t nfsreq,
unsigned int  worker_index 
)

Definition at line 1606 of file nfs_worker_thread.c.

int is_rpc_call_valid ( SVCXPRT *  xprt,
struct svc_req *  preq 
)

is_rpc_call_valid: helper function to validate rpc calls.

Definition at line 499 of file nfs_worker_thread.c.

int nfs_Init_gc_counter ( void  )

nfs_Init_gc_counter: Init the worker's gc counters.

This functions is used to init a mutex and a counter associated with it, to keep track of the number of worker currently performing the garbage collection.

Parameters:
voidNo parameters
Returns:
0 if successfull, -1 otherwise.

Definition at line 461 of file nfs_worker_thread.c.

int nfs_Init_worker_data ( nfs_worker_data_t pdata)

nfs_Init_worker_data: Init the data associated with a worker instance.

This function is used to init the nfs_worker_data for a worker thread. These data are used by the worker for RPC processing.

Parameters:
paramA structure of type nfs_worker_parameter_t with all the necessary information related to a worker
pdataPointer to the data to be initialized.
Returns:
0 if successfull, -1 otherwise.

Definition at line 1573 of file nfs_worker_thread.c.

int nfs_rpc_get_args ( nfs_request_data_t preqnfs,
const nfs_function_desc_t pfuncdesc 
)

Definition at line 724 of file nfs_worker_thread.c.

const nfs_function_desc_t* nfs_rpc_get_funcdesc ( nfs_request_data_t preqnfs)

Definition at line 664 of file nfs_worker_thread.c.

process_status_t nfs_worker_process_rpc_requests ( nfs_worker_data_t pmydata,
request_data_t nfsreq 
)

Definition at line 1803 of file nfs_worker_thread.c.

struct timeval time_diff ( struct timeval  time_from,
struct timeval  time_to 
) [read]

Definition at line 476 of file nfs_worker_thread.c.

void* worker_thread ( void *  IndexArg)

worker_thread: The main function for a worker thread

This is the body of the worker thread. Its starting arguments are located in global array worker_data. The argument is no pointer but the worker's index. It then uses this index to address its own worker data in the array.

Parameters:
IndexArgthe index for the worker thread, in fact an integer cast as a void *
Returns:
Pointer to the result (but this function will mostly loop forever).

Todo:
: check if this does not produce memleak as 9P is used

Definition at line 1966 of file nfs_worker_thread.c.


Variable Documentation

Definition at line 79 of file nfs_worker_thread.c.

Initial value:
  {nfs_Null, nfs_Null_Free, (xdrproc_t) xdr_void, (xdrproc_t) xdr_void,
   "invalid_function", NOTHING_SPECIAL}

Definition at line 86 of file nfs_worker_thread.c.

Definition at line 90 of file nfs_worker_thread.c.

Definition at line 80 of file nfs_worker_thread.c.

pthread_mutex_t lock_nb_current_gc_workers

Definition at line 84 of file nfs_worker_thread.c.

Initial value:
 {
  {mnt_Null, mnt_Null_Free, (xdrproc_t) xdr_void,
   (xdrproc_t) xdr_void, "mnt_Null",
   NOTHING_SPECIAL},
  {mnt_Mnt, mnt1_Mnt_Free, (xdrproc_t) xdr_dirpath,
   (xdrproc_t) xdr_fhstatus2, "mnt_Mnt",
   NEEDS_CRED},
  {mnt_Dump, mnt_Dump_Free, (xdrproc_t) xdr_void,
   (xdrproc_t) xdr_mountlist, "mnt_Dump",
   NOTHING_SPECIAL},
  {mnt_Umnt, mnt_Umnt_Free, (xdrproc_t) xdr_dirpath,
   (xdrproc_t) xdr_void, "mnt_Umnt",
   NOTHING_SPECIAL},
  {mnt_UmntAll, mnt_UmntAll_Free, (xdrproc_t) xdr_void,
   (xdrproc_t) xdr_void, "mnt_UmntAll",
   NOTHING_SPECIAL},
  {mnt_Export, mnt_Export_Free, (xdrproc_t) xdr_void,
   (xdrproc_t) xdr_exports, "mnt_Export",
   NOTHING_SPECIAL}
}

Definition at line 229 of file nfs_worker_thread.c.

Initial value:
 {
  {mnt_Null, mnt_Null_Free, (xdrproc_t) xdr_void,
   (xdrproc_t) xdr_void, "mnt_Null",
   NOTHING_SPECIAL},
  {mnt_Mnt, mnt3_Mnt_Free, (xdrproc_t) xdr_dirpath,
   (xdrproc_t) xdr_mountres3, "mnt_Mnt",
   NEEDS_CRED},
  {mnt_Dump, mnt_Dump_Free, (xdrproc_t) xdr_void,
   (xdrproc_t) xdr_mountlist, "mnt_Dump",
   NOTHING_SPECIAL},
  {mnt_Umnt, mnt_Umnt_Free, (xdrproc_t) xdr_dirpath,
   (xdrproc_t) xdr_void, "mnt_Umnt",
   NOTHING_SPECIAL},
  {mnt_UmntAll, mnt_UmntAll_Free, (xdrproc_t) xdr_void,
   (xdrproc_t) xdr_void, "mnt_UmntAll",
   NOTHING_SPECIAL},
  {mnt_Export, mnt_Export_Free, (xdrproc_t) xdr_void,
   (xdrproc_t) xdr_exports, "mnt_Export",
   NOTHING_SPECIAL}
}

Definition at line 250 of file nfs_worker_thread.c.

unsigned int nb_current_gc_workers

Definition at line 83 of file nfs_worker_thread.c.

Definition at line 93 of file nfs_worker_thread.c.

Definition at line 150 of file nfs_worker_thread.c.

Initial value:
 {
  {nfs_Null, nfs_Null_Free, (xdrproc_t) xdr_void,
   (xdrproc_t) xdr_void, "nfs_Null",
   NOTHING_SPECIAL},
  {nfs4_Compound, nfs4_Compound_Free, (xdrproc_t) xdr_COMPOUND4args,
   (xdrproc_t) xdr_COMPOUND4res, "nfs4_Compound", NEEDS_CRED}
}

Definition at line 221 of file nfs_worker_thread.c.

const char* pause_state_str[]

Definition at line 69 of file nfs_tcb.c.

Definition at line 78 of file nfs_worker_thread.c.

Definition at line 77 of file nfs_worker_thread.c.

Definition at line 93 of file nfs_init.c.