NFS Stale File Handle

1 Overview

When an NFS client accesses an inode that no longer available on the server, the stale file handle error (ESTALE) occurs.

Reproduce cases:

2 Setup Lab

vm1$ exportfs -v
/srv/nfs 192.0.0.0/24(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
vm2$ df -h
Filesystem                Size      Used Available Use% Mounted on
192.0.0.10:/srv/nfs       5.6G    221.0M      5.1G   4% /mnt/nfs

3 Delete an Open Directory

If the server deletes a file or directory while the client currently has open, the inode held by client becomes invalid. The further actions to the inode will fail with ‘Stale file handle’ error.

Server.

vm1$ mkdir /srv/nfs/test
vm1$ rm -rf /srv/nfs/test

Client.

vm2$ cd /mnt/nfs/test
vm2:/mnt/nfs/test$ ls
ls: .: Stale file handle

4 Re-Export an Open Directory

TODO…