fs/smb/client/sess.c
Source file repositories/reference/linux-study-clean/fs/smb/client/sess.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/sess.c- Extension
.c- Size
- 28700 bytes
- Lines
- 1040
- 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
cifsglob.hcifsproto.hcifs_unicode.hcifs_debug.hntlmssp.hnterr.hlinux/utsname.hlinux/slab.hlinux/version.hcifsfs.hcifs_spnego.hsmb2proto.hfs_context.h
Detected Declarations
function is_ses_using_ifacefunction cifs_ses_get_chan_indexfunction cifs_chan_set_in_reconnectfunction cifs_chan_clear_in_reconnectfunction cifs_chan_set_need_reconnectfunction cifs_chan_clear_need_reconnectfunction cifs_chan_needs_reconnectfunction cifs_chan_is_iface_activefunction cifs_try_adding_channelsfunction list_for_each_entry_safe_fromfunction cifs_decrease_secondary_channelsfunction cifs_chan_update_ifacefunction cifs_ses_add_channelfunction decode_ntlmssp_challengefunction size_of_ntlmssp_blobfunction cifs_security_buffer_from_strfunction build_ntlmssp_negotiate_blobfunction build_ntlmssp_smb3_negotiate_blobfunction build_ntlmssp_auth_blobfunction cifs_select_sectype
Annotated Snippet
if (ses->chans[i].iface == iface) {
spin_unlock(&ses->chan_lock);
return true;
}
}
spin_unlock(&ses->chan_lock);
return false;
}
/* channel helper functions. assumed that chan_lock is held by caller. */
int
cifs_ses_get_chan_index(struct cifs_ses *ses,
struct TCP_Server_Info *server)
{
unsigned int i;
/* if the channel is waiting for termination */
if (server && server->terminate)
return CIFS_INVAL_CHAN_INDEX;
for (i = 0; i < ses->chan_count; i++) {
if (ses->chans[i].server == server)
return i;
}
/* If we didn't find the channel, it is likely a bug */
if (server)
cifs_dbg(VFS, "unable to get chan index for server: 0x%llx",
server->conn_id);
return CIFS_INVAL_CHAN_INDEX;
}
void
cifs_chan_set_in_reconnect(struct cifs_ses *ses,
struct TCP_Server_Info *server)
{
int chan_index = cifs_ses_get_chan_index(ses, server);
if (chan_index == CIFS_INVAL_CHAN_INDEX)
return;
ses->chans[chan_index].in_reconnect = true;
}
void
cifs_chan_clear_in_reconnect(struct cifs_ses *ses,
struct TCP_Server_Info *server)
{
unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
if (chan_index == CIFS_INVAL_CHAN_INDEX)
return;
ses->chans[chan_index].in_reconnect = false;
}
void
cifs_chan_set_need_reconnect(struct cifs_ses *ses,
struct TCP_Server_Info *server)
{
unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
if (chan_index == CIFS_INVAL_CHAN_INDEX)
return;
set_bit(chan_index, &ses->chans_need_reconnect);
cifs_dbg(FYI, "Set reconnect bitmask for chan %u; now 0x%lx\n",
chan_index, ses->chans_need_reconnect);
}
void
cifs_chan_clear_need_reconnect(struct cifs_ses *ses,
struct TCP_Server_Info *server)
{
unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
if (chan_index == CIFS_INVAL_CHAN_INDEX)
return;
clear_bit(chan_index, &ses->chans_need_reconnect);
cifs_dbg(FYI, "Cleared reconnect bitmask for chan %u; now 0x%lx\n",
chan_index, ses->chans_need_reconnect);
}
bool
cifs_chan_needs_reconnect(struct cifs_ses *ses,
struct TCP_Server_Info *server)
{
unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
Annotation
- Immediate include surface: `cifsglob.h`, `cifsproto.h`, `cifs_unicode.h`, `cifs_debug.h`, `ntlmssp.h`, `nterr.h`, `linux/utsname.h`, `linux/slab.h`.
- Detected declarations: `function is_ses_using_iface`, `function cifs_ses_get_chan_index`, `function cifs_chan_set_in_reconnect`, `function cifs_chan_clear_in_reconnect`, `function cifs_chan_set_need_reconnect`, `function cifs_chan_clear_need_reconnect`, `function cifs_chan_needs_reconnect`, `function cifs_chan_is_iface_active`, `function cifs_try_adding_channels`, `function list_for_each_entry_safe_from`.
- 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.