1nfsd(7) Miscellaneous Information Manual nfsd(7)
2
3
4
6 nfsd - special filesystem for controlling Linux NFS server
7
9 mount -t nfsd nfsd /proc/fs/nfsd
10
12 The nfsd filesytem is a special filesystem which provides access to the
13 Linux NFS server. The filesystem consists of a single directory which
14 contains a number of files. These files are actually gateways into the
15 NFS server. Writing to them can affect the server. Reading from them
16 can provide information about the server.
17
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.
21
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.
25
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.
31
33 The three files in the nfsd filesystem are:
34
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.
43
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.
49
50
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.
57
58
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.
66
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.
71
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 handles length will be at most the number of bytes given.
75
76 The filehandle will be represented in hex with a leading '\x'.
77
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:
84
85
86 auth.domain
87 This cache maps the name of a client (or domain) to an internal
88 data structure. The only access that is possible is to flush
89 the cache.
90
91
92 auth.unix.ip
93 This cache contains a mapping from IP address to the name of the
94 authentication domain that the ipaddress should be treated as
95 part of.
96
97
98 nfsd.export
99 This cache contains a mapping from directory and domain to
100 export options.
101
102
103 nfsd.fh
104 This cache contains a mapping from domain and a filesystem iden‐
105 tifier to a directory. The filesystem identifier is stored in
106 the filehandles and consists of a number indicating the type of
107 identifier and a number of hex bytes indicating the content of
108 the identifier.
109
110
111 Each directory representing a cache can hold from 1 to 3 files. They
112 are:
113
114 flush When a number of seconds since epoch (1 Jan 1970) is written to
115 this file, all entries in the cache that were last updated
116 before that file become invalidated and will be flushed out.
117 Writing 1 will flush everything. This is the only file that
118 will always be present.
119
120
121 content
122 This file, if present, contains a textual representation of ever
123 entry in the cache, one per line. If an entry is still in the
124 cache (because it is actively being used) but has expired or is
125 otherwise invalid, it will be presented as a comment (with a
126 leading hash character).
127
128
129 channel
130 This file, if present, acts a channel for request from the ker‐
131 nel-based nfs server to be passed to a user-space program for
132 handling.
133
134 When the kernel needs some information which isn't in the cache,
135 it makes a line appear in the channel file giving the key for
136 the information. A user-space program should read this, find
137 the answer, and write a line containing the key, an expiry time,
138 and the content. For example the kernel might make
139 nfsd 127.0.0.1
140 appear in the auth.unix.ip/content file. The user-space program
141 might then write
142 nfsd 127.0.0.1 1057206953 localhost
143 to indicate that 127.0.0.1 should map to localhost, atleast for
144 now.
145
146 If the program uses select(2) or poll(2) to discover if it can
147 read from the channel then it will never see and end-of-file but
148 when all requests have been answered, it will block until
149 another request appears.
150
151
152 In the /proc filesystem there are 4 files that can be used to enabled
153 extra tracing of nfsd and related code. They are:
154 /proc/sys/sunrpc/nfs_debug
155 /proc/sys/sunrpc/nfsd_debug
156 /proc/sys/sunrpc/nlm_debug
157 /proc/sys/sunrpc/rpc_debug
158 They control tracing for the NFS client, the NFS server, the Network
159 Lock Manager (lockd) and the underlying RPC layer respectively. Deci‐
160 mal numbers can be read from or written to these files. Each number
161 represents a bit-pattern where bits that are set cause certain classes
162 of tracing to be enabled. Consult the kernel header files to find out
163 what number correspond to what tracing.
164
165
167 rpc.nfsd(8), exports(5), nfsstat(8), mountd(8) exportfs(8).
168
169
171 NeilBrown
172
173
174
175 3 July 2003 nfsd(7)