fs/smb/server/oplock.h
Source file repositories/reference/linux-study-clean/fs/smb/server/oplock.h
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/server/oplock.h- Extension
.h- Size
- 4027 bytes
- Lines
- 132
- 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
smb_common.h
Detected Declarations
struct lease_ctx_infostruct lease_tablestruct leasestruct oplock_infostruct lease_break_infostruct oplock_break_info
Annotated Snippet
struct lease_ctx_info {
__u8 lease_key[SMB2_LEASE_KEY_SIZE];
__le32 req_state;
__le32 flags;
__le64 duration;
__u8 parent_lease_key[SMB2_LEASE_KEY_SIZE];
__le16 epoch;
int version;
bool is_dir;
};
struct lease_table {
char client_guid[SMB2_CLIENT_GUID_SIZE];
struct list_head lease_list;
struct list_head l_entry;
spinlock_t lb_lock;
};
struct lease {
__u8 lease_key[SMB2_LEASE_KEY_SIZE];
__le32 state;
__le32 new_state;
__le32 flags;
__le64 duration;
__u8 parent_lease_key[SMB2_LEASE_KEY_SIZE];
int version;
unsigned short epoch;
bool is_dir;
struct lease_table *l_lb;
};
struct oplock_info {
struct ksmbd_conn *conn;
struct ksmbd_session *sess;
struct ksmbd_work *work;
struct ksmbd_file *o_fp;
int level;
int op_state;
unsigned long pending_break;
u64 fid;
atomic_t breaking_cnt;
atomic_t refcount;
__u16 Tid;
bool is_lease;
bool open_trunc; /* truncate on open */
struct lease *o_lease;
struct list_head op_entry;
struct list_head lease_entry;
wait_queue_head_t oplock_q; /* Other server threads */
wait_queue_head_t oplock_brk; /* oplock breaking wait */
struct rcu_head rcu;
};
struct lease_break_info {
__le32 curr_state;
__le32 new_state;
__le16 epoch;
char lease_key[SMB2_LEASE_KEY_SIZE];
};
struct oplock_break_info {
int level;
int open_trunc;
int fid;
};
int smb_grant_oplock(struct ksmbd_work *work, int req_op_level,
u64 pid, struct ksmbd_file *fp, __u16 tid,
struct lease_ctx_info *lctx, int share_ret);
void smb_break_all_levII_oplock(struct ksmbd_work *work,
struct ksmbd_file *fp, int is_trunc);
int opinfo_write_to_read(struct oplock_info *opinfo);
int opinfo_read_handle_to_read(struct oplock_info *opinfo);
int opinfo_write_to_none(struct oplock_info *opinfo);
int opinfo_read_to_none(struct oplock_info *opinfo);
void close_id_del_oplock(struct ksmbd_file *fp);
void smb_break_all_oplock(struct ksmbd_work *work, struct ksmbd_file *fp);
struct oplock_info *opinfo_get(struct ksmbd_file *fp);
void opinfo_put(struct oplock_info *opinfo);
/* Lease related functions */
void create_lease_buf(u8 *rbuf, struct lease *lease);
struct lease_ctx_info *parse_lease_state(void *open_req);
__u8 smb2_map_lease_to_oplock(__le32 lease_state);
int lease_read_to_write(struct oplock_info *opinfo);
/* Durable related functions */
void create_durable_rsp_buf(char *cc);
void create_durable_v2_rsp_buf(char *cc, struct ksmbd_file *fp);
void create_mxac_rsp_buf(char *cc, int maximal_access);
Annotation
- Immediate include surface: `smb_common.h`.
- Detected declarations: `struct lease_ctx_info`, `struct lease_table`, `struct lease`, `struct oplock_info`, `struct lease_break_info`, `struct oplock_break_info`.
- 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.