Bugtraq mailing list archives

Re: nfs handles/lifetime


From: casper () Holland Sun COM (Casper Dik)
Date: Wed, 10 May 1995 16:25:52 +0200


Since an NFS filehandle is derived from the inode characteristics, it never
changes, except when an admin uses fsirand.

Now, since all access checking is done with mountd, won't an exported system
still be available for access if you have its old filehandle even though the
admin takes its entry out of /etc/exports?  For instance, let's say A is a
server, and B is its client.  A exports /usr to B.

B mounts A:/usr and writes down the filehandle.  A decides to stop exporting
/usr and removes it from the exports file.  Can B still access files in /usr?

I did strings(1) on various vendors' nfsds, and found that about half of them
had /etc/exports in them.  Can anyone elaborate on this?


Since I'm only familiar with Sun's implementation, I can only comment
on that implementation.  In Sun's implementation, the kernel keeps
a list of export mount points.  A file handle is a combination of
( <disk id>, <export point id>, <file id>)

If an exported filesystem is no longer exported, the <export point id>
is removed from the kernel export list.  Each NFS access checks the
<export point id> for validity, so references to files under that
directory will yield "Stale NFS filehandle"

In short: if you unexport a filesystem, it can no longer be accessed.

However, if you change the export list (e.g., make it more restrictive)
all clients that have filehandles will keep them and can continue
to use them.

/etc/exports is merely a reflection of which file are exported,
it is not used by nfsd, as far as I know.  The mount info is kept
in mountd and inside the kernel.  The strings "/etc/exports" is part
of libc, so systems that ship a statically linked nfsd, e.g., because
they don't support dynamic linking, will show the strings "/etc/exports".

Casper



Current thread: