Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * linux/fs/nfs/delegation.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (c) Trond Myklebust
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Definitions pertaining to NFS delegated files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #ifndef FS_NFS_DELEGATION_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define FS_NFS_DELEGATION_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #if IS_ENABLED(CONFIG_NFS_V4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * NFSv4 delegation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct nfs_delegation {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	struct list_head super_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	const struct cred *cred;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	struct inode *inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	nfs4_stateid stateid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	fmode_t type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	unsigned long pagemod_limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	__u64 change_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	refcount_t refcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	NFS_DELEGATION_NEED_RECLAIM = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	NFS_DELEGATION_RETURN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	NFS_DELEGATION_RETURN_IF_CLOSED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	NFS_DELEGATION_REFERENCED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	NFS_DELEGATION_RETURNING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	NFS_DELEGATION_REVOKED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	NFS_DELEGATION_TEST_EXPIRED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	NFS_DELEGATION_INODE_FREEING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	NFS_DELEGATION_RETURN_DELAYED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) int nfs_inode_set_delegation(struct inode *inode, const struct cred *cred,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 		fmode_t type, const nfs4_stateid *stateid, unsigned long pagemod_limit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void nfs_inode_reclaim_delegation(struct inode *inode, const struct cred *cred,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 		fmode_t type, const nfs4_stateid *stateid, unsigned long pagemod_limit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int nfs4_inode_return_delegation(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void nfs4_inode_return_delegation_on_close(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *stateid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void nfs_inode_evict_delegation(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs_fh *fhandle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) void nfs_server_return_all_delegations(struct nfs_server *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void nfs_expire_all_delegations(struct nfs_client *clp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) void nfs_expire_unused_delegation_types(struct nfs_client *clp, fmode_t flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) void nfs_expire_unreferenced_delegations(struct nfs_client *clp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int nfs_client_return_marked_delegations(struct nfs_client *clp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int nfs_delegations_present(struct nfs_client *clp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) void nfs_remove_bad_delegation(struct inode *inode, const nfs4_stateid *stateid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) void nfs_delegation_mark_returned(struct inode *inode, const nfs4_stateid *stateid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) void nfs_delegation_mark_reclaim(struct nfs_client *clp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) void nfs_delegation_reap_unclaimed(struct nfs_client *clp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) void nfs_mark_test_expired_all_delegations(struct nfs_client *clp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) void nfs_test_expired_all_delegations(struct nfs_client *clp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) void nfs_reap_expired_delegations(struct nfs_client *clp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) /* NFSv4 delegation-related procedures */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) int nfs4_proc_delegreturn(struct inode *inode, const struct cred *cred, const nfs4_stateid *stateid, int issync);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, const nfs4_stateid *stateid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) bool nfs4_copy_delegation_stateid(struct inode *inode, fmode_t flags, nfs4_stateid *dst, const struct cred **cred);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) bool nfs4_refresh_delegation_stateid(nfs4_stateid *dst, struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct nfs_delegation *nfs4_get_valid_delegation(const struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) void nfs_mark_delegation_referenced(struct nfs_delegation *delegation);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) int nfs4_have_delegation(struct inode *inode, fmode_t flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) int nfs4_check_delegation(struct inode *inode, fmode_t flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) bool nfs4_delegation_flush_on_close(const struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) void nfs_inode_find_delegation_state_and_recover(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 		const nfs4_stateid *stateid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) int nfs4_inode_make_writeable(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) static inline int nfs_have_delegated_attributes(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 	return NFS_PROTO(inode)->have_delegation(inode, FMODE_READ) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 		!(NFS_I(inode)->cache_validity & NFS_INO_REVAL_FORCED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #endif