0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __NFSD_NETNS_H__
0009 #define __NFSD_NETNS_H__
0010
0011 #include <net/net_namespace.h>
0012 #include <net/netns/generic.h>
0013 #include <linux/percpu_counter.h>
0014 #include <linux/siphash.h>
0015
0016
0017 #define CLIENT_HASH_BITS 4
0018 #define CLIENT_HASH_SIZE (1 << CLIENT_HASH_BITS)
0019 #define CLIENT_HASH_MASK (CLIENT_HASH_SIZE - 1)
0020
0021 #define SESSION_HASH_SIZE 512
0022
0023 struct cld_net;
0024 struct nfsd4_client_tracking_ops;
0025
0026 enum {
0027
0028 NFSD_NET_PAYLOAD_MISSES,
0029
0030 NFSD_NET_DRC_MEM_USAGE,
0031 NFSD_NET_COUNTERS_NUM
0032 };
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 struct nfsd_net {
0043 struct cld_net *cld_net;
0044
0045 struct cache_detail *svc_expkey_cache;
0046 struct cache_detail *svc_export_cache;
0047
0048 struct cache_detail *idtoname_cache;
0049 struct cache_detail *nametoid_cache;
0050
0051 struct lock_manager nfsd4_manager;
0052 bool grace_ended;
0053 time64_t boot_time;
0054
0055 struct dentry *nfsd_client_dir;
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 struct list_head *reclaim_str_hashtbl;
0068 int reclaim_str_hashtbl_size;
0069 struct list_head *conf_id_hashtbl;
0070 struct rb_root conf_name_tree;
0071 struct list_head *unconf_id_hashtbl;
0072 struct rb_root unconf_name_tree;
0073 struct list_head *sessionid_hashtbl;
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083 struct list_head client_lru;
0084 struct list_head close_lru;
0085 struct list_head del_recall_lru;
0086
0087
0088 struct list_head blocked_locks_lru;
0089
0090 struct delayed_work laundromat_work;
0091
0092
0093 spinlock_t client_lock;
0094
0095
0096 spinlock_t blocked_locks_lock;
0097
0098 struct file *rec_file;
0099 bool in_grace;
0100 const struct nfsd4_client_tracking_ops *client_tracking_ops;
0101
0102 time64_t nfsd4_lease;
0103 time64_t nfsd4_grace;
0104 bool somebody_reclaimed;
0105
0106 bool track_reclaim_completes;
0107 atomic_t nr_reclaim_complete;
0108
0109 bool nfsd_net_up;
0110 bool lockd_up;
0111
0112 seqlock_t writeverf_lock;
0113 unsigned char writeverf[8];
0114
0115
0116
0117
0118
0119 unsigned int max_connections;
0120
0121 u32 clientid_base;
0122 u32 clientid_counter;
0123 u32 clverifier_counter;
0124
0125 struct svc_serv *nfsd_serv;
0126
0127
0128
0129
0130
0131
0132 int keep_active;
0133
0134
0135
0136
0137
0138 u32 s2s_cp_cl_id;
0139 struct idr s2s_cp_stateids;
0140 spinlock_t s2s_cp_lock;
0141
0142
0143
0144
0145 bool *nfsd_versions;
0146 bool *nfsd4_minorversions;
0147
0148
0149
0150
0151 struct nfsd_drc_bucket *drc_hashtbl;
0152
0153
0154 unsigned int max_drc_entries;
0155
0156
0157 unsigned int maskbits;
0158 unsigned int drc_hashsize;
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168 atomic_t num_drc_entries;
0169
0170
0171 struct percpu_counter counter[NFSD_NET_COUNTERS_NUM];
0172
0173
0174 unsigned int longest_chain;
0175
0176
0177 unsigned int longest_chain_cachesize;
0178
0179 struct shrinker nfsd_reply_cache_shrinker;
0180
0181
0182 spinlock_t nfsd_ssc_lock;
0183 struct list_head nfsd_ssc_mount_list;
0184 wait_queue_head_t nfsd_ssc_waitq;
0185
0186
0187 char nfsd_name[UNX_MAXNODENAME+1];
0188
0189 struct nfsd_fcache_disposal *fcache_disposal;
0190
0191 siphash_key_t siphash_key;
0192
0193 atomic_t nfs4_client_count;
0194 int nfs4_max_clients;
0195 };
0196
0197
0198 #define nfsd_netns_ready(nn) ((nn)->sessionid_hashtbl)
0199
0200 extern void nfsd_netns_free_versions(struct nfsd_net *nn);
0201
0202 extern unsigned int nfsd_net_id;
0203
0204 void nfsd_copy_write_verifier(__be32 verf[2], struct nfsd_net *nn);
0205 void nfsd_reset_write_verifier(struct nfsd_net *nn);
0206 #endif