fs/nfs/nfs4_fs.h
Source file repositories/reference/linux-study-clean/fs/nfs/nfs4_fs.h
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/nfs4_fs.h- Extension
.h- Size
- 24515 bytes
- Lines
- 683
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/seqlock.hlinux/filelock.h
Detected Declarations
struct idmapstruct nfs_seqid_counterstruct nfs4_minor_version_opsstruct nfs_seqid_counterstruct nfs_seqidstruct nfs4_state_ownerstruct nfs4_lock_statestruct nfs4_statestruct nfs4_exceptionstruct nfs4_state_recovery_opsstruct nfs4_opendatastruct nfs4_add_xprt_datastruct nfs4_sequence_slot_opsstruct nfs4_state_maintenance_opsstruct nfs4_mig_recovery_opsstruct nfs_netstruct nfs4_call_sync_datastruct nfs_mount_infostruct nfs4_mount_dataenum nfs4_client_statefunction nfs_confirm_seqidfunction is_ds_only_clientfunction is_ds_clientfunction _nfs4_state_protectfunction authflavorfunction nfs4_state_protect_writefunction nfs4_register_sysctlfunction nfs4_unregister_sysctlfunction nfs4_stateid_copyfunction nfs4_stateid_matchfunction nfs4_stateid_match_otherfunction nfs4_stateid_is_newerfunction nfs4_stateid_is_nextfunction nfs4_stateid_match_or_olderfunction nfs4_stateid_seqid_incfunction nfs4_valid_open_stateidfunction nfs4_state_match_open_stateid_otherfunction nfs4_xattr_cache_zap
Annotated Snippet
struct nfs4_minor_version_ops {
u32 minor_version;
unsigned init_caps;
int (*init_client)(struct nfs_client *);
void (*shutdown_client)(struct nfs_client *);
bool (*match_stateid)(const nfs4_stateid *,
const nfs4_stateid *);
int (*find_root_sec)(struct nfs_server *, struct nfs_fh *,
struct nfs_fattr *);
void (*free_lock_state)(struct nfs_server *,
struct nfs4_lock_state *);
int (*test_and_free_expired)(struct nfs_server *,
nfs4_stateid *, const struct cred *);
struct nfs_seqid *
(*alloc_seqid)(struct nfs_seqid_counter *, gfp_t);
void (*session_trunk)(struct rpc_clnt *clnt,
struct rpc_xprt *xprt, void *data);
const struct rpc_call_ops *call_sync_ops;
const struct nfs4_sequence_slot_ops *sequence_slot_ops;
const struct nfs4_state_recovery_ops *reboot_recovery_ops;
const struct nfs4_state_recovery_ops *nograce_recovery_ops;
const struct nfs4_state_maintenance_ops *state_renewal_ops;
const struct nfs4_mig_recovery_ops *mig_recovery_ops;
};
#define NFS_SEQID_CONFIRMED 1
struct nfs_seqid_counter {
ktime_t create_time;
u64 owner_id;
int flags;
u32 counter;
spinlock_t lock; /* Protects the list */
struct list_head list; /* Defines sequence of RPC calls */
struct rpc_wait_queue wait; /* RPC call delay queue */
};
struct nfs_seqid {
struct nfs_seqid_counter *sequence;
struct list_head list;
struct rpc_task *task;
};
static inline void nfs_confirm_seqid(struct nfs_seqid_counter *seqid, int status)
{
if (seqid_mutating_err(-status))
seqid->flags |= NFS_SEQID_CONFIRMED;
}
/*
* NFS4 state_owners and lock_owners are simply labels for ordered
* sequences of RPC calls. Their sole purpose is to provide once-only
* semantics by allowing the server to identify replayed requests.
*/
struct nfs4_state_owner {
struct nfs_server *so_server;
struct list_head so_lru;
unsigned long so_expires;
struct rb_node so_server_node;
const struct cred *so_cred; /* Associated cred */
spinlock_t so_lock;
atomic_t so_count;
unsigned long so_flags;
struct list_head so_states;
struct nfs_seqid_counter so_seqid;
struct mutex so_delegreturn_mutex;
};
enum {
NFS_OWNER_RECLAIM_REBOOT,
NFS_OWNER_RECLAIM_NOGRACE
};
#define NFS_LOCK_NEW 0
#define NFS_LOCK_RECLAIM 1
#define NFS_LOCK_EXPIRED 2
/*
* struct nfs4_state maintains the client-side state for a given
* (state_owner,inode) tuple (OPEN) or state_owner (LOCK).
*
* OPEN:
* In order to know when to OPEN_DOWNGRADE or CLOSE the state on the server,
* we need to know how many files are open for reading or writing on a
* given inode. This information too is stored here.
*
* LOCK: one nfs4_state (LOCK) to hold the lock stateid nfs4_state(OPEN)
*/
Annotation
- Immediate include surface: `linux/seqlock.h`, `linux/filelock.h`.
- Detected declarations: `struct idmap`, `struct nfs_seqid_counter`, `struct nfs4_minor_version_ops`, `struct nfs_seqid_counter`, `struct nfs_seqid`, `struct nfs4_state_owner`, `struct nfs4_lock_state`, `struct nfs4_state`, `struct nfs4_exception`, `struct nfs4_state_recovery_ops`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.