NFS: client does not see new files created on server (caching?)

nfs

The NFS server is a SLES11SP3, here is the exports statement:

/media/data *domain.com(rw,sync,no_root_squash,fsid=1)

I suspect this is a caching issue on the client (RHEL6), however I believe I turned all caching off, still the problem remains.

How the problems shows:

On the server I do a touch /media/data/test. The file does not show on the client, even if I wait several minutes.

If I touch /media/data (the directory) on the server, then it shows. It also appears when I touch /data/test2 from the client.

What I tried on the client:

# original
server:/media/data   /data  nfs   rw,soft,vers=3,rsize=1048576,wsize=1048576,mountvers=3,sync,lookupcache=none
# mod 1 (remove parameters which have defaults: size, mountvers; add noac)
server:/media/data   /data  nfs   rw,soft,vers=3,sync,lookupcache=none,noac 0 0

I also tried mounting using hard and specify actimeo=1, no effect.

I have seen this and this. No help either.


Update #1

It seems that the underlying filesystem is special.

The underlying filesystem on the server is a Novell NSS volume.

NSS has certain unique properties like mapping the creation time of the file to the ctime in Linux (which natively is the change time there).

Meaning: Upon modifying the directory contents, only mtime gets updated and not ctime. Apparently the RHEL NFS client does not consider this a sufficient reason to update its cache while the SuSE NFS clients seem to be patched for this.

What are the options?

  • Change the properties on the NSS volume (which can optionally map ctime to Change Time and not Creation Time, although one would have to investigate the repercussions of this filesystem-wide setting)
  • Get Redhat to only consider mtime and not ctime (why are they anyway?)
  • Workaround: touch the directories before listing them…….

Best Answer

This was due to a "feature" of NSS (Novell Storage Services) called noCtimeIsMetadataModTime which maps the NSS create time to Linux ctime.

When we change a file on the server, the modified time of the parent directory gets updated, but not the "change" time, as it usually is the case. For the NFS client cache to be updated it thus seems that both the modified and change time need to update, at least that is what we see when we export an ext3 FS instead of NSS.

This is the case for older NFS clients. Newer clients will be fine but we have to be careful as they seem to be working by coincidence (because of an optimization).

One workaround is to touch the parent directory on the server after you want to make your changes visible to the outside world....

Related Topic