fs/ocfs2/dlmfs/userdlm.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/dlmfs/userdlm.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/dlmfs/userdlm.c- Extension
.c- Size
- 17627 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/signal.hlinux/sched/signal.hlinux/module.hlinux/fs.hlinux/types.hlinux/crc32.h../ocfs2_lockingver.h../stackglue.huserdlm.h../cluster/masklog.h
Detected Declarations
function Copyrightfunction user_check_wait_flagfunction user_wait_on_busy_lockfunction user_wait_on_blocked_lockfunction cluster_connection_from_user_lockresfunction user_dlm_inode_from_user_lockresfunction user_recover_from_dlm_errorfunction user_highest_compat_lock_levelfunction user_astfunction user_dlm_grab_inode_reffunction __user_dlm_queue_lockresfunction __user_dlm_cond_queue_lockresfunction user_bastfunction user_unlock_astfunction user_dlm_drop_inode_reffunction user_dlm_unblock_lockfunction user_dlm_inc_holdersfunction user_may_continue_on_blocked_lockfunction user_dlm_cluster_lockfunction user_dlm_dec_holdersfunction user_dlm_cluster_unlockfunction user_dlm_write_lvbfunction user_dlm_read_lvbfunction user_dlm_lock_res_initfunction user_dlm_destroy_lockfunction user_dlm_recovery_handler_noopfunction user_dlm_set_locking_protocolfunction user_dlm_unregister
Annotated Snippet
user_highest_compat_lock_level(lockres->l_blocking)) {
lockres->l_blocking = DLM_LOCK_NL;
lockres->l_flags &= ~USER_LOCK_BLOCKED;
}
}
lockres->l_level = lockres->l_requested;
lockres->l_requested = DLM_LOCK_IV;
lockres->l_flags |= USER_LOCK_ATTACHED;
lockres->l_flags &= ~USER_LOCK_BUSY;
spin_unlock(&lockres->l_lock);
wake_up(&lockres->l_event);
}
static inline void user_dlm_grab_inode_ref(struct user_lock_res *lockres)
{
struct inode *inode;
inode = user_dlm_inode_from_user_lockres(lockres);
if (!igrab(inode))
BUG();
}
static void user_dlm_unblock_lock(struct work_struct *work);
static void __user_dlm_queue_lockres(struct user_lock_res *lockres)
{
if (!(lockres->l_flags & USER_LOCK_QUEUED)) {
user_dlm_grab_inode_ref(lockres);
INIT_WORK(&lockres->l_work, user_dlm_unblock_lock);
queue_work(user_dlm_worker, &lockres->l_work);
lockres->l_flags |= USER_LOCK_QUEUED;
}
}
static void __user_dlm_cond_queue_lockres(struct user_lock_res *lockres)
{
int queue = 0;
if (!(lockres->l_flags & USER_LOCK_BLOCKED))
return;
switch (lockres->l_blocking) {
case DLM_LOCK_EX:
if (!lockres->l_ex_holders && !lockres->l_ro_holders)
queue = 1;
break;
case DLM_LOCK_PR:
if (!lockres->l_ex_holders)
queue = 1;
break;
default:
BUG();
}
if (queue)
__user_dlm_queue_lockres(lockres);
}
static void user_bast(struct ocfs2_dlm_lksb *lksb, int level)
{
struct user_lock_res *lockres = user_lksb_to_lock_res(lksb);
mlog(ML_BASTS, "BAST fired for lockres %.*s, blocking %d, level %d\n",
lockres->l_namelen, lockres->l_name, level, lockres->l_level);
spin_lock(&lockres->l_lock);
lockres->l_flags |= USER_LOCK_BLOCKED;
if (level > lockres->l_blocking)
lockres->l_blocking = level;
__user_dlm_queue_lockres(lockres);
spin_unlock(&lockres->l_lock);
wake_up(&lockres->l_event);
}
static void user_unlock_ast(struct ocfs2_dlm_lksb *lksb, int status)
{
struct user_lock_res *lockres = user_lksb_to_lock_res(lksb);
mlog(ML_BASTS, "UNLOCK AST fired for lockres %.*s, flags 0x%x\n",
lockres->l_namelen, lockres->l_name, lockres->l_flags);
if (status)
mlog(ML_ERROR, "dlm returns status %d\n", status);
Annotation
- Immediate include surface: `linux/signal.h`, `linux/sched/signal.h`, `linux/module.h`, `linux/fs.h`, `linux/types.h`, `linux/crc32.h`, `../ocfs2_lockingver.h`, `../stackglue.h`.
- Detected declarations: `function Copyright`, `function user_check_wait_flag`, `function user_wait_on_busy_lock`, `function user_wait_on_blocked_lock`, `function cluster_connection_from_user_lockres`, `function user_dlm_inode_from_user_lockres`, `function user_recover_from_dlm_error`, `function user_highest_compat_lock_level`, `function user_ast`, `function user_dlm_grab_inode_ref`.
- 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.