| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * per net namespace data structures for nfsd |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 19 | 6 | */ |
|---|
| 20 | 7 | |
|---|
| 21 | 8 | #ifndef __NFSD_NETNS_H__ |
|---|
| .. | .. |
|---|
| 53 | 40 | |
|---|
| 54 | 41 | struct lock_manager nfsd4_manager; |
|---|
| 55 | 42 | bool grace_ended; |
|---|
| 56 | | - time_t boot_time; |
|---|
| 43 | + time64_t boot_time; |
|---|
| 44 | + |
|---|
| 45 | + struct dentry *nfsd_client_dir; |
|---|
| 57 | 46 | |
|---|
| 58 | 47 | /* |
|---|
| 59 | 48 | * reclaim_str_hashtbl[] holds known client info from previous reset/reboot |
|---|
| .. | .. |
|---|
| 100 | 89 | bool in_grace; |
|---|
| 101 | 90 | const struct nfsd4_client_tracking_ops *client_tracking_ops; |
|---|
| 102 | 91 | |
|---|
| 103 | | - time_t nfsd4_lease; |
|---|
| 104 | | - time_t nfsd4_grace; |
|---|
| 92 | + time64_t nfsd4_lease; |
|---|
| 93 | + time64_t nfsd4_grace; |
|---|
| 105 | 94 | bool somebody_reclaimed; |
|---|
| 95 | + |
|---|
| 96 | + bool track_reclaim_completes; |
|---|
| 97 | + atomic_t nr_reclaim_complete; |
|---|
| 106 | 98 | |
|---|
| 107 | 99 | bool nfsd_net_up; |
|---|
| 108 | 100 | bool lockd_up; |
|---|
| 109 | 101 | |
|---|
| 110 | 102 | /* Time of server startup */ |
|---|
| 111 | 103 | struct timespec64 nfssvc_boot; |
|---|
| 104 | + seqlock_t boot_lock; |
|---|
| 112 | 105 | |
|---|
| 113 | 106 | /* |
|---|
| 114 | 107 | * Max number of connections this nfsd container will allow. Defaults |
|---|
| .. | .. |
|---|
| 116 | 109 | */ |
|---|
| 117 | 110 | unsigned int max_connections; |
|---|
| 118 | 111 | |
|---|
| 112 | + u32 clientid_base; |
|---|
| 119 | 113 | u32 clientid_counter; |
|---|
| 120 | 114 | u32 clverifier_counter; |
|---|
| 121 | 115 | |
|---|
| .. | .. |
|---|
| 123 | 117 | |
|---|
| 124 | 118 | wait_queue_head_t ntf_wq; |
|---|
| 125 | 119 | 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]; |
|---|
| 126 | 176 | }; |
|---|
| 127 | 177 | |
|---|
| 128 | 178 | /* Simple check to find out if a given net was properly initialized */ |
|---|
| 129 | 179 | #define nfsd_netns_ready(nn) ((nn)->sessionid_hashtbl) |
|---|
| 130 | 180 | |
|---|
| 181 | +extern void nfsd_netns_free_versions(struct nfsd_net *nn); |
|---|
| 182 | + |
|---|
| 131 | 183 | 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); |
|---|
| 132 | 187 | #endif /* __NFSD_NETNS_H__ */ |
|---|