fs/afs/fs_probe.c
Source file repositories/reference/linux-study-clean/fs/afs/fs_probe.c
File Facts
- System
- Linux kernel
- Corpus path
fs/afs/fs_probe.c- Extension
.c- Size
- 14530 bytes
- Lines
- 540
- 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/sched.hlinux/slab.hafs_fs.hinternal.hprotocol_afs.hprotocol_yfs.h
Detected Declarations
function afs_endpoint_state_rcufunction afs_put_endpoint_statefunction afs_schedule_fs_probefunction afs_finished_fs_probefunction afs_done_one_fs_probefunction afs_fs_probe_not_donefunction afs_fileserver_probe_resultfunction afs_fs_probe_fileserverfunction afs_wait_for_fs_probesfunction afs_fs_probe_timerfunction afs_dispatch_fs_probefunction afs_probe_fileserverfunction afs_fs_probe_dispatcherfunction afs_wait_for_one_fs_probefunction afs_fs_probe_cleanup
Annotated Snippet
if (!test_bit(AFS_ESTATE_RESPONDED, &estate->flags)) {
estate->abort_code = call->abort_code;
estate->error = ret;
}
goto responded;
case -ENOMEM:
case -ENONET:
clear_bit(index, &estate->responsive_set);
set_bit(AFS_ESTATE_LOCAL_FAILURE, &estate->flags);
trace_afs_io_error(call->debug_id, ret, afs_io_error_fs_probe_fail);
goto out;
case -ECONNRESET: /* Responded, but call expired. */
case -ERFKILL:
case -EADDRNOTAVAIL:
case -ENETUNREACH:
case -EHOSTUNREACH:
case -EHOSTDOWN:
case -ECONNREFUSED:
case -ETIMEDOUT:
case -ETIME:
default:
clear_bit(index, &estate->responsive_set);
set_bit(index, &estate->failed_set);
if (!test_bit(AFS_ESTATE_RESPONDED, &estate->flags) &&
(estate->error == 0 ||
estate->error == -ETIMEDOUT ||
estate->error == -ETIME))
estate->error = ret;
trace_afs_io_error(call->debug_id, ret, afs_io_error_fs_probe_fail);
goto out;
}
responded:
clear_bit(index, &estate->failed_set);
if (call->service_id == YFS_FS_SERVICE) {
set_bit(AFS_ESTATE_IS_YFS, &estate->flags);
set_bit(AFS_SERVER_FL_IS_YFS, &server->flags);
server->service_id = call->service_id;
} else {
set_bit(AFS_ESTATE_NOT_YFS, &estate->flags);
if (!test_bit(AFS_ESTATE_IS_YFS, &estate->flags)) {
clear_bit(AFS_SERVER_FL_IS_YFS, &server->flags);
server->service_id = call->service_id;
}
cap0 = ntohl(call->tmp);
if (cap0 & AFS3_VICED_CAPABILITY_64BITFILES)
set_bit(AFS_SERVER_FL_HAS_FS64, &server->flags);
else
clear_bit(AFS_SERVER_FL_HAS_FS64, &server->flags);
}
rtt_us = rxrpc_kernel_get_srtt(addr->peer);
if (rtt_us < estate->rtt) {
estate->rtt = rtt_us;
server->rtt = rtt_us;
alist->preferred = index;
}
smp_wmb(); /* Set rtt before responded. */
set_bit(AFS_ESTATE_RESPONDED, &estate->flags);
set_bit(index, &estate->responsive_set);
set_bit(AFS_SERVER_FL_RESPONDING, &server->flags);
out:
spin_unlock(&server->probe_lock);
trace_afs_fs_probe(server, false, estate, index, call->error, call->abort_code, rtt_us);
_debug("probe[%x] %pU [%u] %pISpc rtt=%d ret=%d",
estate->probe_seq, &server->uuid, index,
rxrpc_kernel_remote_addr(alist->addrs[index].peer),
rtt_us, ret);
return afs_done_one_fs_probe(call->net, server, estate);
}
/*
* Probe all of a fileserver's addresses to find out the best route and to
* query its capabilities.
*/
int afs_fs_probe_fileserver(struct afs_net *net, struct afs_server *server,
struct afs_addr_list *new_alist, struct key *key)
{
struct afs_endpoint_state *estate, *old;
struct afs_addr_list *old_alist = NULL, *alist;
unsigned long unprobed;
_enter("%pU", &server->uuid);
estate = kzalloc_obj(*estate);
if (!estate)
Annotation
- Immediate include surface: `linux/sched.h`, `linux/slab.h`, `afs_fs.h`, `internal.h`, `protocol_afs.h`, `protocol_yfs.h`.
- Detected declarations: `function afs_endpoint_state_rcu`, `function afs_put_endpoint_state`, `function afs_schedule_fs_probe`, `function afs_finished_fs_probe`, `function afs_done_one_fs_probe`, `function afs_fs_probe_not_done`, `function afs_fileserver_probe_result`, `function afs_fs_probe_fileserver`, `function afs_wait_for_fs_probes`, `function afs_fs_probe_timer`.
- 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.