Blame view

include/linux/nfs_fs_sb.h 8.78 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
6
  #ifndef _NFS_FS_SB
  #define _NFS_FS_SB
  
  #include <linux/list.h>
  #include <linux/backing-dev.h>
9157c31dd   Trond Myklebust   NFSv4: Replace st...
7
  #include <linux/idr.h>
ef818a28f   Steve Dickson   NFS: Stop sillyna...
8
  #include <linux/wait.h>
557134a39   Andy Adamson   nfs41: sessions c...
9
10
  #include <linux/nfs_xdr.h>
  #include <linux/sunrpc/xprt.h>
ef818a28f   Steve Dickson   NFS: Stop sillyna...
11

60063497a   Arun Sharma   atomic: use <linu...
12
  #include <linux/atomic.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13

557134a39   Andy Adamson   nfs41: sessions c...
14
  struct nfs4_session;
d9ef5a8c2   Chuck Lever   NFS: introduce me...
15
  struct nfs_iostats;
9289e7f91   Chuck Lever   NFS: Invoke nlmcl...
16
  struct nlm_host;
cccef3b96   Andy Adamson   nfs41: introduce ...
17
18
19
  struct nfs4_sequence_args;
  struct nfs4_sequence_res;
  struct nfs_server;
97dc13594   Trond Myklebust   NFSv41: Clean up ...
20
  struct nfs4_minor_version_ops;
79d4e1f0d   Chuck Lever   NFS: Use proper n...
21
  struct nfs41_server_scope;
7d2ed9ac2   Weston Andros Adamson   NFSv4: parse and ...
22
  struct nfs41_impl_id;
