drivers/target/iscsi/iscsi_target_erl2.c
Source file repositories/reference/linux-study-clean/drivers/target/iscsi/iscsi_target_erl2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/target/iscsi/iscsi_target_erl2.c- Extension
.c- Size
- 10804 bytes
- Lines
- 382
- Domain
- Driver Families
- Bucket
- drivers/target
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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/slab.hscsi/iscsi_proto.htarget/target_core_base.htarget/target_core_fabric.htarget/iscsi/iscsi_target_core.hiscsi_target_datain_values.hiscsi_target_util.hiscsi_target_erl0.hiscsi_target_erl1.hiscsi_target_erl2.hiscsi_target.h
Detected Declarations
function iscsit_attach_active_connection_recovery_entryfunction iscsit_attach_inactive_connection_recovery_entryfunction iscsit_free_connection_recovery_entriesfunction list_for_each_entry_safefunction list_for_each_entry_safefunction iscsit_remove_active_connection_recovery_entryfunction iscsit_remove_inactive_connection_recovery_entryfunction iscsit_remove_cmd_from_connection_recoveryfunction iscsit_discard_cr_cmds_by_expstatsnfunction iscsit_discard_unacknowledged_ooo_cmdsns_for_connfunction iscsit_prepare_cmds_for_reallegiancefunction iscsit_connection_recovery_transport_reset
Annotated Snippet
if (cr->cid == cid) {
spin_unlock(&sess->cr_i_lock);
return cr;
}
}
spin_unlock(&sess->cr_i_lock);
return NULL;
}
void iscsit_free_connection_recovery_entries(struct iscsit_session *sess)
{
struct iscsit_cmd *cmd, *cmd_tmp;
struct iscsi_conn_recovery *cr, *cr_tmp;
spin_lock(&sess->cr_a_lock);
list_for_each_entry_safe(cr, cr_tmp, &sess->cr_active_list, cr_list) {
list_del(&cr->cr_list);
spin_unlock(&sess->cr_a_lock);
spin_lock(&cr->conn_recovery_cmd_lock);
list_for_each_entry_safe(cmd, cmd_tmp,
&cr->conn_recovery_cmd_list, i_conn_node) {
list_del_init(&cmd->i_conn_node);
cmd->conn = NULL;
spin_unlock(&cr->conn_recovery_cmd_lock);
iscsit_free_cmd(cmd, true);
spin_lock(&cr->conn_recovery_cmd_lock);
}
spin_unlock(&cr->conn_recovery_cmd_lock);
spin_lock(&sess->cr_a_lock);
kfree(cr);
}
spin_unlock(&sess->cr_a_lock);
spin_lock(&sess->cr_i_lock);
list_for_each_entry_safe(cr, cr_tmp, &sess->cr_inactive_list, cr_list) {
list_del(&cr->cr_list);
spin_unlock(&sess->cr_i_lock);
spin_lock(&cr->conn_recovery_cmd_lock);
list_for_each_entry_safe(cmd, cmd_tmp,
&cr->conn_recovery_cmd_list, i_conn_node) {
list_del_init(&cmd->i_conn_node);
cmd->conn = NULL;
spin_unlock(&cr->conn_recovery_cmd_lock);
iscsit_free_cmd(cmd, true);
spin_lock(&cr->conn_recovery_cmd_lock);
}
spin_unlock(&cr->conn_recovery_cmd_lock);
spin_lock(&sess->cr_i_lock);
kfree(cr);
}
spin_unlock(&sess->cr_i_lock);
}
int iscsit_remove_active_connection_recovery_entry(
struct iscsi_conn_recovery *cr,
struct iscsit_session *sess)
{
spin_lock(&sess->cr_a_lock);
list_del(&cr->cr_list);
sess->conn_recovery_count--;
pr_debug("Decremented connection recovery count to %u for"
" SID: %u\n", sess->conn_recovery_count, sess->sid);
spin_unlock(&sess->cr_a_lock);
kfree(cr);
return 0;
}
static void iscsit_remove_inactive_connection_recovery_entry(
struct iscsi_conn_recovery *cr,
struct iscsit_session *sess)
{
spin_lock(&sess->cr_i_lock);
list_del(&cr->cr_list);
spin_unlock(&sess->cr_i_lock);
}
/*
* Called with cr->conn_recovery_cmd_lock help.
*/
int iscsit_remove_cmd_from_connection_recovery(
Annotation
- Immediate include surface: `linux/slab.h`, `scsi/iscsi_proto.h`, `target/target_core_base.h`, `target/target_core_fabric.h`, `target/iscsi/iscsi_target_core.h`, `iscsi_target_datain_values.h`, `iscsi_target_util.h`, `iscsi_target_erl0.h`.
- Detected declarations: `function iscsit_attach_active_connection_recovery_entry`, `function iscsit_attach_inactive_connection_recovery_entry`, `function iscsit_free_connection_recovery_entries`, `function list_for_each_entry_safe`, `function list_for_each_entry_safe`, `function iscsit_remove_active_connection_recovery_entry`, `function iscsit_remove_inactive_connection_recovery_entry`, `function iscsit_remove_cmd_from_connection_recovery`, `function iscsit_discard_cr_cmds_by_expstatsn`, `function iscsit_discard_unacknowledged_ooo_cmdsns_for_conn`.
- Atlas domain: Driver Families / drivers/target.
- 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.