fs/afs/validation.c
Source file repositories/reference/linux-study-clean/fs/afs/validation.c
File Facts
- System
- Linux kernel
- Corpus path
fs/afs/validation.c- Extension
.c- Size
- 16066 bytes
- Lines
- 491
- 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
linux/kernel.hlinux/module.hlinux/sched.hinternal.h
Detected Declarations
function afs_check_validityfunction __afs_is_server_excludedfunction afs_is_server_excludedfunction afs_update_volume_creation_timefunction afs_update_volume_update_timefunction afs_update_volume_timesfunction afs_update_volume_statefunction afs_zap_datafunction afs_validatefunction atomic_read
Annotated Snippet
if (op->server == se->server) {
is_excluded = test_bit(AFS_SE_EXCLUDED, &se->flags);
break;
}
}
rcu_read_unlock();
return is_excluded;
}
/*
* Update the volume's server list when the creation time changes and see if
* the server we've just talked to is currently excluded.
*/
static int afs_is_server_excluded(struct afs_operation *op, struct afs_volume *volume)
{
int ret;
if (__afs_is_server_excluded(op, volume))
return 1;
set_bit(AFS_VOLUME_NEEDS_UPDATE, &volume->flags);
ret = afs_check_volume_status(op->volume, op);
if (ret < 0)
return ret;
return __afs_is_server_excluded(op, volume);
}
/*
* Handle a change to the volume creation time in the VolSync record.
*/
static int afs_update_volume_creation_time(struct afs_operation *op, struct afs_volume *volume)
{
unsigned int snap;
time64_t cur = volume->creation_time;
time64_t old = op->pre_volsync.creation;
time64_t new = op->volsync.creation;
int ret;
_enter("%llx,%llx,%llx->%llx", volume->vid, cur, old, new);
if (cur == TIME64_MIN) {
volume->creation_time = new;
return 0;
}
if (new == cur)
return 0;
/* Try to advance the creation timestamp from what we had before the
* operation to what we got back from the server. This should
* hopefully ensure that in a race between multiple operations only one
* of them will do this.
*/
if (cur != old)
return 0;
/* If the creation time changes in an unexpected way, we need to scrub
* our caches. For a RW vol, this will only change if the volume is
* restored from a backup; for a RO/Backup vol, this will advance when
* the volume is updated to a new snapshot (eg. "vos release").
*/
if (volume->type == AFSVL_RWVOL)
goto regressed;
if (volume->type == AFSVL_BACKVOL) {
if (new < old)
goto regressed;
goto advance;
}
/* We have an RO volume, we need to query the VL server and look at the
* server flags to see if RW->RO replication is in progress.
*/
ret = afs_is_server_excluded(op, volume);
if (ret < 0)
return ret;
if (ret > 0) {
snap = atomic_read(&volume->cb_ro_snapshot);
trace_afs_cb_v_break(volume->vid, snap, afs_cb_break_volume_excluded);
return ret;
}
advance:
snap = atomic_inc_return(&volume->cb_ro_snapshot);
trace_afs_cb_v_break(volume->vid, snap, afs_cb_break_for_vos_release);
volume->creation_time = new;
return 0;
regressed:
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/sched.h`, `internal.h`.
- Detected declarations: `function afs_check_validity`, `function __afs_is_server_excluded`, `function afs_is_server_excluded`, `function afs_update_volume_creation_time`, `function afs_update_volume_update_time`, `function afs_update_volume_times`, `function afs_update_volume_state`, `function afs_zap_data`, `function afs_validate`, `function atomic_read`.
- 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.