hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/fs/nfsd/netns.h
....@@ -1,21 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * per net namespace data structures for nfsd
34 *
45 * Copyright (C) 2012, Jeff Layton <jlayton@redhat.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the Free
8
- * Software Foundation; either version 2 of the License, or (at your option)
9
- * any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful, but WITHOUT
12
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
- * more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along with
17
- * this program; if not, write to the Free Software Foundation, Inc., 51
18
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
196 */
207
218 #ifndef __NFSD_NETNS_H__
....@@ -53,7 +40,9 @@
5340
5441 struct lock_manager nfsd4_manager;
5542 bool grace_ended;
56
- time_t boot_time;
43
+ time64_t boot_time;
44
+
45
+ struct dentry *nfsd_client_dir;
5746
5847 /*
5948 * reclaim_str_hashtbl[] holds known client info from previous reset/reboot
....@@ -100,15 +89,19 @@
10089 bool in_grace;
10190 const struct nfsd4_client_tracking_ops *client_tracking_ops;
10291
103
- time_t nfsd4_lease;
104
- time_t nfsd4_grace;
92
+ time64_t nfsd4_lease;
93
+ time64_t nfsd4_grace;
10594 bool somebody_reclaimed;
95
+
96
+ bool track_reclaim_completes;
97
+ atomic_t nr_reclaim_complete;
10698
10799 bool nfsd_net_up;
108100 bool lockd_up;
109101
110102 /* Time of server startup */
111103 struct timespec64 nfssvc_boot;
104
+ seqlock_t boot_lock;
112105
113106 /*
114107 * Max number of connections this nfsd container will allow. Defaults
....@@ -116,6 +109,7 @@
116109 */
117110 unsigned int max_connections;
118111
112
+ u32 clientid_base;
119113 u32 clientid_counter;
120114 u32 clverifier_counter;
121115
....@@ -123,10 +117,71 @@
123117
124118 wait_queue_head_t ntf_wq;
125119 atomic_t ntf_refcnt;
120
+
121
+ /* Allow umount to wait for nfsd state cleanup */
122
+ struct completion nfsd_shutdown_complete;
123
+
124
+ /*
125
+ * clientid and stateid data for construction of net unique COPY
126
+ * stateids.
127
+ */
128
+ u32 s2s_cp_cl_id;
129
+ struct idr s2s_cp_stateids;
130
+ spinlock_t s2s_cp_lock;
131
+
132
+ /*
133
+ * Version information
134
+ */
135
+ bool *nfsd_versions;
136
+ bool *nfsd4_minorversions;
137
+
138
+ /*
139
+ * Duplicate reply cache
140
+ */
141
+ struct nfsd_drc_bucket *drc_hashtbl;
142
+
143
+ /* max number of entries allowed in the cache */
144
+ unsigned int max_drc_entries;
145
+
146
+ /* number of significant bits in the hash value */
147
+ unsigned int maskbits;
148
+ unsigned int drc_hashsize;
149
+
150
+ /*
151
+ * Stats and other tracking of on the duplicate reply cache.
152
+ * These fields and the "rc" fields in nfsdstats are modified
153
+ * with only the per-bucket cache lock, which isn't really safe
154
+ * and should be fixed if we want the statistics to be
155
+ * completely accurate.
156
+ */
157
+
158
+ /* total number of entries */
159
+ atomic_t num_drc_entries;
160
+
161
+ /* cache misses due only to checksum comparison failures */
162
+ unsigned int payload_misses;
163
+
164
+ /* amount of memory (in bytes) currently consumed by the DRC */
165
+ unsigned int drc_mem_usage;
166
+
167
+ /* longest hash chain seen */
168
+ unsigned int longest_chain;
169
+
170
+ /* size of cache when we saw the longest hash chain */
171
+ unsigned int longest_chain_cachesize;
172
+
173
+ struct shrinker nfsd_reply_cache_shrinker;
174
+ /* utsname taken from the process that starts the server */
175
+ char nfsd_name[UNX_MAXNODENAME+1];
126176 };
127177
128178 /* Simple check to find out if a given net was properly initialized */
129179 #define nfsd_netns_ready(nn) ((nn)->sessionid_hashtbl)
130180
181
+extern void nfsd_netns_free_versions(struct nfsd_net *nn);
182
+
131183 extern unsigned int nfsd_net_id;
184
+
185
+void nfsd_copy_boot_verifier(__be32 verf[2], struct nfsd_net *nn);
186
+void nfsd_reset_boot_verifier(struct nfsd_net *nn);
132187 #endif /* __NFSD_NETNS_H__ */