glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

nfs.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010-2011 Gluster, Inc. <http://www.gluster.com>
3  This file is part of GlusterFS.
4 
5  This file is licensed to you under your choice of the GNU Lesser
6  General Public License, version 3 or any later version (LGPLv3 or
7  later), or the GNU General Public License, version 2 (GPLv2), in all
8  cases as published by the Free Software Foundation.
9 */
10 
11 #ifndef __NFS_H__
12 #define __NFS_H__
13 
14 #include "rpcsvc.h"
15 #include <glusterfs/dict.h>
16 #include <glusterfs/xlator.h>
17 #include <glusterfs/lkowner.h>
18 #include <glusterfs/gidcache.h>
19 
20 #define GF_NFS "nfs"
21 
22 #define GF_NFS_CONCURRENT_OPS_MULT 15
23 
24 #define GF_NFS_INODE_LRU_MULT 6000
25 
26 #define GF_RPC_MIN_THREADS 1
27 #define GF_RPC_MAX_THREADS 16
28 
29 #define GF_NFS_DEFAULT_MEMFACTOR 15
30 #define GF_NFS_MIN_MEMFACTOR 1
31 #define GF_NFS_MAX_MEMFACTOR 30
32 
33 #define GF_NFS_DVM_ON 1
34 #define GF_NFS_DVM_OFF 0
35 
36 /* Disable using the exports file by default */
37 #define GF_NFS_DEFAULT_EXPORT_AUTH 0
38 
39 #define GF_NFS_DEFAULT_AUTH_REFRESH_INTERVAL_SEC 2
40 #define GF_NFS_DEFAULT_AUTH_CACHE_TTL_SEC 300 /* 5 min */
41 
42 /* This corresponds to the max 16 number of group IDs that are sent through an
43  * RPC request. Since NFS is the only one going to set this, we can be safe
44  * in keeping this size hardcoded.
45  */
46 #define GF_REQUEST_MAXGROUPS 16
47 
48 /* Callback into a version-specific NFS protocol.
49  * The return type is used by the nfs.c code to register the protocol.
50  * with the RPC service.
51  */
52 typedef rpcsvc_program_t *(*nfs_version_initer_t)(xlator_t *nfsx);
53 
54 /* List of version-specific protocol initiators */
56  struct list_head list;
60 };
61 
62 struct nfs_state {
64  struct list_head versions;
67  struct nlm4_state *nlm4state;
68  struct mem_pool *foppool;
69  unsigned int memfactor;
71 
74  int upsubvols;
79  unsigned int override_portnum;
83  int mount_udp;
84 
85  /* Enable exports auth model */
87  /* Refresh auth params from disk periodically */
89 
90  unsigned int auth_refresh_time_secs;
91  unsigned int auth_cache_ttl_sec;
92 
93  char *rmtab;
94  struct rpc_clnt *rpc_clnt;
98  uint32_t generation;
100  char *rpc_statd;
103  uint32_t event_threads;
104 };
105 
107  struct list_head shares;
108  uint32_t generation;
109 };
110 
111 #define gf_nfs_dvm_on(nfsstt) \
112  (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_ON)
113 #define gf_nfs_dvm_off(nfsstt) \
114  (((struct nfs_state *)nfsstt)->dynamicvolumes == GF_NFS_DVM_OFF)
115 #define __gf_nfs_enable_ino32(nfsstt) \
116  (((struct nfs_state *)nfsstt)->enable_ino32)
117 #define gf_nfs_this_private ((struct nfs_state *)((xlator_t *)THIS)->private)
118 #define gf_nfs_enable_ino32() (__gf_nfs_enable_ino32(gf_nfs_this_private))
119 
120 /* We have one gid more than the glusterfs maximum since we pass the primary
121  * gid as the first element of the array.
122  */
123 #define NFS_NGROUPS (GF_REQUEST_MAXGROUPS + 1)
124 
125 /* Index of the primary gid */
126 #define NFS_PRIMGID_IDX 0
127 
128 typedef struct nfs_user_info {
129  uid_t uid;
131  int ngrps;
133  char identifier[UNIX_PATH_MAX]; /* ip of user */
135 
136 extern int
138 
139 extern int
140 nfs_user_create(nfs_user_t *newnfu, uid_t uid, gid_t gid,
141  rpc_transport_t *trans, gid_t *auxgids, int auxcount);
142 
143 extern void
145 
146 extern void
148  gid_t gid);
149 extern int
150 nfs_subvolume_started(struct nfs_state *nfs, xlator_t *xl);
151 
152 extern void
154 #endif
xlator.h
nfs_state::register_portmap
bool register_portmap
Definition: nfs.h:99
gf_lkowner_t
Definition: glusterfs-fops.h:190
nfs_subvolume_started
int nfs_subvolume_started(struct nfs_state *nfs, xlator_t *xl)
Definition: nfs.c:414
nfs_state::allow_insecure
int allow_insecure
Definition: nfs.h:80
nfs_state::mstate
struct mount3_state * mstate
Definition: nfs.h:65
mem_pool
Definition: mem-pool.h:207
nfs_state::svinitlock
gf_lock_t svinitlock
Definition: nfs.h:72
nfs_state::server_aux_gids_max_age
uint32_t server_aux_gids_max_age
Definition: nfs.h:96
nfs_state::server_aux_gids
bool server_aux_gids
Definition: nfs.h:95
nfs_user_info::ngrps
int ngrps
Definition: nfs.h:131
NFS_NGROUPS
#define NFS_NGROUPS
Definition: nfs.h:123
nfs_user_root_create
int nfs_user_root_create(nfs_user_t *newnfu)
Definition: nfs.c:624
rpcsvc_program
Definition: rpcsvc.h:393
nfs_state::override_portnum
unsigned int override_portnum
Definition: nfs.h:79
nfs_state::exports_auth
int exports_auth
Definition: nfs.h:86
nfs_state::rpc_statd_pid_file
char * rpc_statd_pid_file
Definition: nfs.h:101
nfs_state::nlm4state
struct nlm4_state * nlm4state
Definition: nfs.h:67
gf_lock_t
pthread_mutex_t gf_lock_t
Definition: locking.h:74
xlator_list
Definition: xlator.h:760
nfs_state::generation
uint32_t generation
Definition: nfs.h:98
nfs_version_initer_t
rpcsvc_program_t *(* nfs_version_initer_t)(xlator_t *nfsx)
Definition: nfs.h:52
rpcsvc.h
rpc_clnt
Definition: rpc-clnt.h:168
lkowner.h
nfs_state::rpc_clnt
struct rpc_clnt * rpc_clnt
Definition: nfs.h:94
nfs_initer_list::program
rpcsvc_program_t * program
Definition: nfs.h:58
nfs_state::subvols_started
int subvols_started
Definition: nfs.h:76
nfs_user_t
struct nfs_user_info nfs_user_t
nfs_state::upsubvols
int upsubvols
Definition: nfs.h:74
gidcache.h
rpc_transport
Definition: rpc-transport.h:162
gf_boolean_t
#define gf_boolean_t
Definition: glusterfs.h:368
nfs_state::enable_ino32
int enable_ino32
Definition: nfs.h:78
nfs_state::event_threads
uint32_t event_threads
Definition: nfs.h:103
_call_stack
Definition: stack.h:93
nfs_initer_list
Definition: nfs.h:55
list_head
Definition: list.h:14
nfs_state::rmtab
char * rmtab
Definition: nfs.h:93
nfs_inode_ctx
Definition: nfs.h:106
nfs3_state
Definition: nfs3.h:116
nfs_state::rpc_statd
char * rpc_statd
Definition: nfs.h:100
mount3_state
Definition: mount3.h:125
rpcsvc_request
Definition: rpcsvc.h:155
_xlator
Definition: xlator.h:770
nfs_state::nfs3state
struct nfs3_state * nfs3state
Definition: nfs.h:66
nfs_user_info::lk_owner
gf_lkowner_t lk_owner
Definition: nfs.h:132
nfs_fix_groups
void nfs_fix_groups(xlator_t *this, call_stack_t *root)
Definition: nfs-fops.c:29
nfs_request_primary_user_init
void nfs_request_primary_user_init(nfs_user_t *nfu, rpcsvc_request_t *req, uid_t uid, gid_t gid)
Definition: nfs.c:688
nfs_request_user_init
void nfs_request_user_init(nfs_user_t *nfu, rpcsvc_request_t *req)
Definition: nfs.c:672
nfs_state::dynamicvolumes
int dynamicvolumes
Definition: nfs.h:77
nfs_state
Definition: nfs.h:62
gid_cache_t
Definition: gidcache.h:42
nfs_state::mount_udp
int mount_udp
Definition: nfs.h:83
nfs_state::versions
struct list_head versions
Definition: nfs.h:64
nfs_state::memfactor
unsigned int memfactor
Definition: nfs.h:69
nfs_state::subvols
xlator_list_t * subvols
Definition: nfs.h:70
nfs_state::auth_refresh_time_secs
unsigned int auth_refresh_time_secs
Definition: nfs.h:90
nfs_user_info
Definition: nfs.h:128
nfs_user_info::gids
gid_t gids[(16+1)]
Definition: nfs.h:130
nfs_state::gid_cache
gid_cache_t gid_cache
Definition: nfs.h:97
nfs_state::initedxl
xlator_t ** initedxl
Definition: nfs.h:75
nfs_inode_ctx::generation
uint32_t generation
Definition: nfs.h:108
nfs_user_info::identifier
char identifier[UNIX_PATH_MAX]
Definition: nfs.h:133
dict.h
nfs_initer_list::required
bool required
Definition: nfs.h:59
nfs_inode_ctx::shares
struct list_head shares
Definition: nfs.h:107
nfs_initer_list::init
nfs_version_initer_t init
Definition: nfs.h:57
nfs_user_info::uid
uid_t uid
Definition: nfs.h:129
nfs_state::refresh_auth
int refresh_auth
Definition: nfs.h:88
nfs_state::auth_cache_ttl_sec
unsigned int auth_cache_ttl_sec
Definition: nfs.h:91
nfs_state::allsubvols
int allsubvols
Definition: nfs.h:73
rpcsvc_state
Definition: rpcsvc-common.h:35
nfs_initer_list::list
struct list_head list
Definition: nfs.h:56
nfs_state::rpcsvc
rpcsvc_t * rpcsvc
Definition: nfs.h:63
nfs_state::enable_acl
int enable_acl
Definition: nfs.h:82
nfs_state::enable_nlm
int enable_nlm
Definition: nfs.h:81
nfs_user_create
int nfs_user_create(nfs_user_t *newnfu, uid_t uid, gid_t gid, rpc_transport_t *trans, gid_t *auxgids, int auxcount)
Definition: nfs.c:637
UNIX_PATH_MAX
#define UNIX_PATH_MAX
Definition: rdd.c:26
nfs_state::foppool
struct mem_pool * foppool
Definition: nfs.h:68
nfs_state::rdirplus
bool rdirplus
Definition: nfs.h:102