blob: e73bdbb1634ab252008a8cde3f6887d8fa835ca0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Copyright (c) 2001 The Regents of the University of Michigan.
3 * All rights reserved.
4 *
5 * Kendrick Smith <kmsmith@umich.edu>
6 * Andy Adamson <andros@umich.edu>
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
34
35#ifndef _NFSD4_STATE_H
36#define _NFSD4_STATE_H
37
J. Bruce Fields38c2f4b2011-09-23 17:01:19 -040038#include <linux/idr.h>
Elena Reshetovaa15dfcd2017-10-20 12:53:28 +030039#include <linux/refcount.h>
J. Bruce Fields19cf5c02010-06-06 18:37:16 -040040#include <linux/sunrpc/svc_xprt.h>
J. Bruce Fields1557aca2009-12-04 19:36:06 -050041#include "nfsfh.h"
J. Bruce Fieldse8a79fb2019-03-22 11:11:06 -040042#include "nfsd.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
Linus Torvalds1da177e2005-04-16 15:20:36 -070044typedef struct {
45 u32 cl_boot;
46 u32 cl_id;
47} clientid_t;
48
49typedef struct {
J. Bruce Fieldsd3b313a2011-09-15 15:02:41 -040050 clientid_t so_clid;
51 u32 so_id;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052} stateid_opaque_t;
53
54typedef struct {
55 u32 si_generation;
56 stateid_opaque_t si_opaque;
57} stateid_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
Olga Kornievskaia624322f2019-10-04 16:34:26 -040059typedef struct {
60 stateid_t stid;
61#define NFS4_COPY_STID 1
62#define NFS4_COPYNOTIFY_STID 2
63 unsigned char sc_type;
64 refcount_t sc_count;
65} copy_stateid_t;
66
J. Bruce Fields227f98d92010-02-18 08:27:24 -080067struct nfsd4_callback {
J. Bruce Fieldsfb003922010-05-31 18:21:37 -040068 struct nfs4_client *cb_clp;
J. Bruce Fields58784532010-05-16 16:47:08 -040069 struct rpc_message cb_msg;
Julia Lawallc4cb8972015-11-21 22:57:39 +010070 const struct nfsd4_callback_ops *cb_ops;
J. Bruce Fieldsb5a1a812010-03-03 14:52:55 -050071 struct work_struct cb_work;
Kinglong Mee7ba6cad2015-06-24 16:33:37 +080072 int cb_seq_status;
Christoph Hellwigef2a1b32015-04-30 11:49:23 +020073 int cb_status;
Christoph Hellwigcba5f622015-04-30 11:49:24 +020074 bool cb_need_restart;
Trond Myklebuste6abc8c2019-04-05 08:54:37 -070075 bool cb_holds_slot;
J. Bruce Fields227f98d92010-02-18 08:27:24 -080076};
77
Christoph Hellwig0162ac22014-09-24 12:19:19 +020078struct nfsd4_callback_ops {
79 void (*prepare)(struct nfsd4_callback *);
80 int (*done)(struct nfsd4_callback *, struct rpc_task *);
81 void (*release)(struct nfsd4_callback *);
82};
83
Jeff Layton14a571a2014-08-05 15:13:30 -040084/*
85 * A core object that represents a "common" stateid. These are generally
86 * embedded within the different (more specific) stateid objects and contain
87 * fields that are of general use to any stateid.
88 */
J. Bruce Fieldsd5477a82011-09-08 12:07:44 -040089struct nfs4_stid {
Elena Reshetovaa15dfcd2017-10-20 12:53:28 +030090 refcount_t sc_count;
J. Bruce Fieldsd5477a82011-09-08 12:07:44 -040091#define NFS4_OPEN_STID 1
92#define NFS4_LOCK_STID 2
93#define NFS4_DELEG_STID 4
J. Bruce Fieldsf7a4d872011-09-16 20:12:38 -040094/* For an open stateid kept around *only* to process close replays: */
95#define NFS4_CLOSED_STID 8
J. Bruce Fields3bd64a52013-04-09 17:02:51 -040096/* For a deleg stateid kept around only to process free_stateid's: */
97#define NFS4_REVOKED_DELEG_STID 16
Trond Myklebustb0fc29d2014-07-16 10:31:59 -040098#define NFS4_CLOSED_DELEG_STID 32
Christoph Hellwig9cf514c2014-05-05 13:11:59 +020099#define NFS4_LAYOUT_STID 64
Olga Kornievskaia624322f2019-10-04 16:34:26 -0400100 struct list_head sc_cp_list;
Jeff Layton9767feb2015-10-01 09:05:50 -0400101 unsigned char sc_type;
102 stateid_t sc_stateid;
103 spinlock_t sc_lock;
104 struct nfs4_client *sc_client;
105 struct nfs4_file *sc_file;
106 void (*sc_free)(struct nfs4_stid *);
J. Bruce Fieldsd5477a82011-09-08 12:07:44 -0400107};
108
Olga Kornievskaia624322f2019-10-04 16:34:26 -0400109/* Keep a list of stateids issued by the COPY_NOTIFY, associate it with the
110 * parent OPEN/LOCK/DELEG stateid.
111 */
112struct nfs4_cpntf_state {
113 copy_stateid_t cp_stateid;
114 struct list_head cp_list; /* per parent nfs4_stid */
115 stateid_t cp_p_stateid; /* copy of parent's stateid */
116 clientid_t cp_p_clid; /* copy of parent's clid */
Arnd Bergmann20b7d862019-11-04 16:31:52 +0100117 time64_t cpntf_time; /* last time stateid used */
Olga Kornievskaia624322f2019-10-04 16:34:26 -0400118};
119
Jeff Layton14a571a2014-08-05 15:13:30 -0400120/*
121 * Represents a delegation stateid. The nfs4_client holds references to these
122 * and they are put when it is being destroyed or when the delegation is
123 * returned by the client:
124 *
125 * o 1 reference as long as a delegation is still in force (taken when it's
126 * alloc'd, put when it's returned or revoked)
127 *
128 * o 1 reference as long as a recall rpc is in progress (taken when the lease
129 * is broken, put when the rpc exits)
130 *
131 * o 1 more ephemeral reference for each nfsd thread currently doing something
132 * with that delegation without holding the cl_lock
133 *
134 * If the server attempts to recall a delegation and the client doesn't do so
135 * before a timeout, the server may also revoke the delegation. In that case,
136 * the object will either be destroyed (v4.0) or moved to a per-client list of
137 * revoked delegations (v4.1+).
138 *
139 * This object is a superset of the nfs4_stid.
140 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141struct nfs4_delegation {
J. Bruce Fields996e0932011-10-17 11:14:48 -0400142 struct nfs4_stid dl_stid; /* must be first field */
NeilBrownea1da632005-06-23 22:04:17 -0700143 struct list_head dl_perfile;
144 struct list_head dl_perclnt;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 struct list_head dl_recall_lru; /* delegation recalled */
Sachin Bhamare8287f002015-04-27 14:50:14 +0200146 struct nfs4_clnt_odstate *dl_clnt_odstate;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 u32 dl_type;
Arnd Bergmann20b7d862019-11-04 16:31:52 +0100148 time64_t dl_time;
J. Bruce Fieldsb53d40c2009-05-01 19:50:00 -0400149/* For recall: */
J. Bruce Fields3aea09d2009-05-01 20:11:12 -0400150 int dl_retries;
J. Bruce Fields227f98d92010-02-18 08:27:24 -0800151 struct nfsd4_callback dl_recall;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152};
153
Jeff Layton34549ab2014-10-01 08:05:22 -0400154#define cb_to_delegation(cb) \
155 container_of(cb, struct nfs4_delegation, dl_recall)
156
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157/* client delegation callback info */
J. Bruce Fieldsc237dc02009-04-29 19:09:19 -0400158struct nfs4_cb_conn {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 /* SETCLIENTID info */
Jeff Laytonaa9a4ec2009-08-14 12:57:57 -0400160 struct sockaddr_storage cb_addr;
Takuma Umeya6f3d7722010-12-15 14:09:01 +0900161 struct sockaddr_storage cb_saddr;
Jeff Laytonaa9a4ec2009-08-14 12:57:57 -0400162 size_t cb_addrlen;
J. Bruce Fields8b5ce5c2010-10-19 17:31:50 -0400163 u32 cb_prog; /* used only in 4.0 case;
164 per-session otherwise */
Andy Adamsonab52ae62009-06-16 04:20:53 +0300165 u32 cb_ident; /* minorversion 0 only */
J. Bruce Fields2bf23872010-03-08 12:37:27 -0500166 struct svc_xprt *cb_xprt; /* minorversion 1 only */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167};
168
J. Bruce Fieldsf459e452011-09-09 09:06:12 -0400169static inline struct nfs4_delegation *delegstateid(struct nfs4_stid *s)
170{
171 return container_of(s, struct nfs4_delegation, dl_stid);
172}
173
Andy Adamsona649637c72009-08-28 08:45:01 -0400174/* Maximum number of slots per session. 160 is useful for long haul TCP */
175#define NFSD_MAX_SLOTS_PER_SESSION 160
Andy Adamsonec6b5d72009-04-03 08:28:28 +0300176/* Maximum number of operations per session compound */
177#define NFSD_MAX_OPS_PER_COMPOUND 16
Andy Adamson557ce262009-08-28 08:45:04 -0400178/* Maximum session per slot cache size */
J. Bruce Fields24906f32014-03-12 15:17:18 -0400179#define NFSD_SLOT_CACHE_SIZE 2048
Andy Adamsona649637c72009-08-28 08:45:01 -0400180/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
181#define NFSD_CACHE_SIZE_SLOTS_PER_SESSION 32
182#define NFSD_MAX_MEM_PER_SESSION \
183 (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
Andy Adamson074fe892009-04-03 08:28:15 +0300184
Andy Adamson7116ed62009-04-03 08:27:43 +0300185struct nfsd4_slot {
Andy Adamson557ce262009-08-28 08:45:04 -0400186 u32 sl_seqid;
187 __be32 sl_status;
J. Bruce Fields53da6a52017-10-17 20:38:49 -0400188 struct svc_cred sl_cred;
Andy Adamson557ce262009-08-28 08:45:04 -0400189 u32 sl_datalen;
J. Bruce Fields73e79482012-02-13 16:39:00 -0500190 u16 sl_opcnt;
191#define NFSD4_SLOT_INUSE (1 << 0)
192#define NFSD4_SLOT_CACHETHIS (1 << 1)
J. Bruce Fieldsbf5c43c2012-02-13 16:56:19 -0500193#define NFSD4_SLOT_INITIALIZED (1 << 2)
J. Bruce Fields085def32017-10-18 16:17:18 -0400194#define NFSD4_SLOT_CACHED (1 << 3)
J. Bruce Fields73e79482012-02-13 16:39:00 -0500195 u8 sl_flags;
Andy Adamson557ce262009-08-28 08:45:04 -0400196 char sl_data[];
Andy Adamson7116ed62009-04-03 08:27:43 +0300197};
198
Alexandros Batsakis6c18ba92009-06-16 04:19:13 +0300199struct nfsd4_channel_attrs {
200 u32 headerpadsz;
201 u32 maxreq_sz;
202 u32 maxresp_sz;
203 u32 maxresp_cached;
204 u32 maxops;
205 u32 maxreqs;
206 u32 nr_rdma_attrs;
207 u32 rdma_attrs;
208};
209
J. Bruce Fieldsacb28872012-03-27 14:50:26 -0400210struct nfsd4_cb_sec {
J. Bruce Fields12fc3e92012-11-05 16:01:48 -0500211 u32 flavor; /* (u32)(-1) used to mean "no valid flavor" */
Eric W. Biederman03bc6d12013-02-02 06:24:49 -0800212 kuid_t uid;
213 kgid_t gid;
J. Bruce Fieldsacb28872012-03-27 14:50:26 -0400214};
215
Andy Adamson49557cc2009-07-23 19:02:16 -0400216struct nfsd4_create_session {
217 clientid_t clientid;
218 struct nfs4_sessionid sessionid;
219 u32 seqid;
220 u32 flags;
221 struct nfsd4_channel_attrs fore_channel;
222 struct nfsd4_channel_attrs back_channel;
223 u32 callback_prog;
J. Bruce Fieldsacb28872012-03-27 14:50:26 -0400224 struct nfsd4_cb_sec cb_sec;
Andy Adamson49557cc2009-07-23 19:02:16 -0400225};
226
J. Bruce Fieldscb73a9f2012-11-01 18:09:48 -0400227struct nfsd4_backchannel_ctl {
228 u32 bc_cb_program;
229 struct nfsd4_cb_sec bc_cb_sec;
230};
231
J. Bruce Fields1d1bc8f2010-10-04 23:12:59 -0400232struct nfsd4_bind_conn_to_session {
233 struct nfs4_sessionid sessionid;
234 u32 dir;
235};
236
Andy Adamson49557cc2009-07-23 19:02:16 -0400237/* The single slot clientid cache structure */
238struct nfsd4_clid_slot {
239 u32 sl_seqid;
240 __be32 sl_status;
241 struct nfsd4_create_session sl_cr_ses;
242};
243
J. Bruce Fieldsc7662512010-06-06 18:12:14 -0400244struct nfsd4_conn {
245 struct list_head cn_persession;
246 struct svc_xprt *cn_xprt;
J. Bruce Fields19cf5c02010-06-06 18:37:16 -0400247 struct svc_xpt_user cn_xpt_user;
248 struct nfsd4_session *cn_session;
J. Bruce Fieldsc7662512010-06-06 18:12:14 -0400249/* CDFC4_FORE, CDFC4_BACK: */
250 unsigned char cn_flags;
251};
252
Jeff Layton14a571a2014-08-05 15:13:30 -0400253/*
254 * Representation of a v4.1+ session. These are refcounted in a similar fashion
255 * to the nfs4_client. References are only taken when the server is actively
256 * working on the object (primarily during the processing of compounds).
257 */
Andy Adamson7116ed62009-04-03 08:27:43 +0300258struct nfsd4_session {
J. Bruce Fields66b2b9b2013-03-19 12:05:39 -0400259 atomic_t se_ref;
Andy Adamson7116ed62009-04-03 08:27:43 +0300260 struct list_head se_hash; /* hash by sessionid */
261 struct list_head se_perclnt;
J. Bruce Fields66b2b9b2013-03-19 12:05:39 -0400262/* See SESSION4_PERSIST, etc. for standard flags; this is internal-only: */
263#define NFS4_SESSION_DEAD 0x010
Andy Adamson7116ed62009-04-03 08:27:43 +0300264 u32 se_flags;
Benny Halevy07cd4902010-05-12 00:13:41 +0300265 struct nfs4_client *se_client;
Andy Adamson7116ed62009-04-03 08:27:43 +0300266 struct nfs4_sessionid se_sessionid;
Alexandros Batsakis6c18ba92009-06-16 04:19:13 +0300267 struct nfsd4_channel_attrs se_fchannel;
268 struct nfsd4_channel_attrs se_bchannel;
J. Bruce Fieldsacb28872012-03-27 14:50:26 -0400269 struct nfsd4_cb_sec se_cb_sec;
J. Bruce Fieldsc7662512010-06-06 18:12:14 -0400270 struct list_head se_conns;
J. Bruce Fields8b5ce5c2010-10-19 17:31:50 -0400271 u32 se_cb_prog;
J. Bruce Fieldsac7c46f22010-06-14 19:01:57 -0400272 u32 se_cb_seq_nr;
Andy Adamson557ce262009-08-28 08:45:04 -0400273 struct nfsd4_slot *se_slots[]; /* forward channel slots */
Andy Adamson7116ed62009-04-03 08:27:43 +0300274};
275
Marc Eshel5282fd72009-04-03 08:27:52 +0300276/* formatted contents of nfs4_sessionid */
277struct nfsd4_sessionid {
278 clientid_t clientid;
279 u32 sequence;
280 u32 reserved;
281};
282
NeilBrowna55370a2005-06-23 22:03:52 -0700283#define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */
284
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285/*
286 * struct nfs4_client - one per client. Clientids live here.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287 *
Jeff Layton14a571a2014-08-05 15:13:30 -0400288 * The initial object created by an NFS client using SETCLIENTID (for NFSv4.0)
289 * or EXCHANGE_ID (for NFSv4.1+). These objects are refcounted and timestamped.
290 * Each nfsd_net_ns object contains a set of these and they are tracked via
291 * short and long form clientid. They are hashed and searched for under the
292 * per-nfsd_net client_lock spinlock.
293 *
294 * References to it are only held during the processing of compounds, and in
295 * certain other operations. In their "resting state" they have a refcount of
296 * 0. If they are not renewed within a lease period, they become eligible for
297 * destruction by the laundromat.
298 *
299 * These objects can also be destroyed prematurely by the fault injection code,
300 * or if the client sends certain forms of SETCLIENTID or EXCHANGE_ID updates.
301 * Care is taken *not* to do this however when the objects have an elevated
302 * refcount.
303 *
304 * o Each nfs4_client is hashed by clientid
305 *
306 * o Each nfs4_clients is also hashed by name (the opaque quantity initially
307 * sent by the client to identify itself).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308 *
Jeff Layton14a571a2014-08-05 15:13:30 -0400309 * o cl_perclient list is used to ensure no dangling stateowner references
310 * when we expire the nfs4_client
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311 */
312struct nfs4_client {
313 struct list_head cl_idhash; /* hash by cl_clientid.id */
Jeff Laytonac55fdc2012-11-12 15:00:56 -0500314 struct rb_node cl_namenode; /* link into by-name trees */
Trond Myklebustd4f04892014-07-29 21:34:36 -0400315 struct list_head *cl_ownerstr_hashtbl;
NeilBrownea1da632005-06-23 22:04:17 -0700316 struct list_head cl_openowners;
J. Bruce Fields38c2f4b2011-09-23 17:01:19 -0400317 struct idr cl_stateids; /* stateid lookup */
NeilBrownea1da632005-06-23 22:04:17 -0700318 struct list_head cl_delegations;
J. Bruce Fields3bd64a52013-04-09 17:02:51 -0400319 struct list_head cl_revoked; /* unacknowledged, revoked 4.1 state */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 struct list_head cl_lru; /* tail queue */
Christoph Hellwig9cf514c2014-05-05 13:11:59 +0200321#ifdef CONFIG_NFSD_PNFS
322 struct list_head cl_lo_states; /* outstanding layout states */
323#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 struct xdr_netobj cl_name; /* id generated by client */
325 nfs4_verifier cl_verifier; /* generated by client */
Arnd Bergmann20b7d862019-11-04 16:31:52 +0100326 time64_t cl_time; /* time of last lease renewal */
Jeff Layton363168b2009-08-14 12:57:56 -0400327 struct sockaddr_storage cl_addr; /* client ipaddress */
J. Bruce Fields57266a62013-04-13 14:27:29 -0400328 bool cl_mach_cred; /* SP4_MACH_CRED in force */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 struct svc_cred cl_cred; /* setclientid principal */
330 clientid_t cl_clientid; /* generated by server */
331 nfs4_verifier cl_confirm; /* generated by server */
J. Bruce Fields8323c3b2010-10-19 19:36:51 -0400332 u32 cl_minorversion;
J. Bruce Fields79123442019-06-05 12:42:05 -0400333 /* NFSv4.1 client implementation id: */
334 struct xdr_netobj cl_nii_domain;
335 struct xdr_netobj cl_nii_name;
Arnd Bergmanne29f4702019-10-31 14:52:43 +0100336 struct timespec64 cl_nii_time;
Marc Eshel9fb87072009-04-03 08:27:46 +0300337
J. Bruce Fields2bf23872010-03-08 12:37:27 -0500338 /* for v4.0 and v4.1 callbacks: */
339 struct nfs4_cb_conn cl_cb_conn;
Jeff Laytona52d7262012-03-21 09:52:02 -0400340#define NFSD4_CLIENT_CB_UPDATE (0)
341#define NFSD4_CLIENT_CB_KILL (1)
342#define NFSD4_CLIENT_STABLE (2) /* client on stable storage */
343#define NFSD4_CLIENT_RECLAIM_COMPLETE (3) /* reclaim_complete done */
Jeff Laytonac55fdc2012-11-12 15:00:56 -0500344#define NFSD4_CLIENT_CONFIRMED (4) /* client is confirmed */
Jeff Laytond682e752014-09-12 16:40:21 -0400345#define NFSD4_CLIENT_UPCALL_LOCK (5) /* upcall serialization */
Jeff Laytona52d7262012-03-21 09:52:02 -0400346#define NFSD4_CLIENT_CB_FLAG_MASK (1 << NFSD4_CLIENT_CB_UPDATE | \
347 1 << NFSD4_CLIENT_CB_KILL)
348 unsigned long cl_flags;
NeilBrowna52458b2018-12-03 11:30:31 +1100349 const struct cred *cl_cb_cred;
J. Bruce Fields2bf23872010-03-08 12:37:27 -0500350 struct rpc_clnt *cl_cb_client;
J. Bruce Fields6ff8da02010-06-04 20:04:45 -0400351 u32 cl_cb_ident;
J. Bruce Fields77a35692010-04-30 18:51:44 -0400352#define NFSD4_CB_UP 0
353#define NFSD4_CB_UNKNOWN 1
354#define NFSD4_CB_DOWN 2
Benny Halevy54237322011-10-19 19:12:58 -0700355#define NFSD4_CB_FAULT 3
J. Bruce Fields77a35692010-04-30 18:51:44 -0400356 int cl_cb_state;
J. Bruce Fieldscee277d2010-05-26 17:52:14 -0400357 struct nfsd4_callback cl_cb_null;
J. Bruce Fieldsedd76782010-06-14 22:26:31 -0400358 struct nfsd4_session *cl_cb_session;
J. Bruce Fields2bf23872010-03-08 12:37:27 -0500359
J. Bruce Fields6ff8da02010-06-04 20:04:45 -0400360 /* for all client information that callback code might need: */
361 spinlock_t cl_lock;
362
Marc Eshel9fb87072009-04-03 08:27:46 +0300363 /* for nfs41 */
364 struct list_head cl_sessions;
Andy Adamson49557cc2009-07-23 19:02:16 -0400365 struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */
Andy Adamson0733d212009-04-03 08:28:01 +0300366 u32 cl_exchange_flags;
Benny Halevy46583e22010-05-12 00:13:29 +0300367 /* number of rpc's in progress over an associated session: */
J. Bruce Fields14ed14c2019-03-20 11:54:11 -0400368 atomic_t cl_rpc_users;
J. Bruce Fieldse8a79fb2019-03-22 11:11:06 -0400369 struct nfsdfs_client cl_nfsdfs;
Andrew Elbleed941642016-06-15 12:52:09 -0400370 struct nfs4_op_map cl_spo_must_allow;
Andy Adamson38524ab2009-09-10 12:25:59 +0300371
J. Bruce Fieldse8a79fb2019-03-22 11:11:06 -0400372 /* debugging info directory under nfsd/clients/ : */
373 struct dentry *cl_nfsd_dentry;
NeilBrown472d1552021-03-20 09:38:04 +1100374 /* 'info' file within that directory. Ref is not counted,
375 * but will remain valid iff cl_nfsd_dentry != NULL
376 */
377 struct dentry *cl_nfsd_info_dentry;
J. Bruce Fieldse8a79fb2019-03-22 11:11:06 -0400378
Andy Adamson38524ab2009-09-10 12:25:59 +0300379 /* for nfs41 callbacks */
Ricardo Labiaga199ff352009-09-10 12:26:25 +0300380 /* We currently support a single back channel with a single slot */
381 unsigned long cl_cb_slot_busy;
Ricardo Labiaga199ff352009-09-10 12:26:25 +0300382 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
383 /* wait here for slots */
Stanislav Kinsburskyc212cec2012-11-14 18:21:10 +0300384 struct net *net;
Olga Kornievskaiae0639dc2018-07-20 18:19:20 -0400385 struct list_head async_copies; /* list of async copies */
386 spinlock_t async_lock; /* lock for async copies */
Trond Myklebust2bbfed92019-10-23 17:43:18 -0400387 atomic_t cl_cb_inflight; /* Outstanding callbacks */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388};
389
390/* struct nfs4_client_reset
391 * one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl
392 * upon lease reset, or from upcall to state_daemon (to read in state
393 * from non-volitile storage) upon reboot.
394 */
395struct nfs4_client_reclaim {
396 struct list_head cr_strhash; /* hash by cr_name */
Jeff Layton0ce0c2b2012-11-12 15:00:55 -0500397 struct nfs4_client *cr_clp; /* pointer to associated clp */
Scott Mayhew6b189102019-03-26 18:06:26 -0400398 struct xdr_netobj cr_name; /* recovery dir name */
Scott Mayhew6ee95d12019-09-09 16:10:31 -0400399 struct xdr_netobj cr_princhash;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400};
401
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402/* A reasonable value for REPLAY_ISIZE was estimated as follows:
403 * The OPEN response, typically the largest, requires
404 * 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) + 8(verifier) +
405 * 4(deleg. type) + 8(deleg. stateid) + 4(deleg. recall flag) +
406 * 20(deleg. space limit) + ~32(deleg. ace) = 112 bytes
407 */
408
409#define NFSD4_REPLAY_ISIZE 112
410
411/*
412 * Replay buffer, where the result of the last seqid-mutating operation
413 * is cached.
414 */
415struct nfs4_replay {
Al Virob37ad282006-10-19 23:28:59 -0700416 __be32 rp_status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 unsigned int rp_buflen;
418 char *rp_buf;
J. Bruce Fieldsa4773c02009-02-02 17:23:10 -0500419 struct knfsd_fh rp_openfh;
Jeff Layton58fb12e2014-07-29 21:34:27 -0400420 struct mutex rp_mutex;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 char rp_ibuf[NFSD4_REPLAY_ISIZE];
422};
423
Jeff Layton6b180f02014-07-29 21:34:26 -0400424struct nfs4_stateowner;
425
426struct nfs4_stateowner_operations {
Jeff Layton8f4b54c2014-07-29 21:34:29 -0400427 void (*so_unhash)(struct nfs4_stateowner *);
Jeff Layton6b180f02014-07-29 21:34:26 -0400428 void (*so_free)(struct nfs4_stateowner *);
429};
430
Jeff Layton14a571a2014-08-05 15:13:30 -0400431/*
432 * A core object that represents either an open or lock owner. The object and
433 * lock owner objects have one of these embedded within them. Refcounts and
434 * other fields common to both owner types are contained within these
435 * structures.
436 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437struct nfs4_stateowner {
Jeff Layton6b180f02014-07-29 21:34:26 -0400438 struct list_head so_strhash;
439 struct list_head so_stateids;
440 struct nfs4_client *so_client;
441 const struct nfs4_stateowner_operations *so_ops;
J. Bruce Fields83e452f2014-07-31 16:10:08 -0400442 /* after increment in nfsd4_bump_seqid, represents the next
NeilBrown7fb64ce2005-07-07 17:59:20 -0700443 * sequence id expected from the client: */
Jeff Layton6b180f02014-07-29 21:34:26 -0400444 atomic_t so_count;
445 u32 so_seqid;
446 struct xdr_netobj so_owner; /* open owner name */
447 struct nfs4_replay so_replay;
448 bool so_is_open_owner;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449};
450
Jeff Layton14a571a2014-08-05 15:13:30 -0400451/*
452 * When a file is opened, the client provides an open state owner opaque string
453 * that indicates the "owner" of that open. These objects are refcounted.
454 * References to it are held by each open state associated with it. This object
455 * is a superset of the nfs4_stateowner struct.
456 */
J. Bruce Fieldsfe0750e2011-07-30 23:33:59 -0400457struct nfs4_openowner {
458 struct nfs4_stateowner oo_owner; /* must be first field */
459 struct list_head oo_perclient;
J. Bruce Fieldsb31b30e2011-09-28 11:47:20 -0400460 /*
461 * We keep around openowners a little while after last close,
462 * which saves clients from having to confirm, and allows us to
463 * handle close replays if they come soon enough. The close_lru
464 * is a list of such openowners, to be reaped by the laundromat
465 * thread eventually if they remain unused:
466 */
467 struct list_head oo_close_lru;
J. Bruce Fields38c387b2011-09-16 17:42:48 -0400468 struct nfs4_ol_stateid *oo_last_closed_stid;
Arnd Bergmann20b7d862019-11-04 16:31:52 +0100469 time64_t oo_time; /* time of placement on so_close_lru */
J. Bruce Fieldsdad1c062011-09-12 12:24:13 -0400470#define NFS4_OO_CONFIRMED 1
471 unsigned char oo_flags;
J. Bruce Fieldsfe0750e2011-07-30 23:33:59 -0400472};
473
Jeff Layton14a571a2014-08-05 15:13:30 -0400474/*
475 * Represents a generic "lockowner". Similar to an openowner. References to it
476 * are held by the lock stateids that are created on its behalf. This object is
Jeff Layton76d348f2016-09-16 16:28:24 -0400477 * a superset of the nfs4_stateowner struct.
Jeff Layton14a571a2014-08-05 15:13:30 -0400478 */
J. Bruce Fieldsfe0750e2011-07-30 23:33:59 -0400479struct nfs4_lockowner {
Jeff Layton76d348f2016-09-16 16:28:24 -0400480 struct nfs4_stateowner lo_owner; /* must be first element */
481 struct list_head lo_blocked; /* blocked file_locks */
J. Bruce Fieldsfe0750e2011-07-30 23:33:59 -0400482};
483
484static inline struct nfs4_openowner * openowner(struct nfs4_stateowner *so)
485{
486 return container_of(so, struct nfs4_openowner, oo_owner);
487}
488
489static inline struct nfs4_lockowner * lockowner(struct nfs4_stateowner *so)
490{
491 return container_of(so, struct nfs4_lockowner, lo_owner);
492}
493
Jeff Layton14a571a2014-08-05 15:13:30 -0400494/*
Sachin Bhamare8287f002015-04-27 14:50:14 +0200495 * Per-client state indicating no. of opens and outstanding delegations
496 * on a file from a particular client.'od' stands for 'open & delegation'
497 */
498struct nfs4_clnt_odstate {
499 struct nfs4_client *co_client;
500 struct nfs4_file *co_file;
501 struct list_head co_perfile;
Elena Reshetovacff7cb22017-10-20 12:53:29 +0300502 refcount_t co_odcount;
Sachin Bhamare8287f002015-04-27 14:50:14 +0200503};
504
505/*
Jeff Layton14a571a2014-08-05 15:13:30 -0400506 * nfs4_file: a file opened by some number of (open) nfs4_stateowners.
507 *
Jeff Laytonccc63982014-10-16 08:49:37 -0400508 * These objects are global. nfsd keeps one instance of a nfs4_file per
509 * filehandle (though it may keep multiple file descriptors for each). Each
510 * inode can have multiple filehandles associated with it, so there is
511 * (potentially) a many to one relationship between this struct and struct
512 * inode.
513 *
514 * These are hashed by filehandle in the file_hashtbl, which is protected by
515 * the global state_lock spinlock.
Jeff Layton14a571a2014-08-05 15:13:30 -0400516 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517struct nfs4_file {
Elena Reshetova818a34e2017-10-20 12:53:30 +0300518 refcount_t fi_ref;
J. Bruce Fieldsa0ce4832021-04-16 14:00:16 -0400519 struct inode * fi_inode;
520 bool fi_aliased;
Trond Myklebust1d31a252014-07-10 14:07:25 -0400521 spinlock_t fi_lock;
Jeff Laytonccc63982014-10-16 08:49:37 -0400522 struct hlist_node fi_hash; /* hash on fi_fhandle */
NeilBrown8beefa22005-06-23 22:03:08 -0700523 struct list_head fi_stateids;
Jeff Layton5b095e92014-10-23 08:01:02 -0400524 union {
525 struct list_head fi_delegations;
526 struct rcu_head fi_rcu;
527 };
Sachin Bhamare8287f002015-04-27 14:50:14 +0200528 struct list_head fi_clnt_odstate;
J. Bruce Fieldsf9d75622010-07-08 11:02:09 -0400529 /* One each for O_RDONLY, O_WRONLY, O_RDWR: */
Jeff Laytonfd4f83f2019-08-18 14:18:52 -0400530 struct nfsd_file *fi_fds[3];
J. Bruce Fieldsf9d75622010-07-08 11:02:09 -0400531 /*
J. Bruce Fields6409a5a2011-09-28 11:37:56 -0400532 * Each open or lock stateid contributes 0-4 to the counts
533 * below depending on which bits are set in st_access_bitmap:
534 * 1 to fi_access[O_RDONLY] if NFS4_SHARE_ACCES_READ is set
535 * + 1 to fi_access[O_WRONLY] if NFS4_SHARE_ACCESS_WRITE is set
536 * + 1 to both of the above if NFS4_SHARE_ACCESS_BOTH is set.
J. Bruce Fieldsf9d75622010-07-08 11:02:09 -0400537 */
J. Bruce Fields9ae78bc2011-03-17 12:52:33 -0400538 atomic_t fi_access[2];
Jeff Laytonbaeb4ff2014-07-10 14:07:34 -0400539 u32 fi_share_deny;
Jeff Laytoneb82dd32019-08-18 14:18:53 -0400540 struct nfsd_file *fi_deleg_file;
Jeff Layton67db1032014-12-13 09:11:40 -0500541 int fi_delegees;
Trond Myklebuste2cf80d2014-07-23 16:17:38 -0400542 struct knfsd_fh fi_fhandle;
Meelap Shah47f99402007-07-17 04:04:40 -0700543 bool fi_had_conflict;
Christoph Hellwig9cf514c2014-05-05 13:11:59 +0200544#ifdef CONFIG_NFSD_PNFS
545 struct list_head fi_lo_states;
Christoph Hellwigc5c707f2014-09-23 12:38:48 +0200546 atomic_t fi_lo_recalls;
Christoph Hellwig9cf514c2014-05-05 13:11:59 +0200547#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548};
549
Jeff Layton14a571a2014-08-05 15:13:30 -0400550/*
551 * A generic struct representing either a open or lock stateid. The nfs4_client
552 * holds a reference to each of these objects, and they in turn hold a
553 * reference to their respective stateowners. The client's reference is
554 * released in response to a close or unlock (depending on whether it's an open
555 * or lock stateid) or when the client is being destroyed.
556 *
557 * In the case of v4.0 open stateids, these objects are preserved for a little
558 * while after close in order to handle CLOSE replays. Those are eventually
559 * reclaimed via a LRU scheme by the laundromat.
560 *
561 * This object is a superset of the nfs4_stid. "ol" stands for "Open or Lock".
562 * Better suggestions welcome.
563 */
J. Bruce Fieldsdcef0412011-09-07 16:06:42 -0400564struct nfs4_ol_stateid {
Jeff Layton35a92fe2015-09-17 07:47:08 -0400565 struct nfs4_stid st_stid;
566 struct list_head st_perfile;
567 struct list_head st_perstateowner;
568 struct list_head st_locks;
569 struct nfs4_stateowner *st_stateowner;
570 struct nfs4_clnt_odstate *st_clnt_odstate;
571 unsigned char st_access_bmap;
572 unsigned char st_deny_bmap;
573 struct nfs4_ol_stateid *st_openstp;
Oleg Drokinfeb9dad2016-06-14 23:28:04 -0400574 struct mutex st_mutex;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575};
576
J. Bruce Fieldsdcef0412011-09-07 16:06:42 -0400577static inline struct nfs4_ol_stateid *openlockstateid(struct nfs4_stid *s)
578{
579 return container_of(s, struct nfs4_ol_stateid, st_stid);
580}
581
Christoph Hellwig9cf514c2014-05-05 13:11:59 +0200582struct nfs4_layout_stateid {
583 struct nfs4_stid ls_stid;
584 struct list_head ls_perclnt;
585 struct list_head ls_perfile;
586 spinlock_t ls_lock;
587 struct list_head ls_layouts;
588 u32 ls_layout_type;
Jeff Laytoneb82dd32019-08-18 14:18:53 -0400589 struct nfsd_file *ls_file;
Christoph Hellwigc5c707f2014-09-23 12:38:48 +0200590 struct nfsd4_callback ls_recall;
591 stateid_t ls_recall_sid;
592 bool ls_recalled;
Jeff Laytoncc8a5532015-09-17 07:58:24 -0400593 struct mutex ls_mutex;
Christoph Hellwig9cf514c2014-05-05 13:11:59 +0200594};
595
596static inline struct nfs4_layout_stateid *layoutstateid(struct nfs4_stid *s)
597{
598 return container_of(s, struct nfs4_layout_stateid, ls_stid);
599}
600
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601/* flags for preprocess_seqid_op() */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602#define RD_STATE 0x00000010
603#define WR_STATE 0x00000020
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604
Christoph Hellwig326129d2014-09-24 12:19:17 +0200605enum nfsd4_cb_op {
606 NFSPROC4_CLNT_CB_NULL = 0,
607 NFSPROC4_CLNT_CB_RECALL,
Christoph Hellwigc5c707f2014-09-23 12:38:48 +0200608 NFSPROC4_CLNT_CB_LAYOUT,
Olga Kornievskaia9eb190fca8f2018-07-20 18:19:17 -0400609 NFSPROC4_CLNT_CB_OFFLOAD,
Christoph Hellwig326129d2014-09-24 12:19:17 +0200610 NFSPROC4_CLNT_CB_SEQUENCE,
Jeff Laytona188620e2016-09-16 16:28:23 -0400611 NFSPROC4_CLNT_CB_NOTIFY_LOCK,
Christoph Hellwig326129d2014-09-24 12:19:17 +0200612};
613
Jeff Layton14b7f4a2016-05-05 06:53:47 -0400614/* Returns true iff a is later than b: */
615static inline bool nfsd4_stateid_generation_after(stateid_t *a, stateid_t *b)
616{
617 return (s32)(a->si_generation - b->si_generation) > 0;
618}
Christoph Hellwig326129d2014-09-24 12:19:17 +0200619
Jeff Layton76d348f2016-09-16 16:28:24 -0400620/*
621 * When a client tries to get a lock on a file, we set one of these objects
622 * on the blocking lock. When the lock becomes free, we can then issue a
623 * CB_NOTIFY_LOCK to the server.
624 */
Jeff Laytona188620e2016-09-16 16:28:23 -0400625struct nfsd4_blocked_lock {
Jeff Layton76d348f2016-09-16 16:28:24 -0400626 struct list_head nbl_list;
Jeff Layton7919d0a2016-09-16 16:28:25 -0400627 struct list_head nbl_lru;
Arnd Bergmann20b7d862019-11-04 16:31:52 +0100628 time64_t nbl_time;
Jeff Laytona188620e2016-09-16 16:28:23 -0400629 struct file_lock nbl_lock;
630 struct knfsd_fh nbl_fh;
631 struct nfsd4_callback nbl_cb;
632};
633
Benny Halevydd453df2009-04-03 08:28:41 +0300634struct nfsd4_compound_state;
Stanislav Kinsbursky2c142ba2012-07-25 16:57:45 +0400635struct nfsd_net;
Olga Kornievskaiae0639dc2018-07-20 18:19:20 -0400636struct nfsd4_copy;
Benny Halevydd453df2009-04-03 08:28:41 +0300637
Christoph Hellwigaf90f702015-06-18 16:45:00 +0200638extern __be32 nfs4_preprocess_stateid_op(struct svc_rqst *rqstp,
Anna Schumakeraa0d6ae2015-12-03 12:59:51 +0100639 struct nfsd4_compound_state *cstate, struct svc_fh *fhp,
Olga Kornievskaia624322f2019-10-04 16:34:26 -0400640 stateid_t *stateid, int flags, struct nfsd_file **filp,
641 struct nfs4_stid **cstid);
Christoph Hellwigcd61c522014-08-14 08:44:57 +0200642__be32 nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
643 stateid_t *stateid, unsigned char typemask,
644 struct nfs4_stid **s, struct nfsd_net *nn);
Kinglong Meed19fb702017-01-18 19:04:42 +0800645struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab,
646 void (*sc_free)(struct nfs4_stid *));
Olga Kornievskaia624322f2019-10-04 16:34:26 -0400647int nfs4_init_copy_state(struct nfsd_net *nn, struct nfsd4_copy *copy);
648void nfs4_free_copy_state(struct nfsd4_copy *copy);
649struct nfs4_cpntf_state *nfs4_alloc_init_cpntf_state(struct nfsd_net *nn,
650 struct nfs4_stid *p_stid);
Christoph Hellwigcd61c522014-08-14 08:44:57 +0200651void nfs4_unhash_stid(struct nfs4_stid *s);
Trond Myklebust60116952014-07-29 21:34:06 -0400652void nfs4_put_stid(struct nfs4_stid *s);
Jeff Layton9767feb2015-10-01 09:05:50 -0400653void nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid);
Stanislav Kinsbursky52e19c02012-11-14 18:21:16 +0300654void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *, struct nfsd_net *);
655extern void nfs4_release_reclaim(struct nfsd_net *);
Scott Mayhew6b189102019-03-26 18:06:26 -0400656extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(struct xdr_netobj name,
Stanislav Kinsbursky52e19c02012-11-14 18:21:16 +0300657 struct nfsd_net *nn);
J. Bruce Fields1722b042021-01-21 17:57:44 -0500658extern __be32 nfs4_check_open_reclaim(struct nfs4_client *);
J. Bruce Fields5a3c9d72010-10-19 17:56:52 -0400659extern void nfsd4_probe_callback(struct nfs4_client *clp);
J. Bruce Fields84f5f7c2010-12-09 15:52:19 -0500660extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
J. Bruce Fields5a3c9d72010-10-19 17:56:52 -0400661extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *);
Christoph Hellwigf0b5de12014-09-24 12:19:18 +0200662extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
Julia Lawallc4cb8972015-11-21 22:57:39 +0100663 const struct nfsd4_callback_ops *ops, enum nfsd4_cb_op op);
Christoph Hellwigf0b5de12014-09-24 12:19:18 +0200664extern void nfsd4_run_cb(struct nfsd4_callback *cb);
J. Bruce Fieldsb5a1a812010-03-03 14:52:55 -0500665extern int nfsd4_create_callback_queue(void);
666extern void nfsd4_destroy_callback_queue(void);
J. Bruce Fields6ff8da02010-06-04 20:04:45 -0400667extern void nfsd4_shutdown_callback(struct nfs4_client *);
Olga Kornievskaiae0639dc2018-07-20 18:19:20 -0400668extern void nfsd4_shutdown_copy(struct nfs4_client *clp);
Jeff Layton02e12152014-07-16 10:31:57 -0400669extern void nfsd4_prepare_cb_recall(struct nfs4_delegation *dp);
Scott Mayhew6b189102019-03-26 18:06:26 -0400670extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(struct xdr_netobj name,
Scott Mayhew6ee95d12019-09-09 16:10:31 -0400671 struct xdr_netobj princhash, struct nfsd_net *nn);
Scott Mayhew6b189102019-03-26 18:06:26 -0400672extern bool nfs4_has_reclaimed_state(struct xdr_netobj name, struct nfsd_net *nn);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673
Christoph Hellwige6ba76e2014-08-14 08:50:16 +0200674void put_nfs4_file(struct nfs4_file *fi);
Olga Kornievskaiae0639dc2018-07-20 18:19:20 -0400675extern void nfs4_put_copy(struct nfsd4_copy *copy);
676extern struct nfsd4_copy *
677find_async_copy(struct nfs4_client *clp, stateid_t *staetid);
Olga Kornievskaia624322f2019-10-04 16:34:26 -0400678extern void nfs4_put_cpntf_state(struct nfsd_net *nn,
679 struct nfs4_cpntf_state *cps);
Olga Kornievskaiace0887a2019-10-09 11:50:48 -0400680extern __be32 manage_cpntf_state(struct nfsd_net *nn, stateid_t *st,
681 struct nfs4_client *clp,
682 struct nfs4_cpntf_state **cps);
Christoph Hellwige6ba76e2014-08-14 08:50:16 +0200683static inline void get_nfs4_file(struct nfs4_file *fi)
684{
Elena Reshetova818a34e2017-10-20 12:53:30 +0300685 refcount_inc(&fi->fi_ref);
Christoph Hellwige6ba76e2014-08-14 08:50:16 +0200686}
Jeff Laytoneb82dd32019-08-18 14:18:53 -0400687struct nfsd_file *find_any_file(struct nfs4_file *f);
Christoph Hellwige6ba76e2014-08-14 08:50:16 +0200688
Jeff Layton7f5ef2e2014-09-12 16:40:21 -0400689/* grace period management */
690void nfsd4_end_grace(struct nfsd_net *nn);
691
Jeff Layton2a4317c2012-03-21 16:42:43 -0400692/* nfs4recover operations */
693extern int nfsd4_client_tracking_init(struct net *net);
694extern void nfsd4_client_tracking_exit(struct net *net);
695extern void nfsd4_client_record_create(struct nfs4_client *clp);
696extern void nfsd4_client_record_remove(struct nfs4_client *clp);
697extern int nfsd4_client_record_check(struct nfs4_client *clp);
Jeff Layton919b8042014-09-12 16:40:20 -0400698extern void nfsd4_record_grace_done(struct nfsd_net *nn);
Bryan Schumakerf3c75212012-11-27 09:35:10 -0500699
Linus Torvalds1da177e2005-04-16 15:20:36 -0700700#endif /* NFSD4_STATE_H */