0001
0002 #ifndef _NFS_FS_SB
0003 #define _NFS_FS_SB
0004
0005 #include <linux/list.h>
0006 #include <linux/backing-dev.h>
0007 #include <linux/idr.h>
0008 #include <linux/wait.h>
0009 #include <linux/nfs_xdr.h>
0010 #include <linux/sunrpc/xprt.h>
0011
0012 #include <linux/atomic.h>
0013 #include <linux/refcount.h>
0014
0015 struct nfs4_session;
0016 struct nfs_iostats;
0017 struct nlm_host;
0018 struct nfs4_sequence_args;
0019 struct nfs4_sequence_res;
0020 struct nfs_server;
0021 struct nfs4_minor_version_ops;
0022 struct nfs41_server_scope;
0023 struct nfs41_impl_id;
0024
0025
0026
0027
0028 struct nfs_client {
0029 refcount_t cl_count;
0030 atomic_t cl_mds_count;
0031 int cl_cons_state;
0032 #define NFS_CS_READY 0
0033 #define NFS_CS_INITING 1
0034 #define NFS_CS_SESSION_INITING 2
0035 unsigned long cl_res_state;
0036 #define NFS_CS_CALLBACK 1
0037 #define NFS_CS_IDMAP 2
0038 #define NFS_CS_RENEWD 3
0039 #define NFS_CS_STOP_RENEW 4
0040 #define NFS_CS_CHECK_LEASE_TIME 5
0041 unsigned long cl_flags;
0042 #define NFS_CS_NORESVPORT 0
0043 #define NFS_CS_DISCRTRY 1
0044 #define NFS_CS_MIGRATION 2
0045 #define NFS_CS_INFINITE_SLOTS 3
0046 #define NFS_CS_NO_RETRANS_TIMEOUT 4
0047 #define NFS_CS_TSM_POSSIBLE 5
0048 #define NFS_CS_NOPING 6
0049 #define NFS_CS_DS 7
0050 #define NFS_CS_REUSEPORT 8
0051 struct sockaddr_storage cl_addr;
0052 size_t cl_addrlen;
0053 char * cl_hostname;
0054 char * cl_acceptor;
0055 struct list_head cl_share_link;
0056 struct list_head cl_superblocks;
0057
0058 struct rpc_clnt * cl_rpcclient;
0059 const struct nfs_rpc_ops *rpc_ops;
0060 int cl_proto;
0061 struct nfs_subversion * cl_nfs_mod;
0062
0063 u32 cl_minorversion;
0064 unsigned int cl_nconnect;
0065 unsigned int cl_max_connect;
0066 const char * cl_principal;
0067
0068 #if IS_ENABLED(CONFIG_NFS_V4)
0069 struct list_head cl_ds_clients;
0070 u64 cl_clientid;
0071 nfs4_verifier cl_confirm;
0072 unsigned long cl_state;
0073
0074 spinlock_t cl_lock;
0075
0076 unsigned long cl_lease_time;
0077 unsigned long cl_last_renewal;
0078 struct delayed_work cl_renewd;
0079
0080 struct rpc_wait_queue cl_rpcwaitq;
0081
0082
0083 struct idmap * cl_idmap;
0084
0085
0086 const char * cl_owner_id;
0087
0088 u32 cl_cb_ident;
0089 const struct nfs4_minor_version_ops *cl_mvops;
0090 unsigned long cl_mig_gen;
0091
0092
0093 struct nfs4_slot_table *cl_slot_tbl;
0094
0095
0096 u32 cl_seqid;
0097
0098 u32 cl_exchange_flags;
0099 struct nfs4_session *cl_session;
0100 bool cl_preserve_clid;
0101 struct nfs41_server_owner *cl_serverowner;
0102 struct nfs41_server_scope *cl_serverscope;
0103 struct nfs41_impl_id *cl_implid;
0104
0105 unsigned long cl_sp4_flags;
0106 #define NFS_SP4_MACH_CRED_MINIMAL 1
0107
0108 #define NFS_SP4_MACH_CRED_CLEANUP 2
0109 #define NFS_SP4_MACH_CRED_SECINFO 3
0110 #define NFS_SP4_MACH_CRED_STATEID 4
0111 #define NFS_SP4_MACH_CRED_WRITE 5
0112 #define NFS_SP4_MACH_CRED_COMMIT 6
0113 #define NFS_SP4_MACH_CRED_PNFS_CLEANUP 7
0114 #if IS_ENABLED(CONFIG_NFS_V4_1)
0115 wait_queue_head_t cl_lock_waitq;
0116 #endif
0117 #endif
0118
0119
0120
0121
0122 char cl_ipaddr[48];
0123 struct net *cl_net;
0124 struct list_head pending_cb_stateids;
0125 };
0126
0127
0128
0129
0130 struct nfs_server {
0131 struct nfs_client * nfs_client;
0132 struct list_head client_link;
0133
0134
0135 struct list_head master_link;
0136 struct rpc_clnt * client;
0137 struct rpc_clnt * client_acl;
0138 struct nlm_host *nlm_host;
0139 struct nfs_iostats __percpu *io_stats;
0140 atomic_long_t writeback;
0141 unsigned int write_congested;
0142 unsigned int flags;
0143
0144
0145 #define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
0146 #define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000
0147 #define NFS_MOUNT_NORESVPORT 0x40000
0148 #define NFS_MOUNT_LEGACY_INTERFACE 0x80000
0149 #define NFS_MOUNT_LOCAL_FLOCK 0x100000
0150 #define NFS_MOUNT_LOCAL_FCNTL 0x200000
0151 #define NFS_MOUNT_SOFTERR 0x400000
0152 #define NFS_MOUNT_SOFTREVAL 0x800000
0153 #define NFS_MOUNT_WRITE_EAGER 0x01000000
0154 #define NFS_MOUNT_WRITE_WAIT 0x02000000
0155 #define NFS_MOUNT_TRUNK_DISCOVERY 0x04000000
0156
0157 unsigned int fattr_valid;
0158 unsigned int caps;
0159 unsigned int rsize;
0160 unsigned int rpages;
0161 unsigned int wsize;
0162 unsigned int wpages;
0163 unsigned int wtmult;
0164 unsigned int dtsize;
0165 unsigned short port;
0166 unsigned int bsize;
0167 #ifdef CONFIG_NFS_V4_2
0168 unsigned int gxasize;
0169 unsigned int sxasize;
0170 unsigned int lxasize;
0171 #endif
0172 unsigned int acregmin;
0173 unsigned int acregmax;
0174 unsigned int acdirmin;
0175 unsigned int acdirmax;
0176 unsigned int namelen;
0177 unsigned int options;
0178 unsigned int clone_blksize;
0179 #define NFS_OPTION_FSCACHE 0x00000001
0180 #define NFS_OPTION_MIGRATION 0x00000002
0181
0182 enum nfs4_change_attr_type
0183 change_attr_type;
0184
0185 struct nfs_fsid fsid;
0186 __u64 maxfilesize;
0187 struct timespec64 time_delta;
0188 unsigned long mount_time;
0189 struct super_block *super;
0190 dev_t s_dev;
0191 struct nfs_auth_info auth_info;
0192
0193 #ifdef CONFIG_NFS_FSCACHE
0194 struct fscache_volume *fscache;
0195 char *fscache_uniq;
0196 #endif
0197
0198 u32 pnfs_blksize;
0199 #if IS_ENABLED(CONFIG_NFS_V4)
0200 u32 attr_bitmask[3];
0201
0202
0203 u32 attr_bitmask_nl[3];
0204
0205
0206
0207
0208 u32 exclcreat_bitmask[3];
0209
0210
0211
0212
0213 u32 cache_consistency_bitmask[3];
0214
0215
0216
0217
0218 u32 acl_bitmask;
0219
0220
0221 u32 fh_expire_type;
0222
0223
0224 struct pnfs_layoutdriver_type *pnfs_curr_ld;
0225 struct rpc_wait_queue roc_rpcwaitq;
0226 void *pnfs_ld_data;
0227
0228
0229 struct rb_root state_owners;
0230 #endif
0231 struct ida openowner_id;
0232 struct ida lockowner_id;
0233 struct list_head state_owners_lru;
0234 struct list_head layouts;
0235 struct list_head delegations;
0236 struct list_head ss_copies;
0237
0238 unsigned long mig_gen;
0239 unsigned long mig_status;
0240 #define NFS_MIG_IN_TRANSITION (1)
0241 #define NFS_MIG_FAILED (2)
0242 #define NFS_MIG_TSM_POSSIBLE (3)
0243
0244 void (*destroy)(struct nfs_server *);
0245
0246 atomic_t active;
0247
0248
0249 struct sockaddr_storage mountd_address;
0250 size_t mountd_addrlen;
0251 u32 mountd_version;
0252 unsigned short mountd_port;
0253 unsigned short mountd_protocol;
0254 struct rpc_wait_queue uoc_rpcwaitq;
0255
0256
0257 unsigned int read_hdrsize;
0258
0259
0260 const struct cred *cred;
0261 bool has_sec_mnt_opts;
0262 };
0263
0264
0265 #define NFS_CAP_READDIRPLUS (1U << 0)
0266 #define NFS_CAP_HARDLINKS (1U << 1)
0267 #define NFS_CAP_SYMLINKS (1U << 2)
0268 #define NFS_CAP_ACLS (1U << 3)
0269 #define NFS_CAP_ATOMIC_OPEN (1U << 4)
0270 #define NFS_CAP_LGOPEN (1U << 5)
0271 #define NFS_CAP_CASE_INSENSITIVE (1U << 6)
0272 #define NFS_CAP_CASE_PRESERVING (1U << 7)
0273 #define NFS_CAP_POSIX_LOCK (1U << 14)
0274 #define NFS_CAP_UIDGID_NOMAP (1U << 15)
0275 #define NFS_CAP_STATEID_NFSV41 (1U << 16)
0276 #define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
0277 #define NFS_CAP_SECURITY_LABEL (1U << 18)
0278 #define NFS_CAP_SEEK (1U << 19)
0279 #define NFS_CAP_ALLOCATE (1U << 20)
0280 #define NFS_CAP_DEALLOCATE (1U << 21)
0281 #define NFS_CAP_LAYOUTSTATS (1U << 22)
0282 #define NFS_CAP_CLONE (1U << 23)
0283 #define NFS_CAP_COPY (1U << 24)
0284 #define NFS_CAP_OFFLOAD_CANCEL (1U << 25)
0285 #define NFS_CAP_LAYOUTERROR (1U << 26)
0286 #define NFS_CAP_COPY_NOTIFY (1U << 27)
0287 #define NFS_CAP_XATTR (1U << 28)
0288 #define NFS_CAP_READ_PLUS (1U << 29)
0289 #define NFS_CAP_FS_LOCATIONS (1U << 30)
0290 #define NFS_CAP_MOVEABLE (1U << 31)
0291 #endif