14ce79717STrond Myklebust /* 24ce79717STrond Myklebust * linux/fs/nfs/nfs4_fs.h 34ce79717STrond Myklebust * 44ce79717STrond Myklebust * Copyright (C) 2005 Trond Myklebust 54ce79717STrond Myklebust * 64ce79717STrond Myklebust * NFSv4-specific filesystem definitions and declarations 74ce79717STrond Myklebust */ 84ce79717STrond Myklebust 94ce79717STrond Myklebust #ifndef __LINUX_FS_NFS_NFS4_FS_H 104ce79717STrond Myklebust #define __LINUX_FS_NFS_NFS4_FS_H 114ce79717STrond Myklebust 1289d77c8fSBryan Schumaker #if IS_ENABLED(CONFIG_NFS_V4) 134ce79717STrond Myklebust 144ce79717STrond Myklebust struct idmap; 154ce79717STrond Myklebust 164ce79717STrond Myklebust enum nfs4_client_state { 17e005e804STrond Myklebust NFS4CLNT_MANAGER_RUNNING = 0, 18e598d843STrond Myklebust NFS4CLNT_CHECK_LEASE, 1958d9714aSTrond Myklebust NFS4CLNT_LEASE_EXPIRED, 20b79a4a1bSTrond Myklebust NFS4CLNT_RECLAIM_REBOOT, 21b79a4a1bSTrond Myklebust NFS4CLNT_RECLAIM_NOGRACE, 22707fb4b3STrond Myklebust NFS4CLNT_DELEGRETURN, 236df08189SAndy Adamson NFS4CLNT_SESSION_RESET, 24fd954ae1STrond Myklebust NFS4CLNT_LEASE_CONFIRM, 2578fe0f41SWeston Andros Adamson NFS4CLNT_SERVER_SCOPE_MISMATCH, 262c820d9aSChuck Lever NFS4CLNT_PURGE_STATE, 27a9e64442SWeston Andros Adamson NFS4CLNT_BIND_CONN_TO_SESSION, 284ce79717STrond Myklebust }; 294ce79717STrond Myklebust 30a2118c33STrond Myklebust enum nfs4_session_state { 311055d76dSTrond Myklebust NFS4_SESSION_INITING, 32a2118c33STrond Myklebust NFS4_SESSION_DRAINING, 33a2118c33STrond Myklebust }; 34a2118c33STrond Myklebust 352f60ea6bSTrond Myklebust #define NFS4_RENEW_TIMEOUT 0x01 362f60ea6bSTrond Myklebust #define NFS4_RENEW_DELEGATION_CB 0x02 372f60ea6bSTrond Myklebust 3897dc1359STrond Myklebust struct nfs4_minor_version_ops { 3997dc1359STrond Myklebust u32 minor_version; 4097dc1359STrond Myklebust 417c513058SBryan Schumaker int (*call_sync)(struct rpc_clnt *clnt, 427c513058SBryan Schumaker struct nfs_server *server, 4397dc1359STrond Myklebust struct rpc_message *msg, 4497dc1359STrond Myklebust struct nfs4_sequence_args *args, 4597dc1359STrond Myklebust struct nfs4_sequence_res *res, 4697dc1359STrond Myklebust int cache_reply); 4736281caaSTrond Myklebust bool (*match_stateid)(const nfs4_stateid *, 48e047a10cSTrond Myklebust const nfs4_stateid *); 49fca78d6dSBryan Schumaker int (*find_root_sec)(struct nfs_server *, struct nfs_fh *, 50fca78d6dSBryan Schumaker struct nfs_fsinfo *); 51c48f4f35STrond Myklebust const struct nfs4_state_recovery_ops *reboot_recovery_ops; 52c48f4f35STrond Myklebust const struct nfs4_state_recovery_ops *nograce_recovery_ops; 53c48f4f35STrond Myklebust const struct nfs4_state_maintenance_ops *state_renewal_ops; 5497dc1359STrond Myklebust }; 5597dc1359STrond Myklebust 56cee54fc9STrond Myklebust #define NFS_SEQID_CONFIRMED 1 57cee54fc9STrond Myklebust struct nfs_seqid_counter { 5895b72eb0STrond Myklebust ktime_t create_time; 5948c22eb2STrond Myklebust int owner_id; 60cee54fc9STrond Myklebust int flags; 61cee54fc9STrond Myklebust u32 counter; 627ba127abSTrond Myklebust spinlock_t lock; /* Protects the list */ 637ba127abSTrond Myklebust struct list_head list; /* Defines sequence of RPC calls */ 647ba127abSTrond Myklebust struct rpc_wait_queue wait; /* RPC call delay queue */ 65cee54fc9STrond Myklebust }; 66cee54fc9STrond Myklebust 67cee54fc9STrond Myklebust struct nfs_seqid { 68cee54fc9STrond Myklebust struct nfs_seqid_counter *sequence; 694e51336aSTrond Myklebust struct list_head list; 704601df20STrond Myklebust struct rpc_task *task; 71cee54fc9STrond Myklebust }; 72cee54fc9STrond Myklebust 73cee54fc9STrond Myklebust static inline void nfs_confirm_seqid(struct nfs_seqid_counter *seqid, int status) 74cee54fc9STrond Myklebust { 75cee54fc9STrond Myklebust if (seqid_mutating_err(-status)) 76cee54fc9STrond Myklebust seqid->flags |= NFS_SEQID_CONFIRMED; 77cee54fc9STrond Myklebust } 78cee54fc9STrond Myklebust 79cee54fc9STrond Myklebust /* 804ce79717STrond Myklebust * NFS4 state_owners and lock_owners are simply labels for ordered 814ce79717STrond Myklebust * sequences of RPC calls. Their sole purpose is to provide once-only 824ce79717STrond Myklebust * semantics by allowing the server to identify replayed requests. 834ce79717STrond Myklebust */ 844ce79717STrond Myklebust struct nfs4_state_owner { 856f2e64d3STrond Myklebust struct nfs_server *so_server; 860aaaf5c4SChuck Lever struct list_head so_lru; 870aaaf5c4SChuck Lever unsigned long so_expires; 8824d292b8SChuck Lever struct rb_node so_server_node; 894ce79717STrond Myklebust 904ce79717STrond Myklebust struct rpc_cred *so_cred; /* Associated cred */ 919f958ab8STrond Myklebust 929f958ab8STrond Myklebust spinlock_t so_lock; 939f958ab8STrond Myklebust atomic_t so_count; 947eff03aeSTrond Myklebust unsigned long so_flags; 954ce79717STrond Myklebust struct list_head so_states; 96cee54fc9STrond Myklebust struct nfs_seqid_counter so_seqid; 974ce79717STrond Myklebust }; 984ce79717STrond Myklebust 997eff03aeSTrond Myklebust enum { 1007eff03aeSTrond Myklebust NFS_OWNER_RECLAIM_REBOOT, 1017eff03aeSTrond Myklebust NFS_OWNER_RECLAIM_NOGRACE 1027eff03aeSTrond Myklebust }; 1037eff03aeSTrond Myklebust 104afe6c27cSAlexandros Batsakis #define NFS_LOCK_NEW 0 105afe6c27cSAlexandros Batsakis #define NFS_LOCK_RECLAIM 1 106afe6c27cSAlexandros Batsakis #define NFS_LOCK_EXPIRED 2 107afe6c27cSAlexandros Batsakis 1084ce79717STrond Myklebust /* 1094ce79717STrond Myklebust * struct nfs4_state maintains the client-side state for a given 1104ce79717STrond Myklebust * (state_owner,inode) tuple (OPEN) or state_owner (LOCK). 1114ce79717STrond Myklebust * 1124ce79717STrond Myklebust * OPEN: 1134ce79717STrond Myklebust * In order to know when to OPEN_DOWNGRADE or CLOSE the state on the server, 1144ce79717STrond Myklebust * we need to know how many files are open for reading or writing on a 1154ce79717STrond Myklebust * given inode. This information too is stored here. 1164ce79717STrond Myklebust * 1174ce79717STrond Myklebust * LOCK: one nfs4_state (LOCK) to hold the lock stateid nfs4_state(OPEN) 1184ce79717STrond Myklebust */ 1194ce79717STrond Myklebust 12077041ed9STrond Myklebust struct nfs4_lock_owner { 12177041ed9STrond Myklebust unsigned int lo_type; 12277041ed9STrond Myklebust #define NFS4_ANY_LOCK_TYPE (0U) 12377041ed9STrond Myklebust #define NFS4_FLOCK_LOCK_TYPE (1U << 0) 12477041ed9STrond Myklebust #define NFS4_POSIX_LOCK_TYPE (1U << 1) 12577041ed9STrond Myklebust union { 12677041ed9STrond Myklebust fl_owner_t posix_owner; 12777041ed9STrond Myklebust pid_t flock_owner; 12877041ed9STrond Myklebust } lo_u; 12977041ed9STrond Myklebust }; 13077041ed9STrond Myklebust 1314ce79717STrond Myklebust struct nfs4_lock_state { 1324ce79717STrond Myklebust struct list_head ls_locks; /* Other lock stateids */ 1338d0a8a9dSTrond Myklebust struct nfs4_state * ls_state; /* Pointer to open state */ 134795a88c9STrond Myklebust #define NFS_LOCK_INITIALIZED 0 135795a88c9STrond Myklebust unsigned long ls_flags; 136cee54fc9STrond Myklebust struct nfs_seqid_counter ls_seqid; 1374ce79717STrond Myklebust nfs4_stateid ls_stateid; 1384ce79717STrond Myklebust atomic_t ls_count; 13977041ed9STrond Myklebust struct nfs4_lock_owner ls_owner; 1404ce79717STrond Myklebust }; 1414ce79717STrond Myklebust 1424ce79717STrond Myklebust /* bits for nfs4_state->flags */ 1434ce79717STrond Myklebust enum { 1444ce79717STrond Myklebust LK_STATE_IN_USE, 145003707c7STrond Myklebust NFS_DELEGATED_STATE, /* Current stateid is delegation */ 146003707c7STrond Myklebust NFS_O_RDONLY_STATE, /* OPEN stateid has read-only state */ 147003707c7STrond Myklebust NFS_O_WRONLY_STATE, /* OPEN stateid has write-only state */ 148003707c7STrond Myklebust NFS_O_RDWR_STATE, /* OPEN stateid has read/write state */ 149b79a4a1bSTrond Myklebust NFS_STATE_RECLAIM_REBOOT, /* OPEN stateid server rebooted */ 150b79a4a1bSTrond Myklebust NFS_STATE_RECLAIM_NOGRACE, /* OPEN stateid needs to recover state */ 1518e469ebdSTrond Myklebust NFS_STATE_POSIX_LOCKS, /* Posix locks are supported */ 1524ce79717STrond Myklebust }; 1534ce79717STrond Myklebust 1544ce79717STrond Myklebust struct nfs4_state { 1554ce79717STrond Myklebust struct list_head open_states; /* List of states for the same state_owner */ 1564ce79717STrond Myklebust struct list_head inode_states; /* List of states for the same inode */ 1574ce79717STrond Myklebust struct list_head lock_states; /* List of subservient lock stateids */ 1584ce79717STrond Myklebust 1594ce79717STrond Myklebust struct nfs4_state_owner *owner; /* Pointer to the open owner */ 1604ce79717STrond Myklebust struct inode *inode; /* Pointer to the inode */ 1614ce79717STrond Myklebust 1624ce79717STrond Myklebust unsigned long flags; /* Do we hold any locks? */ 1638d0a8a9dSTrond Myklebust spinlock_t state_lock; /* Protects the lock_states list */ 1644ce79717STrond Myklebust 1658bda4e4cSTrond Myklebust seqlock_t seqlock; /* Protects the stateid/open_stateid */ 166003707c7STrond Myklebust nfs4_stateid stateid; /* Current stateid: may be delegation */ 167003707c7STrond Myklebust nfs4_stateid open_stateid; /* OPEN stateid */ 1684ce79717STrond Myklebust 1698bda4e4cSTrond Myklebust /* The following 3 fields are protected by owner->so_lock */ 170003707c7STrond Myklebust unsigned int n_rdonly; /* Number of read-only references */ 171003707c7STrond Myklebust unsigned int n_wronly; /* Number of write-only references */ 172003707c7STrond Myklebust unsigned int n_rdwr; /* Number of read/write references */ 173dc0b027dSTrond Myklebust fmode_t state; /* State on the server (R,W, or RW) */ 1744ce79717STrond Myklebust atomic_t count; 1754ce79717STrond Myklebust }; 1764ce79717STrond Myklebust 1774ce79717STrond Myklebust 1784ce79717STrond Myklebust struct nfs4_exception { 1794ce79717STrond Myklebust long timeout; 1804ce79717STrond Myklebust int retry; 1819e33bed5STrond Myklebust struct nfs4_state *state; 1823114ea7aSTrond Myklebust struct inode *inode; 1834ce79717STrond Myklebust }; 1844ce79717STrond Myklebust 1854ce79717STrond Myklebust struct nfs4_state_recovery_ops { 1867eff03aeSTrond Myklebust int owner_flag_bit; 187b79a4a1bSTrond Myklebust int state_flag_bit; 1884ce79717STrond Myklebust int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); 1894ce79717STrond Myklebust int (*recover_lock)(struct nfs4_state *, struct file_lock *); 190591d71cbSAndy Adamson int (*establish_clid)(struct nfs_client *, struct rpc_cred *); 19190a16617SAndy Adamson struct rpc_cred * (*get_clid_cred)(struct nfs_client *); 192fce5c838SRicardo Labiaga int (*reclaim_complete)(struct nfs_client *); 19305f4c350SChuck Lever int (*detect_trunking)(struct nfs_client *, struct nfs_client **, 19405f4c350SChuck Lever struct rpc_cred *); 1954ce79717STrond Myklebust }; 1964ce79717STrond Myklebust 19729fba38bSBenny Halevy struct nfs4_state_maintenance_ops { 1982f60ea6bSTrond Myklebust int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *, unsigned); 199a7b72103SAndy Adamson struct rpc_cred * (*get_state_renewal_cred_locked)(struct nfs_client *); 2008e69514fSBenny Halevy int (*renew_lease)(struct nfs_client *, struct rpc_cred *); 20129fba38bSBenny Halevy }; 20229fba38bSBenny Halevy 203f786aa90SAl Viro extern const struct dentry_operations nfs4_dentry_operations; 20473a79706SBryan Schumaker 20573a79706SBryan Schumaker /* dir.c */ 20673a79706SBryan Schumaker int nfs_atomic_open(struct inode *, struct dentry *, struct file *, 20773a79706SBryan Schumaker unsigned, umode_t, int *); 2086b3b5496SJ. Bruce Fields 2091ae811eeSbjschuma@gmail.com /* super.c */ 2101ae811eeSbjschuma@gmail.com extern struct file_system_type nfs4_fs_type; 2111ae811eeSbjschuma@gmail.com 21272de53ecSBryan Schumaker /* nfs4namespace.c */ 2132671bfc3SBryan Schumaker rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *); 21472de53ecSBryan Schumaker struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *, struct inode *, struct qstr *); 215281cad46SBryan Schumaker struct vfsmount *nfs4_submount(struct nfs_server *, struct dentry *, 216281cad46SBryan Schumaker struct nfs_fh *, struct nfs_fattr *); 21772de53ecSBryan Schumaker 2184ce79717STrond Myklebust /* nfs4proc.c */ 219bb8b27e5STrond Myklebust extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); 220bb8b27e5STrond Myklebust extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); 2213028eb2bSBryan Schumaker extern int nfs4_proc_get_rootfh(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); 2222cf047c9STrond Myklebust extern int nfs4_proc_bind_conn_to_session(struct nfs_client *, struct rpc_cred *cred); 2234d643d1dSAndy Adamson extern int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred); 22466245539STrond Myklebust extern int nfs4_destroy_clientid(struct nfs_client *clp); 225591d71cbSAndy Adamson extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *); 2264d643d1dSAndy Adamson extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); 2271f7977c1STrond Myklebust extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait); 22855a97593STrond Myklebust extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); 229f05d147fSBryan Schumaker extern int nfs4_proc_fs_locations(struct rpc_clnt *, struct inode *, const struct qstr *, 230f05d147fSBryan Schumaker struct nfs4_fs_locations *, struct page *); 231f05d147fSBryan Schumaker extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, struct qstr *, 232f05d147fSBryan Schumaker struct nfs_fh *, struct nfs_fattr *); 23372de53ecSBryan Schumaker extern int nfs4_proc_secinfo(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); 234cf470c3eSTrond Myklebust extern int nfs4_release_lockowner(struct nfs4_lock_state *); 23564c2ce8bSAneesh Kumar K.V extern const struct xattr_handler *nfs4_xattr_handlers[]; 2364ce79717STrond Myklebust 237557134a3SAndy Adamson #if defined(CONFIG_NFS_V4_1) 238035168abSTrond Myklebust static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *server) 239035168abSTrond Myklebust { 240035168abSTrond Myklebust return server->nfs_client->cl_session; 241035168abSTrond Myklebust } 242035168abSTrond Myklebust 243961a828dSTrond Myklebust extern bool nfs4_set_task_privileged(struct rpc_task *task, void *dummy); 244035168abSTrond Myklebust extern int nfs4_setup_sequence(const struct nfs_server *server, 245fbcd4abcSAndy Adamson struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, 2469d12b216STrond Myklebust struct rpc_task *task); 247dc70d7b3SAndy Adamson extern int nfs41_setup_sequence(struct nfs4_session *session, 248dc70d7b3SAndy Adamson struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, 2499d12b216STrond Myklebust struct rpc_task *task); 250557134a3SAndy Adamson extern void nfs4_destroy_session(struct nfs4_session *session); 251557134a3SAndy Adamson extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); 252848f5bdaSTrond Myklebust extern int nfs4_proc_create_session(struct nfs_client *, struct rpc_cred *); 253848f5bdaSTrond Myklebust extern int nfs4_proc_destroy_session(struct nfs4_session *, struct rpc_cred *); 254fccba804STrond Myklebust extern int nfs4_init_session(struct nfs_server *server); 2559430fb6bSRicardo Labiaga extern int nfs4_proc_get_lease_time(struct nfs_client *clp, 2569430fb6bSRicardo Labiaga struct nfs_fsinfo *fsinfo); 257863a3c6cSAndy Adamson extern int nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, 258ef311537SAndy Adamson bool sync); 25994de8b27SAndy Adamson 260ce008c4bSTrond Myklebust extern void nfs41_set_target_slotid(struct nfs4_slot_table *tbl, 261ce008c4bSTrond Myklebust u32 target_highest_slotid); 2629216106aSTrond Myklebust 26394de8b27SAndy Adamson static inline bool 26494de8b27SAndy Adamson is_ds_only_client(struct nfs_client *clp) 26594de8b27SAndy Adamson { 26694de8b27SAndy Adamson return (clp->cl_exchange_flags & EXCHGID4_FLAG_MASK_PNFS) == 26794de8b27SAndy Adamson EXCHGID4_FLAG_USE_PNFS_DS; 26894de8b27SAndy Adamson } 269d83217c1SAndy Adamson 270d83217c1SAndy Adamson static inline bool 271d83217c1SAndy Adamson is_ds_client(struct nfs_client *clp) 272d83217c1SAndy Adamson { 273d83217c1SAndy Adamson return clp->cl_exchange_flags & EXCHGID4_FLAG_USE_PNFS_DS; 274d83217c1SAndy Adamson } 275fbcd4abcSAndy Adamson #else /* CONFIG_NFS_v4_1 */ 276035168abSTrond Myklebust static inline struct nfs4_session *nfs4_get_session(const struct nfs_server *server) 277035168abSTrond Myklebust { 278035168abSTrond Myklebust return NULL; 279035168abSTrond Myklebust } 280035168abSTrond Myklebust 281035168abSTrond Myklebust static inline int nfs4_setup_sequence(const struct nfs_server *server, 282fbcd4abcSAndy Adamson struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, 2839d12b216STrond Myklebust struct rpc_task *task) 284fbcd4abcSAndy Adamson { 285fbcd4abcSAndy Adamson return 0; 286fbcd4abcSAndy Adamson } 287fccba804STrond Myklebust 288fccba804STrond Myklebust static inline int nfs4_init_session(struct nfs_server *server) 289fccba804STrond Myklebust { 290fccba804STrond Myklebust return 0; 291fccba804STrond Myklebust } 29294de8b27SAndy Adamson 29394de8b27SAndy Adamson static inline bool 29494de8b27SAndy Adamson is_ds_only_client(struct nfs_client *clp) 29594de8b27SAndy Adamson { 29694de8b27SAndy Adamson return false; 29794de8b27SAndy Adamson } 298d83217c1SAndy Adamson 299d83217c1SAndy Adamson static inline bool 300d83217c1SAndy Adamson is_ds_client(struct nfs_client *clp) 301d83217c1SAndy Adamson { 302d83217c1SAndy Adamson return false; 303d83217c1SAndy Adamson } 304557134a3SAndy Adamson #endif /* CONFIG_NFS_V4_1 */ 3054ce79717STrond Myklebust 30697dc1359STrond Myklebust extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[]; 30729fba38bSBenny Halevy 3081549210fSTrond Myklebust extern const u32 nfs4_fattr_bitmap[3]; 3094ce79717STrond Myklebust extern const u32 nfs4_statfs_bitmap[2]; 3104ce79717STrond Myklebust extern const u32 nfs4_pathconf_bitmap[2]; 311dae100c2SFred Isaman extern const u32 nfs4_fsinfo_bitmap[3]; 312830b8e33SManoj Naik extern const u32 nfs4_fs_locations_bitmap[2]; 3134ce79717STrond Myklebust 314cdb7ecedSBryan Schumaker void nfs4_free_client(struct nfs_client *); 315cdb7ecedSBryan Schumaker 3166663ee7fSBryan Schumaker struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *); 3176663ee7fSBryan Schumaker 3184ce79717STrond Myklebust /* nfs4renewd.c */ 319adfa6f98SDavid Howells extern void nfs4_schedule_state_renewal(struct nfs_client *); 3204ce79717STrond Myklebust extern void nfs4_renewd_prepare_shutdown(struct nfs_server *); 321adfa6f98SDavid Howells extern void nfs4_kill_renewd(struct nfs_client *); 32265f27f38SDavid Howells extern void nfs4_renew_state(struct work_struct *); 3234ce79717STrond Myklebust 3244ce79717STrond Myklebust /* nfs4state.c */ 325a7b72103SAndy Adamson struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp); 3266dc9d57aSTrond Myklebust struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp); 32705f4c350SChuck Lever int nfs4_discover_server_trunking(struct nfs_client *clp, 32805f4c350SChuck Lever struct nfs_client **); 32905f4c350SChuck Lever int nfs40_discover_server_trunking(struct nfs_client *clp, 33005f4c350SChuck Lever struct nfs_client **, struct rpc_cred *); 331a7b72103SAndy Adamson #if defined(CONFIG_NFS_V4_1) 332a7b72103SAndy Adamson struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp); 333b4b82607SAndy Adamson struct rpc_cred *nfs4_get_exchange_id_cred(struct nfs_client *clp); 33405f4c350SChuck Lever int nfs41_discover_server_trunking(struct nfs_client *clp, 33505f4c350SChuck Lever struct nfs_client **, struct rpc_cred *); 3369f594791STrond Myklebust extern void nfs4_schedule_session_recovery(struct nfs4_session *, int); 337ac074835STrond Myklebust extern void nfs41_server_notify_target_slotid_update(struct nfs_client *clp); 3380400a6b0STrond Myklebust #else 3399f594791STrond Myklebust static inline void nfs4_schedule_session_recovery(struct nfs4_session *session, int err) 3400400a6b0STrond Myklebust { 3410400a6b0STrond Myklebust } 342a7b72103SAndy Adamson #endif /* CONFIG_NFS_V4_1 */ 3434ce79717STrond Myklebust 344d1e284d5STrond Myklebust extern struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *, gfp_t); 3454ce79717STrond Myklebust extern void nfs4_put_state_owner(struct nfs4_state_owner *); 3460aaaf5c4SChuck Lever extern void nfs4_purge_state_owners(struct nfs_server *); 3474ce79717STrond Myklebust extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); 3484ce79717STrond Myklebust extern void nfs4_put_open_state(struct nfs4_state *); 349643168c2SAl Viro extern void nfs4_close_state(struct nfs4_state *, fmode_t); 350643168c2SAl Viro extern void nfs4_close_sync(struct nfs4_state *, fmode_t); 351dc0b027dSTrond Myklebust extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); 352a1d0b5eeSTrond Myklebust extern void nfs_inode_find_state_and_recover(struct inode *inode, 353a1d0b5eeSTrond Myklebust const nfs4_stateid *stateid); 3540400a6b0STrond Myklebust extern void nfs4_schedule_lease_recovery(struct nfs_client *); 355b0d3ded1STrond Myklebust extern void nfs4_schedule_state_manager(struct nfs_client *); 356042b60beSTrond Myklebust extern void nfs4_schedule_path_down_recovery(struct nfs_client *clp); 3570400a6b0STrond Myklebust extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs4_state *); 3580629e370SAlexandros Batsakis extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags); 35978fe0f41SWeston Andros Adamson extern void nfs41_handle_server_scope(struct nfs_client *, 36079d4e1f0SChuck Lever struct nfs41_server_scope **); 361faf5f49cSTrond Myklebust extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); 3628d0a8a9dSTrond Myklebust extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl); 3634fc8796dSTrond Myklebust extern void nfs4_select_rw_stateid(nfs4_stateid *, struct nfs4_state *, 3642a369153STrond Myklebust fmode_t, const struct nfs_lockowner *); 3654ce79717STrond Myklebust 3668535b2beSTrond Myklebust extern struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter, gfp_t gfp_mask); 367cee54fc9STrond Myklebust extern int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task); 368cee54fc9STrond Myklebust extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid); 369cee54fc9STrond Myklebust extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid); 37072211dbeSTrond Myklebust extern void nfs_release_seqid(struct nfs_seqid *seqid); 371cee54fc9STrond Myklebust extern void nfs_free_seqid(struct nfs_seqid *seqid); 372cee54fc9STrond Myklebust 3735ae67c4fSTrond Myklebust extern void nfs4_free_lock_state(struct nfs_server *server, struct nfs4_lock_state *lsp); 374cf470c3eSTrond Myklebust 3754ce79717STrond Myklebust extern const nfs4_stateid zero_stateid; 3764ce79717STrond Myklebust 377129d1977SBryan Schumaker /* nfs4super.c */ 378fbdefd64SBryan Schumaker struct nfs_mount_info; 379ab7017a3SBryan Schumaker extern struct nfs_subversion nfs_v4; 380ff9099f2SBryan Schumaker struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *); 381fac1e8e4SBryan Schumaker extern bool nfs4_disable_idmapping; 382fac1e8e4SBryan Schumaker extern unsigned short max_session_slots; 383fac1e8e4SBryan Schumaker extern unsigned short send_implementation_id; 38489d77c8fSBryan Schumaker 3856f2ea7f2SChuck Lever #define NFS4_CLIENT_ID_UNIQ_LEN (64) 3866f2ea7f2SChuck Lever extern char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN]; 3876f2ea7f2SChuck Lever 388466bfe7fSBryan Schumaker /* nfs4sysctl.c */ 389466bfe7fSBryan Schumaker #ifdef CONFIG_SYSCTL 390466bfe7fSBryan Schumaker int nfs4_register_sysctl(void); 391466bfe7fSBryan Schumaker void nfs4_unregister_sysctl(void); 392466bfe7fSBryan Schumaker #else 393466bfe7fSBryan Schumaker static inline int nfs4_register_sysctl(void) 394466bfe7fSBryan Schumaker { 395466bfe7fSBryan Schumaker return 0; 396466bfe7fSBryan Schumaker } 397466bfe7fSBryan Schumaker 3980add3e85SRandy Dunlap static inline void nfs4_unregister_sysctl(void) 399466bfe7fSBryan Schumaker { 400466bfe7fSBryan Schumaker } 401466bfe7fSBryan Schumaker #endif 402466bfe7fSBryan Schumaker 4034ce79717STrond Myklebust /* nfs4xdr.c */ 4044ce79717STrond Myklebust extern struct rpc_procinfo nfs4_procedures[]; 4054ce79717STrond Myklebust 4064ce79717STrond Myklebust struct nfs4_mount_data; 4074ce79717STrond Myklebust 4084ce79717STrond Myklebust /* callback_xdr.c */ 4094ce79717STrond Myklebust extern struct svc_version nfs4_callback_version1; 41007bccc2dSAlexandros Batsakis extern struct svc_version nfs4_callback_version4; 4114ce79717STrond Myklebust 412f597c537STrond Myklebust static inline void nfs4_stateid_copy(nfs4_stateid *dst, const nfs4_stateid *src) 413f597c537STrond Myklebust { 4142d2f24adSTrond Myklebust memcpy(dst, src, sizeof(*dst)); 415f597c537STrond Myklebust } 416f597c537STrond Myklebust 417f597c537STrond Myklebust static inline bool nfs4_stateid_match(const nfs4_stateid *dst, const nfs4_stateid *src) 418f597c537STrond Myklebust { 4192d2f24adSTrond Myklebust return memcmp(dst, src, sizeof(*dst)) == 0; 420f597c537STrond Myklebust } 421f597c537STrond Myklebust 4224ce79717STrond Myklebust #else 4234ce79717STrond Myklebust 424643168c2SAl Viro #define nfs4_close_state(a, b) do { } while (0) 425643168c2SAl Viro #define nfs4_close_sync(a, b) do { } while (0) 4264ce79717STrond Myklebust 4274ce79717STrond Myklebust #endif /* CONFIG_NFS_V4 */ 4284ce79717STrond Myklebust #endif /* __LINUX_FS_NFS_NFS4_FS.H */ 429