fs/ocfs2/dlm/dlmunlock.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/dlm/dlmunlock.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/dlm/dlmunlock.c- Extension
.c- Size
- 19181 bytes
- Lines
- 696
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/fs.hlinux/types.hlinux/highmem.hlinux/init.hlinux/sysctl.hlinux/random.hlinux/blkdev.hlinux/socket.hlinux/inet.hlinux/spinlock.hlinux/delay.h../cluster/heartbeat.h../cluster/nodemanager.h../cluster/tcp.hdlmapi.hdlmcommon.h../cluster/masklog.h
Detected Declarations
function convertfunction dlm_commit_pending_unlockfunction dlm_commit_pending_cancelfunction dlmunlock_masterfunction dlmunlock_remotefunction dlm_send_remote_unlock_requestfunction dlm_unlock_lock_handlerfunction list_for_each_entryfunction dlm_get_cancel_actionsfunction dlm_get_unlock_actionsfunction sinceexport dlmunlock
Annotated Snippet
if (master_node && !(flags & LKM_CANCEL)) {
mlog(ML_ERROR, "lockres in progress!\n");
spin_unlock(&res->spinlock);
return DLM_FORWARD;
}
/* ok for this to sleep if not in a network handler */
__dlm_wait_on_lockres(res);
res->state |= DLM_LOCK_RES_IN_PROGRESS;
}
spin_lock(&lock->spinlock);
if (res->state & DLM_LOCK_RES_RECOVERING) {
status = DLM_RECOVERING;
goto leave;
}
if (res->state & DLM_LOCK_RES_MIGRATING) {
status = DLM_MIGRATING;
goto leave;
}
/* see above for what the spec says about
* LKM_CANCEL and the lock queue state */
if (flags & LKM_CANCEL)
status = dlm_get_cancel_actions(dlm, res, lock, lksb, &actions);
else
status = dlm_get_unlock_actions(dlm, res, lock, lksb, &actions);
if (status != DLM_NORMAL && (status != DLM_CANCELGRANT || !master_node))
goto leave;
/* By now this has been masked out of cancel requests. */
if (flags & LKM_VALBLK) {
/* make the final update to the lvb */
if (master_node)
memcpy(res->lvb, lksb->lvb, DLM_LVB_LEN);
else
flags |= LKM_PUT_LVB; /* let the send function
* handle it. */
}
if (!master_node) {
owner = res->owner;
/* drop locks and send message */
if (flags & LKM_CANCEL)
lock->cancel_pending = 1;
else
lock->unlock_pending = 1;
spin_unlock(&lock->spinlock);
spin_unlock(&res->spinlock);
status = dlm_send_remote_unlock_request(dlm, res, lock, lksb,
flags, owner);
spin_lock(&res->spinlock);
spin_lock(&lock->spinlock);
/* if the master told us the lock was already granted,
* let the ast handle all of these actions */
if (status == DLM_CANCELGRANT) {
actions &= ~(DLM_UNLOCK_REMOVE_LOCK|
DLM_UNLOCK_REGRANT_LOCK|
DLM_UNLOCK_CLEAR_CONVERT_TYPE);
} else if (status == DLM_RECOVERING ||
status == DLM_MIGRATING ||
status == DLM_FORWARD ||
status == DLM_NOLOCKMGR
) {
/* must clear the actions because this unlock
* is about to be retried. cannot free or do
* any list manipulation. */
mlog(0, "%s:%.*s: clearing actions, %s\n",
dlm->name, res->lockname.len,
res->lockname.name,
status==DLM_RECOVERING?"recovering":
(status==DLM_MIGRATING?"migrating":
(status == DLM_FORWARD ? "forward" :
"nolockmanager")));
actions = 0;
}
if (flags & LKM_CANCEL)
lock->cancel_pending = 0;
else {
if (!lock->unlock_pending)
recovery_wait = 1;
else
lock->unlock_pending = 0;
}
}
/* get an extra ref on lock. if we are just switching
* lists here, we dont want the lock to go away. */
dlm_lock_get(lock);
Annotation
- Immediate include surface: `linux/module.h`, `linux/fs.h`, `linux/types.h`, `linux/highmem.h`, `linux/init.h`, `linux/sysctl.h`, `linux/random.h`, `linux/blkdev.h`.
- Detected declarations: `function convert`, `function dlm_commit_pending_unlock`, `function dlm_commit_pending_cancel`, `function dlmunlock_master`, `function dlmunlock_remote`, `function dlm_send_remote_unlock_request`, `function dlm_unlock_lock_handler`, `function list_for_each_entry`, `function dlm_get_cancel_actions`, `function dlm_get_unlock_actions`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: integration 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.