fs/dlm/recover.c
Source file repositories/reference/linux-study-clean/fs/dlm/recover.c
File Facts
- System
- Linux kernel
- Corpus path
fs/dlm/recover.c- Extension
.c- Size
- 23071 bytes
- Lines
- 918
- 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
dlm_internal.hlockspace.hdir.hconfig.hast.hmemory.hrcom.hlock.hlowcomms.hmember.hrecover.h
Detected Declarations
function Copyrightfunction statusfunction _set_recover_statusfunction dlm_set_recover_statusfunction wait_status_allfunction list_for_each_entryfunction wait_status_lowfunction wait_statusfunction dlm_recover_members_waitfunction list_for_each_entryfunction dlm_recover_directory_waitfunction dlm_recover_locks_waitfunction dlm_recover_done_waitfunction recover_list_emptyfunction recover_list_addfunction recover_list_delfunction recover_list_clearfunction recover_xa_emptyfunction recover_xa_addfunction recover_xa_delfunction recover_xa_clearfunction xa_for_eachfunction set_lock_masterfunction list_for_each_entryfunction set_master_lkbsfunction dlm_recover_locksfunction dlm_master_lookupfunction recover_master_staticfunction dlm_recover_mastersfunction list_for_each_entryfunction dlm_recover_master_replyfunction recover_locks_queuefunction list_for_each_entryfunction recover_locksfunction dlm_recover_locksfunction list_for_each_entryfunction dlm_recovered_lockfunction nodefunction list_for_each_entryfunction list_for_each_entryfunction recover_conversionfunction list_for_each_entryfunction list_for_each_entryfunction dlm_recover_grantfunction dlm_recover_rsbsfunction list_for_each_entryfunction dlm_clear_inactive
Annotated Snippet
if (test_bit(LSFL_RCOM_WAIT, &ls->ls_flags)) {
log_debug(ls, "dlm_wait_function timed out");
return -ETIMEDOUT;
}
}
if (dlm_recovery_stopped(ls)) {
log_debug(ls, "dlm_wait_function aborted");
error = -EINTR;
}
return error;
}
/*
* An efficient way for all nodes to wait for all others to have a certain
* status. The node with the lowest nodeid polls all the others for their
* status (wait_status_all) and all the others poll the node with the low id
* for its accumulated result (wait_status_low). When all nodes have set
* status flag X, then status flag X_ALL will be set on the low nodeid.
*/
uint32_t dlm_recover_status(struct dlm_ls *ls)
{
uint32_t status;
spin_lock_bh(&ls->ls_recover_lock);
status = ls->ls_recover_status;
spin_unlock_bh(&ls->ls_recover_lock);
return status;
}
static void _set_recover_status(struct dlm_ls *ls, uint32_t status)
{
ls->ls_recover_status |= status;
}
void dlm_set_recover_status(struct dlm_ls *ls, uint32_t status)
{
spin_lock_bh(&ls->ls_recover_lock);
_set_recover_status(ls, status);
spin_unlock_bh(&ls->ls_recover_lock);
}
static int wait_status_all(struct dlm_ls *ls, uint32_t wait_status,
int save_slots, uint64_t seq)
{
struct dlm_rcom *rc = ls->ls_recover_buf;
struct dlm_member *memb;
int error = 0, delay;
list_for_each_entry(memb, &ls->ls_nodes, list) {
delay = 0;
for (;;) {
if (dlm_recovery_stopped(ls)) {
error = -EINTR;
goto out;
}
error = dlm_rcom_status(ls, memb->nodeid, 0, seq);
if (error)
goto out;
if (save_slots)
dlm_slot_save(ls, rc, memb);
if (le32_to_cpu(rc->rc_result) & wait_status)
break;
if (delay < 1000)
delay += 20;
msleep(delay);
}
}
out:
return error;
}
static int wait_status_low(struct dlm_ls *ls, uint32_t wait_status,
uint32_t status_flags, uint64_t seq)
{
struct dlm_rcom *rc = ls->ls_recover_buf;
int error = 0, delay = 0, nodeid = ls->ls_low_nodeid;
for (;;) {
if (dlm_recovery_stopped(ls)) {
error = -EINTR;
goto out;
}
error = dlm_rcom_status(ls, nodeid, status_flags, seq);
if (error)
break;
Annotation
- Immediate include surface: `dlm_internal.h`, `lockspace.h`, `dir.h`, `config.h`, `ast.h`, `memory.h`, `rcom.h`, `lock.h`.
- Detected declarations: `function Copyright`, `function status`, `function _set_recover_status`, `function dlm_set_recover_status`, `function wait_status_all`, `function list_for_each_entry`, `function wait_status_low`, `function wait_status`, `function dlm_recover_members_wait`, `function list_for_each_entry`.
- 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.