Blame view
include/linux/nfs_fs_sb.h
10 KB
b24413180
|
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4c
|
2 3 4 5 6 |
#ifndef _NFS_FS_SB #define _NFS_FS_SB #include <linux/list.h> #include <linux/backing-dev.h> |
9157c31dd
|
7 |
#include <linux/idr.h> |
ef818a28f
|
8 |
#include <linux/wait.h> |
557134a39
|
9 10 |
#include <linux/nfs_xdr.h> #include <linux/sunrpc/xprt.h> |
ef818a28f
|
11 |
|
60063497a
|
12 |
#include <linux/atomic.h> |
212bf41d8
|
13 |
#include <linux/refcount.h> |
1da177e4c
|
14 |
|
557134a39
|
15 |
struct nfs4_session; |
d9ef5a8c2
|
16 |
struct nfs_iostats; |
9289e7f91
|
17 |
struct nlm_host; |
cccef3b96
|
18 19 20 |
struct nfs4_sequence_args; struct nfs4_sequence_res; struct nfs_server; |
97dc13594
|
21 |
struct nfs4_minor_version_ops; |
79d4e1f0d
|
22 |
struct nfs41_server_scope; |
7d2ed9ac2
|
23 |
struct nfs41_impl_id; |
d9ef5a8c2
|
24 |
|
1da177e4c
|
25 |
/* |
24c8dbbb5
|
26 27 28 |
* The nfs_client identifies our client state to the server. */ struct nfs_client { |
212bf41d8
|
29 |
refcount_t cl_count; |
2a4c8994e
|
30 |
atomic_t cl_mds_count; |
24c8dbbb5
|
31 32 33 |
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
|
34 |
#define NFS_CS_SESSION_INITING 2 /* busy initialising session */ |
24c8dbbb5
|
35 |
unsigned long cl_res_state; /* NFS resources state */ |
24c8dbbb5
|
36 37 |
#define NFS_CS_CALLBACK 1 /* - callback started */ #define NFS_CS_IDMAP 2 /* - idmap started */ |
5dd3177ae
|
38 |
#define NFS_CS_RENEWD 3 /* - renewd started */ |
d3b4c9d76
|
39 |
#define NFS_CS_STOP_RENEW 4 /* no more state to renew */ |
d6fb79d43
|
40 |
#define NFS_CS_CHECK_LEASE_TIME 5 /* need to check lease time */ |
4bf590e08
|
41 42 43 |
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
|
44 |
#define NFS_CS_MIGRATION 2 /* - transparent state migr */ |
98f98cf57
|
45 |
#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ |
99875249b
|
46 |
#define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */ |
8dcbec6d2
|
47 |
#define NFS_CS_TSM_POSSIBLE 5 /* - Maybe state migration */ |
4b1b69ced
|
48 |
#define NFS_CS_NOPING 6 /* - don't ping on connect */ |
52f98f1a2
|
49 |
#define NFS_CS_DS 7 /* - Server is a DS */ |
e6237b6fe
|
50 |
#define NFS_CS_REUSEPORT 8 /* - reuse src port on reconnect */ |
6e4cffd7b
|
51 52 |
struct sockaddr_storage cl_addr; /* server identifier */ size_t cl_addrlen; |
24c8dbbb5
|
53 |
char * cl_hostname; /* hostname of server */ |
f11b2a1cf
|
54 |
char * cl_acceptor; /* GSSAPI acceptor name */ |
24c8dbbb5
|
55 56 57 58 |
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
|
59 |
const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */ |
59dca3b28
|
60 |
int cl_proto; /* Network transport protocol */ |
ab7017a3a
|
61 |
struct nfs_subversion * cl_nfs_mod; /* pointer to nfs version module */ |
24c8dbbb5
|
62 |
|
94a417f3d
|
63 |
u32 cl_minorversion;/* NFSv4 minorversion */ |
6619079d0
|
64 |
unsigned int cl_nconnect; /* Number of connections */ |
5e16923b4
|
65 |
const char * cl_principal; /* used for machine cred */ |
7c67db3a8
|
66 |
|
89d77c8fa
|
67 |
#if IS_ENABLED(CONFIG_NFS_V4) |
0e20162ed
|
68 |
struct list_head cl_ds_clients; /* auth flavor data servers */ |
24c8dbbb5
|
69 |
u64 cl_clientid; /* constant */ |
fd954ae12
|
70 |
nfs4_verifier cl_confirm; /* Clientid verifier */ |
24c8dbbb5
|
71 |
unsigned long cl_state; |
24c8dbbb5
|
72 73 74 75 |
spinlock_t cl_lock; unsigned long cl_lease_time; unsigned long cl_last_renewal; |
52bad64d9
|
76 |
struct delayed_work cl_renewd; |
24c8dbbb5
|
77 78 |
struct rpc_wait_queue cl_rpcwaitq; |
24c8dbbb5
|
79 80 |
/* idmapper */ struct idmap * cl_idmap; |
ceb3a16c0
|
81 82 |
/* Client owner identifier */ const char * cl_owner_id; |
f4eecd5da
|
83 |
u32 cl_cb_ident; /* v4.0 callback identifier */ |
97dc13594
|
84 |
const struct nfs4_minor_version_ops *cl_mvops; |
c9fdeb280
|
85 |
unsigned long cl_mig_gen; |
147272813
|
86 |
|
abf79bb34
|
87 88 |
/* NFSv4.0 transport blocking */ struct nfs4_slot_table *cl_slot_tbl; |
99fe60d06
|
89 90 91 92 |
/* 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
|
93 |
struct nfs4_session *cl_session; /* shared session */ |
05f4c350e
|
94 |
bool cl_preserve_clid; |
acdeb69d9
|
95 |
struct nfs41_server_owner *cl_serverowner; |
79d4e1f0d
|
96 |
struct nfs41_server_scope *cl_serverscope; |
591555465
|
97 |
struct nfs41_impl_id *cl_implid; |
2031cd1af
|
98 99 100 101 |
/* 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
|
102 |
#define NFS_SP4_MACH_CRED_CLEANUP 2 /* CLOSE and LOCKU */ |
8b5bee2e1
|
103 |
#define NFS_SP4_MACH_CRED_SECINFO 3 /* SECINFO and SECINFO_NO_NAME */ |
3787d5063
|
104 |
#define NFS_SP4_MACH_CRED_STATEID 4 /* TEST_STATEID and FREE_STATEID */ |
8c21c62c4
|
105 106 |
#define NFS_SP4_MACH_CRED_WRITE 5 /* WRITE */ #define NFS_SP4_MACH_CRED_COMMIT 6 /* COMMIT */ |
99ade3c71
|
107 |
#define NFS_SP4_MACH_CRED_PNFS_CLEANUP 7 /* LAYOUTRETURN */ |
a1d617d8f
|
108 109 110 |
#if IS_ENABLED(CONFIG_NFS_V4_1) wait_queue_head_t cl_lock_waitq; #endif /* CONFIG_NFS_V4_1 */ |
0400a6b0c
|
111 |
#endif /* CONFIG_NFS_V4 */ |
557134a39
|
112 |
|
1a04c6e1a
|
113 114 115 116 |
/* Our own IP address, as a null-terminated string. * This is used to generate the mv0 callback address. */ char cl_ipaddr[48]; |
147272813
|
117 118 119 |
#ifdef CONFIG_NFS_FSCACHE struct fscache_cookie *fscache; /* client index cache cookie */ #endif |
78fe0f41d
|
120 |
|
73ea666c2
|
121 |
struct net *cl_net; |
bc0c9079b
|
122 |
struct list_head pending_cb_stateids; |
24c8dbbb5
|
123 124 125 |
}; /* |
1da177e4c
|
126 127 128 |
* NFS client parameters stored in the superblock. */ struct nfs_server { |
27951bd26
|
129 |
struct nfs_client * nfs_client; /* shared client and NFS4 state */ |
54ceac451
|
130 131 132 133 |
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
|
134 |
struct rpc_clnt * client; /* RPC client handle */ |
b7fa0554c
|
135 |
struct rpc_clnt * client_acl; /* ACL RPC client handle */ |
9289e7f91
|
136 |
struct nlm_host *nlm_host; /* NLM client handle */ |
003cb608a
|
137 |
struct nfs_iostats __percpu *io_stats; /* I/O statistics */ |
277866a0e
|
138 |
atomic_long_t writeback; /* number of writeback pages */ |
1da177e4c
|
139 |
int flags; /* various flags */ |
7b1355b61
|
140 141 142 143 144 145 146 147 |
/* The following are for internal use only. Also see uapi/linux/nfs_mount.h */ #define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 #define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 #define NFS_MOUNT_NORESVPORT 0x40000 #define NFS_MOUNT_LEGACY_INTERFACE 0x80000 #define NFS_MOUNT_LOCAL_FLOCK 0x100000 #define NFS_MOUNT_LOCAL_FCNTL 0x200000 |
91a575e1a
|
148 |
#define NFS_MOUNT_SOFTERR 0x400000 |
c74dfe97c
|
149 |
#define NFS_MOUNT_SOFTREVAL 0x800000 |
7b1355b61
|
150 |
|
1da177e4c
|
151 152 153 154 155 156 157 |
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
|
158 |
unsigned short port; /* "port=" setting */ |
1da177e4c
|
159 |
unsigned int bsize; /* server block size */ |
04a5da690
|
160 161 162 163 164 |
#ifdef CONFIG_NFS_V4_2 unsigned int gxasize; /* getxattr size */ unsigned int sxasize; /* setxattr size */ unsigned int lxasize; /* listxattr size */ #endif |
1da177e4c
|
165 166 167 168 169 |
unsigned int acregmin; /* attr cache timeouts */ unsigned int acregmax; unsigned int acdirmin; unsigned int acdirmax; unsigned int namelen; |
c6a6f19e2
|
170 |
unsigned int options; /* extra options enabled by mount */ |
2a92ee92d
|
171 |
unsigned int clone_blksize; /* granularity of a CLONE operation */ |
c6a6f19e2
|
172 |
#define NFS_OPTION_FSCACHE 0x00000001 /* - local caching enabled */ |
896526174
|
173 |
#define NFS_OPTION_MIGRATION 0x00000002 /* - NFSv4 migration enabled */ |
54ceac451
|
174 |
|
8b4bdcf89
|
175 |
struct nfs_fsid fsid; |
54ceac451
|
176 |
__u64 maxfilesize; /* maximum file size */ |
e86d5a028
|
177 |
struct timespec64 time_delta; /* smallest time granularity */ |
67ec9f46b
|
178 |
unsigned long mount_time; /* when this fs was mounted */ |
ce6cda184
|
179 |
struct super_block *super; /* VFS super block */ |
54ceac451
|
180 |
dev_t s_dev; /* superblock dev numbers */ |
0f5f49b8b
|
181 |
struct nfs_auth_info auth_info; /* parsed auth flavors */ |
54ceac451
|
182 |
|
08734048b
|
183 184 185 186 |
#ifdef CONFIG_NFS_FSCACHE struct nfs_fscache_key *fscache_key; /* unique key for superblock */ struct fscache_cookie *fscache; /* superblock cookie */ #endif |
a00ed25cc
|
187 |
u32 pnfs_blksize; /* layout_blksize attr */ |
89d77c8fa
|
188 |
#if IS_ENABLED(CONFIG_NFS_V4) |
dae100c2b
|
189 |
u32 attr_bitmask[3];/* V4 bitmask representing the set |
1da177e4c
|
190 191 |
of attributes supported on this filesystem */ |
aa9c26696
|
192 193 194 195 196 |
u32 attr_bitmask_nl[3]; /* V4 bitmask representing the set of attributes supported on this filesystem excluding the label support bit. */ |
8c61282ff
|
197 198 199 200 201 |
u32 exclcreat_bitmask[3]; /* V4 bitmask representing the set of attributes supported on this filesystem for the exclusive create. */ |
a09df2ca2
|
202 |
u32 cache_consistency_bitmask[3]; |
a65318bf3
|
203 204 205 206 |
/* V4 bitmask representing the subset of change attribute, size, ctime and mtime attributes supported by the server */ |
1da177e4c
|
207 208 209 |
u32 acl_bitmask; /* V4 bitmask representing the ACEs that are supported on this filesystem */ |
264e6351c
|
210 211 212 |
u32 fh_expire_type; /* V4 bitmask representing file handle volatility type for this filesystem */ |
85e174ba6
|
213 |
struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ |
f7e8917a6
|
214 |
struct rpc_wait_queue roc_rpcwaitq; |
2f9fd1826
|
215 |
void *pnfs_ld_data; /* per mount point data */ |
24d292b89
|
216 217 218 |
/* the following fields are protected by nfs_client->cl_lock */ struct rb_root state_owners; |
1da177e4c
|
219 |
#endif |
9157c31dd
|
220 |
struct ida openowner_id; |
d2d7ce28a
|
221 |
struct ida lockowner_id; |
0aaaf5c42
|
222 |
struct list_head state_owners_lru; |
6382a4413
|
223 |
struct list_head layouts; |
d3978bb32
|
224 |
struct list_head delegations; |
62164f317
|
225 |
struct list_head ss_copies; |
c9fdeb280
|
226 227 228 229 230 |
unsigned long mig_gen; unsigned long mig_status; #define NFS_MIG_IN_TRANSITION (1) #define NFS_MIG_FAILED (2) |
8dcbec6d2
|
231 |
#define NFS_MIG_TSM_POSSIBLE (3) |
c9fdeb280
|
232 |
|
54ceac451
|
233 |
void (*destroy)(struct nfs_server *); |
ef818a28f
|
234 235 |
atomic_t active; /* Keep trace of any activity to this server */ |
3f8400d1f
|
236 237 238 239 240 241 242 |
/* 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
|
243 |
struct rpc_wait_queue uoc_rpcwaitq; |
8d8928d87
|
244 245 246 |
/* XDR related information */ unsigned int read_hdrsize; |
1a58e8a0e
|
247 248 249 |
/* User namespace info */ const struct cred *cred; |
1da177e4c
|
250 251 252 253 254 255 256 257 |
}; /* 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
|
258 |
/* #define NFS_CAP_CHANGE_ATTR (1U << 5) */ |
6e01260ce
|
259 |
#define NFS_CAP_LGOPEN (1U << 5) |
62ab460cf
|
260 261 262 263 264 265 266 267 |
#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
|
268 |
#define NFS_CAP_POSIX_LOCK (1U << 14) |
b064eca2c
|
269 |
#define NFS_CAP_UIDGID_NOMAP (1U << 15) |
3b66486c4
|
270 |
#define NFS_CAP_STATEID_NFSV41 (1U << 16) |
49f9a0faf
|
271 |
#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) |
e64a4210f
|
272 |
#define NFS_CAP_SECURITY_LABEL (1U << 18) |
1c6dcbe5c
|
273 |
#define NFS_CAP_SEEK (1U << 19) |
f4ac1674f
|
274 |
#define NFS_CAP_ALLOCATE (1U << 20) |
624bd5b7b
|
275 |
#define NFS_CAP_DEALLOCATE (1U << 21) |
6c5a0d891
|
276 |
#define NFS_CAP_LAYOUTSTATS (1U << 22) |
e5341f3a5
|
277 |
#define NFS_CAP_CLONE (1U << 23) |
2e72448b0
|
278 |
#define NFS_CAP_COPY (1U << 24) |
cb95deea0
|
279 |
#define NFS_CAP_OFFLOAD_CANCEL (1U << 25) |
3eb86093e
|
280 |
#define NFS_CAP_LAYOUTERROR (1U << 26) |
0491567b5
|
281 |
#define NFS_CAP_COPY_NOTIFY (1U << 27) |
b78ef845c
|
282 |
#define NFS_CAP_XATTR (1U << 28) |
c56755261
|
283 |
#define NFS_CAP_READ_PLUS (1U << 29) |
1da177e4c
|
284 285 |
#endif |