d9ef5a8c2   Chuck Lever   NFS: introduce me...
23

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
  /*
24c8dbbb5   David Howells   NFS: Generalise t...
25
26
27
28
   * The nfs_client identifies our client state to the server.
   */
  struct nfs_client {
  	atomic_t		cl_count;
2a4c8994e   Trond Myklebust   NFSv4.1: Fix umou...
29
  	atomic_t		cl_mds_count;
24c8dbbb5   David Howells   NFS: Generalise t...
30
31
32
  	int			cl_cons_state;	/* current construction state (-ve: init error) */
  #define NFS_CS_READY		0		/* ready to be used */
  #define NFS_CS_INITING		1		/* busy initialising */
76db6d950   Andy Adamson   nfs41: add sessio...
33
  #define NFS_CS_SESSION_INITING	2		/* busy initialising  session */
24c8dbbb5   David Howells   NFS: Generalise t...
34
  	unsigned long		cl_res_state;	/* NFS resources state */
24c8dbbb5   David Howells   NFS: Generalise t...
35
36
  #define NFS_CS_CALLBACK		1		/* - callback started */
  #define NFS_CS_IDMAP		2		/* - idmap started */
5dd3177ae   Trond Myklebust   NFSv4: Fix a use-...
37
  #define NFS_CS_RENEWD		3		/* - renewd started */
d3b4c9d76   Andy Adamson   NFSv4.1: new flag...
38
  #define NFS_CS_STOP_RENEW	4		/* no more state to renew */
d6fb79d43   Andy Adamson   NFSv4.1: new flag...
39
  #define NFS_CS_CHECK_LEASE_TIME	5		/* need to check lease time */
4bf590e08   Chuck Lever   NFS: Add nfs_clie...
40
41
42
  	unsigned long		cl_flags;	/* behavior switches */
  #define NFS_CS_NORESVPORT	0		/* - use ephemeral src port */
  #define NFS_CS_DISCRTRY		1		/* - disconnect on RPC retry */
896526174   Chuck Lever   NFS: Introduce "m...
43
  #define NFS_CS_MIGRATION	2		/* - transparent state migr */
98f98cf57   Trond Myklebust   NFSv4.1: Set the ...
44
  #define NFS_CS_INFINITE_SLOTS	3		/* - don't limit TCP slots */
99875249b   Trond Myklebust   NFSv4: Ensure tha...
45
  #define NFS_CS_NO_RETRANS_TIMEOUT	4	/* - Disable retransmit timeouts */
8dcbec6d2   Chuck Lever   NFSv4.1: Handle E...
46
  #define NFS_CS_TSM_POSSIBLE	5		/* - Maybe state migration */
6e4cffd7b   Chuck Lever   NFS: Expand serve...
47
48
  	struct sockaddr_storage	cl_addr;	/* server identifier */
  	size_t			cl_addrlen;
24c8dbbb5   David Howells   NFS: Generalise t...
49
  	char *			cl_hostname;	/* hostname of server */
f11b2a1cf   Jeff Layton   nfs4: copy accept...
50
  	char *			cl_acceptor;	/* GSSAPI acceptor name */
24c8dbbb5   David Howells   NFS: Generalise t...
51
52
53
54
  	struct list_head	cl_share_link;	/* link in global client list */
  	struct list_head	cl_superblocks;	/* List of nfs_server structs */
  
  	struct rpc_clnt *	cl_rpcclient;
8fa5c000d   David Howells   NFS: Move rpc_ops...
55
  	const struct nfs_rpc_ops *rpc_ops;	/* NFS protocol vector */
59dca3b28   Trond Myklebust   NFS: Fix the 'pro...
56
  	int			cl_proto;	/* Network transport protocol */
ab7017a3a   Bryan Schumaker   NFS: Add version ...
57
  	struct nfs_subversion *	cl_nfs_mod;	/* pointer to nfs version module */
24c8dbbb5   David Howells   NFS: Generalise t...
58

94a417f3d   Benny Halevy   nfs41: nfs_client...
59
  	u32			cl_minorversion;/* NFSv4 minorversion */
7c67db3a8   Trond Myklebust   NFSv4: Reintroduc...
60
  	struct rpc_cred		*cl_machine_cred;
89d77c8fa   Bryan Schumaker   NFS: Convert v4 i...
61
  #if IS_ENABLED(CONFIG_NFS_V4)
0e20162ed   Andy Adamson   NFSv4.1 Use MDS a...
62
  	struct list_head	cl_ds_clients; /* auth flavor data servers */
24c8dbbb5   David Howells   NFS: Generalise t...
63
  	u64			cl_clientid;	/* constant */
fd954ae12   Trond Myklebust   NFSv4.1: Don't lo...
64
  	nfs4_verifier		cl_confirm;	/* Clientid verifier */
24c8dbbb5   David Howells   NFS: Generalise t...
65
  	unsigned long		cl_state;
24c8dbbb5   David Howells   NFS: Generalise t...
66
67
68
69
  	spinlock_t		cl_lock;
  
  	unsigned long		cl_lease_time;
  	unsigned long		cl_last_renewal;
52bad64d9   David Howells   WorkStruct: Separ...
70
  	struct delayed_work	cl_renewd;
24c8dbbb5   David Howells   NFS: Generalise t...
71
72
  
  	struct rpc_wait_queue	cl_rpcwaitq;
24c8dbbb5   David Howells   NFS: Generalise t...
73
74
  	/* idmapper */
  	struct idmap *		cl_idmap;
ceb3a16c0   Trond Myklebust   NFSv4: Cache the ...
75
76
  	/* Client owner identifier */
  	const char *		cl_owner_id;
f4eecd5da   Andy Adamson   NFS implement v4....
77
  	u32			cl_cb_ident;	/* v4.0 callback identifier */
97dc13594   Trond Myklebust   NFSv41: Clean up ...
78
  	const struct nfs4_minor_version_ops *cl_mvops;
c9fdeb280   Chuck Lever   NFS: Add basic mi...
79
  	unsigned long		cl_mig_gen;
147272813   David Howells   NFS: Define and c...
80

abf79bb34   Chuck Lever   NFS: Add a slot t...
81
82
  	/* NFSv4.0 transport blocking */
  	struct nfs4_slot_table	*cl_slot_tbl;
99fe60d06   Benny Halevy   nfs41: exchange_i...
83
84
85
86
  	/* The sequence id to use for the next CREATE_SESSION */
  	u32			cl_seqid;
  	/* The flags used for obtaining the clientid during EXCHANGE_ID */
  	u32			cl_exchange_flags;
722baafc9   Chuck Lever   NFS: Fix comment ...
87
  	struct nfs4_session	*cl_session;	/* shared session */
05f4c350e   Chuck Lever   NFS: Discover NFS...
88
  	bool			cl_preserve_clid;
acdeb69d9   Chuck Lever   NFS: EXCHANGE_ID ...
89
  	struct nfs41_server_owner *cl_serverowner;
79d4e1f0d   Chuck Lever   NFS: Use proper n...
90
  	struct nfs41_server_scope *cl_serverscope;
591555465   Chuck Lever   NFS: Use proper n...
91
  	struct nfs41_impl_id	*cl_implid;
2031cd1af   Weston Andros Adamson   nfs4.1: Minimal S...
92
93
94
95
  	/* nfs 4.1+ state protection modes: */
  	unsigned long		cl_sp4_flags;
  #define NFS_SP4_MACH_CRED_MINIMAL  1	/* Minimal sp4_mach_cred - state ops
  					 * must use machine cred */
fa940720c   Weston Andros Adamson   nfs4.1: Add SP4_M...
96
  #define NFS_SP4_MACH_CRED_CLEANUP  2	/* CLOSE and LOCKU */
8b5bee2e1   Weston Andros Adamson   nfs4.1: Add SP4_M...
97
  #define NFS_SP4_MACH_CRED_SECINFO  3	/* SECINFO and SECINFO_NO_NAME */
3787d5063   Weston Andros Adamson   nfs4.1: Add SP4_M...
98
  #define NFS_SP4_MACH_CRED_STATEID  4	/* TEST_STATEID and FREE_STATEID */
8c21c62c4   Weston Andros Adamson   nfs4.1: Add SP4_M...
99
100
  #define NFS_SP4_MACH_CRED_WRITE    5	/* WRITE */
  #define NFS_SP4_MACH_CRED_COMMIT   6	/* COMMIT */
99ade3c71   Andrew Elble   nfs: machine cred...
101
  #define NFS_SP4_MACH_CRED_PNFS_CLEANUP  7 /* LAYOUTRETURN */
a1d617d8f   Jeff Layton   nfs: allow blocki...
102
103
104
  #if IS_ENABLED(CONFIG_NFS_V4_1)
  	wait_queue_head_t	cl_lock_waitq;
  #endif /* CONFIG_NFS_V4_1 */
0400a6b0c   Trond Myklebust   NFSv4/4.1: Fix nf...
105
  #endif /* CONFIG_NFS_V4 */
557134a39   Andy Adamson   nfs41: sessions c...
106

1a04c6e1a   Peng Tao   nfsv3: introduce ...
107
108
109
110
  	/* Our own IP address, as a null-terminated string.
  	 * This is used to generate the mv0 callback address.
  	 */
  	char			cl_ipaddr[48];
147272813   David Howells   NFS: Define and c...
111
112
113
  #ifdef CONFIG_NFS_FSCACHE
  	struct fscache_cookie	*fscache;	/* client index cache cookie */
  #endif
78fe0f41d   Weston Andros Adamson   NFS: use scope fr...
114

73ea666c2   Chuck Lever   NFS: Use proper n...
115
  	struct net		*cl_net;
24c8dbbb5   David Howells   NFS: Generalise t...
116
117
118
  };
  
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119
120
121
   * NFS client parameters stored in the superblock.
   */
  struct nfs_server {
27951bd26   David Howells   NFS: Maintain a c...
122
  	struct nfs_client *	nfs_client;	/* shared client and NFS4 state */
54ceac451   David Howells   NFS: Share NFS su...
123
124
125
126
  	struct list_head	client_link;	/* List of other nfs_server structs
  						 * that share the same client
  						 */
  	struct list_head	master_link;	/* link in master servers list */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
127
  	struct rpc_clnt *	client;		/* RPC client handle */
b7fa0554c   Andreas Gruenbacher   [PATCH] NFS: Add ...
128
  	struct rpc_clnt *	client_acl;	/* ACL RPC client handle */
9289e7f91   Chuck Lever   NFS: Invoke nlmcl...
129
  	struct nlm_host		*nlm_host;	/* NLM client handle */
003cb608a   Tejun Heo   percpu: add __per...
130
  	struct nfs_iostats __percpu *io_stats;	/* I/O statistics */
277866a0e   Peter Zijlstra   nfs: fix congesti...
131
  	atomic_long_t		writeback;	/* number of writeback pages */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
132
133
134
135
136
137
138
139
  	int			flags;		/* various flags */
  	unsigned int		caps;		/* server capabilities */
  	unsigned int		rsize;		/* read size */
  	unsigned int		rpages;		/* read size (in pages) */
  	unsigned int		wsize;		/* write size */
  	unsigned int		wpages;		/* write size (in pages) */
  	unsigned int		wtmult;		/* server disk block size */
  	unsigned int		dtsize;		/* readdir size */
f22d6d79f   Chuck Lever   NFS: Save the val...
140
  	unsigned short		port;		/* "port=" setting */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
141
142
143
144
145
146
  	unsigned int		bsize;		/* server block size */
  	unsigned int		acregmin;	/* attr cache timeouts */
  	unsigned int		acregmax;
  	unsigned int		acdirmin;
  	unsigned int		acdirmax;
  	unsigned int		namelen;
c6a6f19e2   David Howells   NFS: Add FS-Cache...
147
  	unsigned int		options;	/* extra options enabled by mount */
2a92ee92d   Peng Tao   nfs: get clone_bl...
148
  	unsigned int		clone_blksize;	/* granularity of a CLONE operation */
c6a6f19e2   David Howells   NFS: Add FS-Cache...
149
  #define NFS_OPTION_FSCACHE	0x00000001	/* - local caching enabled */
896526174   Chuck Lever   NFS: Introduce "m...
150
  #define NFS_OPTION_MIGRATION	0x00000002	/* - NFSv4 migration enabled */
54ceac451   David Howells   NFS: Share NFS su...
151

8b4bdcf89   Trond Myklebust   NFS: Store the fi...
152
  	struct nfs_fsid		fsid;
54ceac451   David Howells   NFS: Share NFS su...
153
  	__u64			maxfilesize;	/* maximum file size */
6b96724e5   Ricardo Labiaga   Revalidate caches...
154
  	struct timespec		time_delta;	/* smallest time granularity */
67ec9f46b   Chuck Lever   NFS: report how l...
155
  	unsigned long		mount_time;	/* when this fs was mounted */
ce6cda184   Chuck Lever   NFS: Add a super_...
156
  	struct super_block	*super;		/* VFS super block */
54ceac451   David Howells   NFS: Share NFS su...
157
  	dev_t			s_dev;		/* superblock dev numbers */
0f5f49b8b   Weston Andros Adamson   NFS: cache parsed...
158
  	struct nfs_auth_info	auth_info;	/* parsed auth flavors */
54ceac451   David Howells   NFS: Share NFS su...
159

08734048b   David Howells   NFS: Define and c...
160
161
162
163
  #ifdef CONFIG_NFS_FSCACHE
  	struct nfs_fscache_key	*fscache_key;	/* unique key for superblock */
  	struct fscache_cookie	*fscache;	/* superblock cookie */
  #endif
a00ed25cc   Trond Myklebust   NFS: Re-enable co...
164
  	u32			pnfs_blksize;	/* layout_blksize attr */
89d77c8fa   Bryan Schumaker   NFS: Convert v4 i...
165
  #if IS_ENABLED(CONFIG_NFS_V4)
dae100c2b   Fred Isaman   pnfs: ask for lay...
166
  	u32			attr_bitmask[3];/* V4 bitmask representing the set
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
167
168
  						   of attributes supported on this
  						   filesystem */
aa9c26696   David Quigley   NFS: Client imple...
169
170
171
172
173
  	u32			attr_bitmask_nl[3];
  						/* V4 bitmask representing the
  						   set of attributes supported
  						   on this filesystem excluding
  						   the label support bit. */
8c61282ff   Kinglong Mee   NFS: Get suppattr...
174
175
176
177
178
  	u32			exclcreat_bitmask[3];
  						/* V4 bitmask representing the
  						   set of attributes supported
  						   on this filesystem for the
  						   exclusive create. */
a09df2ca2   David Quigley   NFSv4: Extend fat...
179
  	u32			cache_consistency_bitmask[3];
a65318bf3   Trond Myklebust   NFSv4: Simplify s...
180
181
182
183
  						/* V4 bitmask representing the subset
  						   of change attribute, size, ctime
  						   and mtime attributes supported by
  						   the server */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
184
185
186
  	u32			acl_bitmask;	/* V4 bitmask representing the ACEs
  						   that are supported on this
  						   filesystem */
264e6351c   Chuck Lever   NFS: Request fh_e...
187
188
189
  	u32			fh_expire_type;	/* V4 bitmask representing file
  						   handle volatility type for
  						   this filesystem */
85e174ba6   Ricardo Labiaga   NFS: set layout d...
190
  	struct pnfs_layoutdriver_type  *pnfs_curr_ld; /* Active layout driver */
f7e8917a6   Fred Isaman   pnfs: layout roc ...
191
  	struct rpc_wait_queue	roc_rpcwaitq;
2f9fd1826   Fred Isaman   pnfsblock: call a...
192
  	void			*pnfs_ld_data;	/* per mount point data */
24d292b89   Chuck Lever   NFS: Move cl_stat...
193
194
195
  
  	/* the following fields are protected by nfs_client->cl_lock */
  	struct rb_root		state_owners;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
196
  #endif
9157c31dd   Trond Myklebust   NFSv4: Replace st...
197
  	struct ida		openowner_id;
d2d7ce28a   Trond Myklebust   NFSv4: Replace lo...
198
  	struct ida		lockowner_id;
0aaaf5c42   Chuck Lever   NFS: Cache state ...
199
  	struct list_head	state_owners_lru;
6382a4413   Weston Andros Adamson   NFS: move pnfs la...
200
  	struct list_head	layouts;
d3978bb32   Chuck Lever   NFS: Move cl_dele...
201
  	struct list_head	delegations;
c9fdeb280   Chuck Lever   NFS: Add basic mi...
202
203
204
205
206
  
  	unsigned long		mig_gen;
  	unsigned long		mig_status;
  #define NFS_MIG_IN_TRANSITION		(1)
  #define NFS_MIG_FAILED			(2)
8dcbec6d2   Chuck Lever   NFSv4.1: Handle E...
207
  #define NFS_MIG_TSM_POSSIBLE		(3)
c9fdeb280   Chuck Lever   NFS: Add basic mi...
208

54ceac451   David Howells   NFS: Share NFS su...
209
  	void (*destroy)(struct nfs_server *);
ef818a28f   Steve Dickson   NFS: Stop sillyna...
210
211
  
  	atomic_t active; /* Keep trace of any activity to this server */
3f8400d1f   Chuck Lever   NFS: Save the val...
212
213
214
215
216
217
218
  
  	/* mountd-related mount options */
  	struct sockaddr_storage	mountd_address;
  	size_t			mountd_addrlen;
  	u32			mountd_version;
  	unsigned short		mountd_port;
  	unsigned short		mountd_protocol;
7d6ddf88c   Benjamin Coddington   NFS: Add an iocou...
219
  	struct rpc_wait_queue	uoc_rpcwaitq;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
220
221
222
223
224
225
226
227
  };
  
  /* Server capabilities */
  #define NFS_CAP_READDIRPLUS	(1U << 0)
  #define NFS_CAP_HARDLINKS	(1U << 1)
  #define NFS_CAP_SYMLINKS	(1U << 2)
  #define NFS_CAP_ACLS		(1U << 3)
  #define NFS_CAP_ATOMIC_OPEN	(1U << 4)
