All Products
Search
Document Center

:Writing delays when accessing a file from different NFS clients

Last Updated:Jun 02, 2026

Symptom

You mount an NFS file system on two Elastic Compute Service (ECS) instances, ECS-A and ECS-B. When you append data to a file on ECS-A and then run tail -f on ECS-B to watch the file, the new content does not appear for 10 to 30 seconds. Opening the same file with vi on ECS-B shows the updated content immediately.

Cause

NFS attribute caching is enabled by default. When you mount a file system with the mount -t nfs4 /mnt/ command, the Linux NFS client caches file and directory attributes — including permissions, size, and timestamp — as local metadata. This cache reduces the number of NFSPROC_GETATTR remote procedure call (RPC) requests sent to the NFS server, improving overall performance.

The tail -f command monitors file changes by calling sleep and fstat in a loop. It detects updates by checking whether the file size has changed. Because fstat reads from the local attribute cache rather than querying the NFS server directly, it may return a stale file size even after the server has received new data. As a result, tail -f does not output the new content until the cache expires.

Solution

Add the noac mount option to disable attribute caching. With noac, fstat always fetches current attributes from the NFS server, so tail -f reflects writes immediately.

mount -t nfs4 -o noac /mnt/