NFSv3 Weak Cache Consistency (WCC) — stale cache detection
// Explanation of NFSv3's weak cache consistency paradigm
Overview
WCC is how NFSv3 handles the case where two clients are actively working the same file at the same time. Every time Client B sends an operation and gets a reply, the server bundles in Pre-Op attributes—a snapshot of what the file looked like right before the server executed Client B's request. If those Pre-Op attributes don't match what Client B has in its local cache, it knows Client A snuck in a write just before. Cache is immediately flagged stale. No polling, no timer—the detection is piggybacked on the next operation Client B would have sent anyway.
NFS Cache Coherence Mechanisms — Summary Matrix
| Protocol Mechanism | Responsibility | When is the change noticed? | Best Used For |
|---|---|---|---|
| Close-to-Open (CTO) | Client-driven | Exactly when a client executes a fresh open() system call. | Standard sequential file sharing. |
| Weak Cache Consistency | Server-driven (via replies) | During an active, concurrent operation (like mid-read). | Interleaved, parallel access. |
| NFSv4 Delegations | Server-initiated (via callbacks) | Proactively, before the other client's write is allowed to finish. | Highly cached, mostly-read environments. |