cd8125997   Trond Myklebust   NFS: Remove the "...
228
  /* #define NFS_CAP_CHANGE_ATTR	(1U << 5) */
62ab460cf   Trond Myklebust   NFSv4: Add 'serve...
229
230
231
232
233
234
235
236
  #define NFS_CAP_FILEID		(1U << 6)
  #define NFS_CAP_MODE		(1U << 7)
  #define NFS_CAP_NLINK		(1U << 8)
  #define NFS_CAP_OWNER		(1U << 9)
  #define NFS_CAP_OWNER_GROUP	(1U << 10)
  #define NFS_CAP_ATIME		(1U << 11)
  #define NFS_CAP_CTIME		(1U << 12)
  #define NFS_CAP_MTIME		(1U << 13)
0df5dd4aa   Trond Myklebust   NFSv4: fix delega...
237
  #define NFS_CAP_POSIX_LOCK	(1U << 14)
b064eca2c   Trond Myklebust   NFSv4: Send unmap...
238
  #define NFS_CAP_UIDGID_NOMAP	(1U << 15)
3b66486c4   Trond Myklebust   NFSv4.1: Select t...
239
  #define NFS_CAP_STATEID_NFSV41	(1U << 16)
49f9a0faf   Trond Myklebust   NFSv4.1: Enable o...
240
  #define NFS_CAP_ATOMIC_OPEN_V1	(1U << 17)
e64a4210f   David Quigley   NFSv4: Add label ...
241
  #define NFS_CAP_SECURITY_LABEL	(1U << 18)
1c6dcbe5c   Anna Schumaker   NFS: Implement SEEK
242
  #define NFS_CAP_SEEK		(1U << 19)
f4ac1674f   Anna Schumaker   nfs: Add ALLOCATE...
243
  #define NFS_CAP_ALLOCATE	(1U << 20)
624bd5b7b   Anna Schumaker   nfs: Add DEALLOCA...
244
  #define NFS_CAP_DEALLOCATE	(1U << 21)
6c5a0d891   Trond Myklebust   NFSv4.2: LAYOUTST...
245
  #define NFS_CAP_LAYOUTSTATS	(1U << 22)
e5341f3a5   Peng Tao   nfs42: add CLONE ...
246
  #define NFS_CAP_CLONE		(1U << 23)
2e72448b0   Anna Schumaker   NFS: Add COPY nfs...
247
  #define NFS_CAP_COPY		(1U << 24)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
248
249
  
  #endif