I found out that 2.3 kernels (see linux/fs/nfs/dir.c) expect NFS cookies
passed from the server to be monotonically increasing.  2.2 kernels do not
make that assumption it seems.  The cookies I'm talking about are the
'cookie' field in 'struct entry' (rpcsvc/nfs_prot.h).  The NFS (v2) specs do
not specify that the nfs cookies should or should not be increasing.  I
quote from RFC 1094, section #2.2.17:

   ``... and a "cookie" which is an opaque pointer to
   the next entry in the directory.  The cookie is used in the next
   READDIR call to get more entries starting at a given point in the
   directory.  The special cookie zero (all bits zero) can be used to
   get the entries starting at the beginning of the directory.''

The cookies are opaque and must not be interpreted by the client!  Linux
should not assume anything about them, only make sure it sends back to the
server the last cookie in the direntry chain, so that the *server* can
restart directory reading from the last entry just read.

I discovered this problem b/c directory reading in amd stopped working when
using 2.3 kernels.  Turned out that my "browsable directories" code didn't
generate monotonically increasing cookies.  I rewrote amd's code so they are
monotonically increasing and directory listing under amd works again.

Nevertheless, I think this assumption of 2.3 kernels can cause problems when
interacting with non-linux NFS servers that do not generate monotonically
increasing cookies.

Erez.

Reply via email to