fs/ocfs2/dlm/dlmrecovery.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/dlm/dlmrecovery.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/dlm/dlmrecovery.c- Extension
.c- Size
- 88993 bytes
- Lines
- 2954
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/fs.hlinux/types.hlinux/slab.hlinux/highmem.hlinux/init.hlinux/sysctl.hlinux/random.hlinux/blkdev.hlinux/socket.hlinux/inet.hlinux/timer.hlinux/kthread.hlinux/delay.hlinux/string_choices.h../cluster/heartbeat.h../cluster/nodemanager.h../cluster/tcp.hdlmapi.hdlmcommon.hdlmdomain.h../cluster/masklog.h
Detected Declarations
function dlm_get_next_mig_cookiefunction dlm_set_reco_dead_nodefunction dlm_set_reco_masterfunction __dlm_reset_recoveryfunction dlm_dispatch_workfunction list_for_each_entryfunction list_for_each_entry_safefunction dlm_kick_recovery_threadfunction dlm_launch_recovery_threadfunction dlm_complete_recovery_threadfunction dlm_print_reco_node_statusfunction list_for_each_entryfunction dlm_recovery_threadfunction dlm_reco_master_readyfunction dlm_is_node_deadfunction dlm_is_node_recoveredfunction dlm_wait_for_node_deathfunction dlm_wait_for_node_recoveryfunction nodefunction dlm_wait_for_recoveryfunction dlm_begin_recoveryfunction dlm_end_recoveryfunction dlm_print_recovery_masterfunction dlm_do_recoveryfunction test_bitfunction dlm_remaster_locksfunction list_for_each_entryfunction dlm_init_recovery_areafunction dlm_destroy_recovery_areafunction list_for_each_entry_safefunction dlm_request_all_locksfunction dlm_request_all_locks_handlerfunction dlm_request_all_locks_workerfunction dlm_send_all_done_msgfunction dlm_reco_data_done_handlerfunction dlm_move_reco_locks_to_listfunction list_for_each_entryfunction dlm_num_locks_in_lockresfunction dlm_send_mig_lockres_msgfunction dlm_init_migratable_lockresfunction dlm_prepare_lvb_for_migrationfunction dlm_add_lock_to_arrayfunction dlm_add_dummy_lockfunction dlm_is_dummy_lockfunction dlm_send_one_lockresfunction list_for_each_entryfunction locksfunction dlm_mig_lockres_worker
Annotated Snippet
switch (ndata->state) {
case DLM_RECO_NODE_DATA_INIT:
st = "init";
break;
case DLM_RECO_NODE_DATA_REQUESTING:
st = "requesting";
break;
case DLM_RECO_NODE_DATA_DEAD:
st = "dead";
break;
case DLM_RECO_NODE_DATA_RECEIVING:
st = "receiving";
break;
case DLM_RECO_NODE_DATA_REQUESTED:
st = "requested";
break;
case DLM_RECO_NODE_DATA_DONE:
st = "done";
break;
case DLM_RECO_NODE_DATA_FINALIZE_SENT:
st = "finalize-sent";
break;
default:
st = "bad";
break;
}
mlog(ML_NOTICE, "%s: reco state, node %u, state=%s\n",
dlm->name, ndata->node_num, st);
}
list_for_each_entry(res, &dlm->reco.resources, recovering) {
mlog(ML_NOTICE, "%s: lockres %.*s on recovering list\n",
dlm->name, res->lockname.len, res->lockname.name);
}
}
#define DLM_RECO_THREAD_TIMEOUT_MS (5 * 1000)
static int dlm_recovery_thread(void *data)
{
int status;
struct dlm_ctxt *dlm = data;
unsigned long timeout = msecs_to_jiffies(DLM_RECO_THREAD_TIMEOUT_MS);
mlog(0, "dlm thread running for %s...\n", dlm->name);
while (!kthread_should_stop()) {
if (dlm_domain_fully_joined(dlm)) {
status = dlm_do_recovery(dlm);
if (status == -EAGAIN) {
/* do not sleep, recheck immediately. */
continue;
}
if (status < 0)
mlog_errno(status);
}
wait_event_interruptible_timeout(dlm->dlm_reco_thread_wq,
kthread_should_stop(),
timeout);
}
mlog(0, "quitting DLM recovery thread\n");
return 0;
}
/* returns true when the recovery master has contacted us */
static int dlm_reco_master_ready(struct dlm_ctxt *dlm)
{
int ready;
spin_lock(&dlm->spinlock);
ready = (dlm->reco.new_master != O2NM_INVALID_NODE_NUM);
spin_unlock(&dlm->spinlock);
return ready;
}
/* returns true if node is no longer in the domain
* could be dead or just not joined */
int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node)
{
int dead;
spin_lock(&dlm->spinlock);
dead = !test_bit(node, dlm->domain_map);
spin_unlock(&dlm->spinlock);
return dead;
}
/* returns true if node is no longer in the domain
* could be dead or just not joined */
static int dlm_is_node_recovered(struct dlm_ctxt *dlm, u8 node)
{
Annotation
- Immediate include surface: `linux/module.h`, `linux/fs.h`, `linux/types.h`, `linux/slab.h`, `linux/highmem.h`, `linux/init.h`, `linux/sysctl.h`, `linux/random.h`.
- Detected declarations: `function dlm_get_next_mig_cookie`, `function dlm_set_reco_dead_node`, `function dlm_set_reco_master`, `function __dlm_reset_recovery`, `function dlm_dispatch_work`, `function list_for_each_entry`, `function list_for_each_entry_safe`, `function dlm_kick_recovery_thread`, `function dlm_launch_recovery_thread`, `function dlm_complete_recovery_thread`.
- 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.