Skip to main content
RunBook Academy

CephXLII · CephFS OperationsCephFS Operations

CephFS client behaviour and consistency

Advanced⏱ ~18 minceph

What you'll learn

  • Describe the client caching model
  • Explain the consistency guarantees CephFS provides
  • Diagnose stale or inconsistent client views
  • Tune client caching for a workload

Prerequisites

None — start here.

Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18

Not yet marked complete on this device.

Why this matters in production

CephFS provides stronger consistency than NFS and people frequently assume otherwise, applying workarounds that are unnecessary and occasionally harmful. Knowing what is actually guaranteed lets applications rely on it.

The guarantee

CephFS provides close-to-open consistency and better: a file closed by one client is fully visible to another client opening it afterwards. In practice the capability mechanism provides more than that — when two clients access the same file concurrently, the MDS revokes the caching capabilities that would allow divergence, so both see coherent data.

This is materially stronger than NFS’s default behaviour, and it means applications generally do not need the flush-and-revalidate dances written for NFS.

Where caching happens

CacheHeld byInvalidated by
Dentry and inode cacheclient kernel or ceph-fusecapability revocation
File data cacheclient page cachecapability revocation
Buffered writesclientflush on capability recall or fsync

The MDS drives all of it: a client caches only what its capabilities permit, and the MDS revokes those capabilities when another client needs conflicting access.

When a client sees stale data

Genuinely stale views are rare and usually indicate a problem:

# what does the client hold?
ceph daemon mds.a session ls | jq -r '.[] | "\(.id) \(.num_caps) \(.client_metadata.hostname)"'

# is the MDS complaining about it?
ceph health detail | grep -i client
SymptomCause
One client sees old contentsits capability was not revoked — an MDS or client bug
Slow to see changesa client slow to respond to revocation
Stale file handlethe session was evicted or timed out
Files missing after creation elsewhereusually a different mount path or subtree

The last row is the most common by far: two clients mounting different subtrees and expecting to see each other’s files.

Tuning client cache

# Substitute your own monitor addresses before running:
MONS=192.0.2.11:6789,192.0.2.12:6789,192.0.2.13:6789

# client-side cache limits
ceph config set client client_cache_size 32768
ceph config set client client_oc_size 209715200

# mount options
mount -t ceph "$MONS:/" /mnt/cephfs -o name=app,rasize=67108864

Larger client caches reduce MDS round trips and increase the memory a revocation has to work through. On a client with many files open, that trade favours a moderate cache.

Session timeouts

ceph config get mds mds_session_autoclose        # 300 s
ceph config get mds mds_session_blocklist_on_timeout

A client that stops responding has its session closed after the timeout and is blocklisted, which is what produces Stale file handle on that client and requires a remount.

Quiz

Knowledge check · 4 questions

  1. Q1. Two clients access the same CephFS file concurrently, one writing. What does the second client see?

  2. Q2. Concurrent access to the same CephFS file by multiple clients is slower than exclusive access.

  3. Q3. Investigate a report that files are not visible across clients.

    A team reports that files created on one CephFS client do not appear on another. They have added explicit sync calls throughout their application, which has not helped and has slowed it considerably.

  4. Q4. What consistency guarantee does CephFS provide, and how does it exceed close-to-open?

Passing score: 75%. Answers are checked in this browser.

Production discipline

Verify what consistency your workload actually needs against what CephFS provides before carrying over NFS-era workarounds; the extra flushes cost measurable performance and address a gap that is not there. When files appear missing across clients, compare mount paths before investigating consistency — it is the far more common cause.

Cross-course references

  • Kubernetes: ReadWriteMany volume semantics depend entirely on the underlying filesystem’s guarantees
  • Linux: NFS close-to-open consistency is the weaker model these workarounds were written for