1nfsd(7)                Miscellaneous Information Manual                nfsd(7)


6       nfsd - special filesystem for controlling Linux NFS server


9       mount -t nfsd nfsd /proc/fs/nfsd


12       The  nfsd  filesystem  is a special filesystem which provides access to
13       the Linux NFS server.  The filesystem consists of  a  single  directory
14       which  contains  a  number of files.  These files are actually gateways
15       into the NFS server.  Writing to them can affect the  server.   Reading
16       from them can provide information about the server.
18       This  file  system is only available in Linux 2.6 and later series ker‐
19       nels (and in the later parts of the 2.5 development series  leading  up
20       to 2.6).  This man page does not apply to 2.4 and earlier.
22       As  well  as  this  filesystem,  there are a collection of files in the
23       procfs filesystem (normally mounted at /proc) which are used to control
24       the NFS server.  This manual page describes all of these files.
26       The exportfs and mountd programs (part of the nfs-utils package) expect
27       to find this filesystem mounted at /proc/fs/nfsd or  /proc/fs/nfs.   If
28       it  is  not  mounted,  they  will fall-back on 2.4 style functionality.
29       This involves accessing the NFS server via a systemcall.  This  system‐
30       call is scheduled to be removed after the 2.6 kernel series.


33       The three files in the nfsd filesystem are:
35       exports
36              This  file  contains  a  list  of filesystems that are currently
37              exported and  clients  that  each  filesystem  is  exported  to,
38              together  with a list of export options for that client/filesys‐
39              tem pair.  This is similar to the /proc/fs/nfs/exports  file  in
40              2.4.  One difference is that a client doesn't necessarily corre‐
41              spond to just one host.  It can respond to a large collection of
42              hosts that are being treated identically.
44              Each line of the file contains a path name, a client name, and a
45              number of options in parentheses.  Any space,  tab,  newline  or
46              back-slash  character  in  the  path name or client name will be
47              replaced by a backslash followed by the  octal  ASCII  code  for
48              that character.
51       threads
52              This  file  represents  the number of nfsd thread currently run‐
53              ning.  Reading it will show the number of threads.   Writing  an
54              ASCII  decimal  number  will  cause  the number of threads to be
55              changed (increased or decreased as necessary)  to  achieve  that
56              number.
59       filehandle
60              This  is  a  somewhat unusual file  in that what is read from it
61              depends on what was just written to it.  It provides a  transac‐
62              tional  interface  where  a  program  can open the file, write a
63              request, and read a response.  If two  separate  programs  open,
64              write,  and  read  at  the same time, their requests will not be
65              mixed up.
67              The request written to filehandle should be  a  client  name,  a
68              path  name, and a number of bytes.  This should be followed by a
69              newline, with white-space separating the fields, and octal quot‐
70              ing of special characters.
72              On  writing  this, the program will be able to read back a file‐
73              handle for that path as exported to the given client.  The file‐
74              handle's length will be at most the number of bytes given.
76              The filehandle will be represented in hex with a leading '\x'.
78       The  directory /proc/net/rpc in the procfs filesystem contains a number
79       of files and directories.  The files contain  statistics  that  can  be
80       display using the nfsstat program.  The directories contain information
81       about various caches that the NFS server maintains  to  keep  track  of
82       access  permissions  that different clients have for different filesys‐
83       tems.  The caches are:
86       auth.unix.ip
87              This cache contains a mapping from IP address to the name of the
88              authentication  domain  that  the ipaddress should be treated as
89              part of.
92       nfsd.export
93              This cache contains a  mapping  from  directory  and  domain  to
94              export options.
97       nfsd.fh
98              This cache contains a mapping from domain and a filesystem iden‐
99              tifier to a directory.   The filesystem identifier is stored  in
100              the  filehandles and consists of a number indicating the type of
101              identifier and a number of hex bytes indicating the  content  of
102              the identifier.
105       Each  directory  representing a cache can hold from 1 to 3 files.  They
106       are:
108       flush  When a number of seconds since epoch (1 Jan 1970) is written  to
109              this  file,  all  entries  in  the  cache that were last updated
110              before that file become invalidated and  will  be  flushed  out.
111              Writing a time in the future (in seconds since epoch) will flush
112              everything.  This is the only file that will always be present.
115       content
116              This file, if present, contains a textual representation of ever
117              entry  in  the cache, one per line.  If an entry is still in the
118              cache (because it is actively being used) but has expired or  is
119              otherwise  invalid,  it  will  be presented as a comment (with a
120              leading hash character).
123       channel
124              This file, if present, acts a channel for request from the  ker‐
125              nel-based  nfs  server  to be passed to a user-space program for
126              handling.
128              When the kernel needs some information which isn't in the cache,
129              it  makes  a  line appear in the channel file giving the key for
130              the information.  A user-space program should  read  this,  find
131              the answer, and write a line containing the key, an expiry time,
132              and the content.  For example the kernel might make
133                   nfsd
134              appear in the auth.unix.ip/content file.  The user-space program
135              might then write
136                   nfsd 1057206953 localhost
137              to indicate that should map to localhost, at least for
138              now.
140              If the program uses select(2) or poll(2) to discover if  it  can
141              read from the channel then it will never see and end-of-file but
142              when all requests  have  been  answered,  it  will  block  until
143              another request appears.
146       In  the  /proc filesystem there are 4 files that can be used to enabled
147       extra tracing of nfsd and related code.  They are:
148            /proc/sys/sunrpc/nfs_debug
149            /proc/sys/sunrpc/nfsd_debug
150            /proc/sys/sunrpc/nlm_debug
151            /proc/sys/sunrpc/rpc_debug
152       They control tracing for the NFS client, the NFS  server,  the  Network
153       Lock  Manager (lockd) and the underlying RPC layer respectively.  Deci‐
154       mal numbers can be read from or written to these  files.   Each  number
155       represents  a bit-pattern where bits that are set cause certain classes
156       of tracing to be enabled.  Consult the kernel header files to find  out
157       what number correspond to what tracing.


161       nfsd(8), rpc.nfsd(8), exports(5), nfsstat(8), mountd(8) exportfs(8).


165       NeilBrown
169                                  3 July 2003                          nfsd(7)