Online Book Reader

Home Category

Managing NFS and NIS, 2nd Edition - Mike Eisler [232]

By Root 322 0

/net/inchun/export/folder/data2: Stale NFS file handle

total 6

-rw-rw-rw- 1 labiaga staff 2883 Apr 10 20:03 data1

The first directory listing on tarsus correctly displayed the contents of the NFS directory /net/inchun/export/folder before anything was removed. The problems began after the NFS client protium removed the file data2. The second directory listing on tarsus continued showing the recently removed data2 file as part of the directory, although the extended directory listing reported a "Stale NFS filehandle" for data2.

This was a typical case of inconsistent caching of information by an NFS client. Solaris NFS clients cache the directory content and attribute information in memory at the time the directory contents are first read from the NFS server. Subsequent client accesses to the directory first validate the cached information, comparing the directory's cached modification time to the modification time reported by the server. A match in modification times indicates that the directory has not been modified since the last time the client read it, therefore it can safely use the cached data. On the other hand, if the modification times are different, the NFS client purges its cache, and issues a new NFS Readdir request to the server to obtain the updated directory contents and attributes. Some non-Unix NFS servers are known for not updating the modification time of directories when files are removed, leading to directory caching problems. We used snoop to capture the NFS packets between our client and server while the problem was being reproduced. The analysis of the snoop output should help us determine if we're running into this caching problem.

To facilitate the discussion, we list the snoop packets preceded by the commands that generated them. This shows the correlation between the NFS traffic and the Unix commands that generate the traffic:

[1] tarsus $ ls -l /net/inchun/export/folder

total 8

-rw-rw-rw- 1 labiaga staff 2883 Apr 10 20:03 data1

-rw-rw-rw- 1 root other 12 Apr 10 20:01 data2

7 0.00039 tarsus -> inchun NFS C GETATTR2 FH=FA14

8 0.00198 inchun -> tarsus NFS R GETATTR2 OK

9 0.00031 tarsus -> inchun NFS C READDIR2 FH=FA14 Cookie=0

10 0.00220 inchun -> tarsus NFS R READDIR2 OK 4 entries (No more)

11 0.00033 tarsus -> inchun NFS C LOOKUP2 FH=FA14 data2

12 0.00000 inchun -> tarsus NFS R LOOKUP2 OK FH=F8CD

13 0.00000 tarsus -> inchun NFS C GETATTR2 FH=F8CD

14 0.00000 inchun -> tarsus NFS R GETATTR2 OK

15 0.00035 tarsus -> inchun NFS C LOOKUP2 FH=FA14 data1

16 0.00211 inchun -> tarsus NFS R LOOKUP2 OK FH=F66F

17 0.00032 tarsus -> inchun NFS C GETATTR2 FH=F66F

18 0.00191 inchun -> tarsus NFS R GETATTR2 OK

Packets 7 and 8 contain the request and reply for attributes for the /net/inchun/export/folder directory. The attributes can be displayed by using the -v directive:

Excerpt from: snoop -i /tmp/capture -p 7,8 -v

ETHER: ----- Ether Header -----

ETHER:

ETHER: Packet 8 arrived at 20:45:9.75

...

NFS: ----- Sun NFS -----

NFS:

NFS: Proc = 1 (Get file attributes)

NFS: Status = 0 (OK)

NFS: File type = 2 (Directory)

NFS: Mode = 040777

NFS: Type = Directory

NFS: Setuid = 0, Setgid = 0, Sticky = 0

NFS: Owner's permissions = rwx

NFS: Group's permissions = rwx

NFS: Other's permissions = rwx

NFS: Link count = 2, UID = 0, GID = -2, Rdev = 0x0

NFS: File size = 512, Block size = 512, No. of blocks = 1

NFS: File system id = 7111, File id = 161

NFS: Access time = 11-Apr-00 12:50:18.000000 GMT

NFS: Modification time = 11-Apr-00 12:50:18.000000 GMT

NFS: Inode change time = 31-Jul-96 09:40:56.000000 GMT

Packet 8 shows the /net/inchun/export/folder directory was last modified on April 11, 2000 at 12:50:18.000000 GMT. tarsus caches this timestamp to later determine when the cached directory contents need to be updated. Packet 9 contains the request made by tarsus for the directory listing from inchun. Packet 10 contains inchun's reply with four entries in the directory. A detailed view of the packets shows the four directory entries: ".", "..", "data1", and "data2". The EOF indicator

Return Main Page Previous Page Next Page

®Online Book Reader