xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/nfs/nfsd-admin-interfaces.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun==================================
2*4882a593SmuzhiyunAdministrative interfaces for nfsd
3*4882a593Smuzhiyun==================================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunNote that normally these interfaces are used only by the utilities in
6*4882a593Smuzhiyunnfs-utils.
7*4882a593Smuzhiyun
8*4882a593Smuzhiyunnfsd is controlled mainly by pseudofiles under the "nfsd" filesystem,
9*4882a593Smuzhiyunwhich is normally mounted at /proc/fs/nfsd/.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunThe server is always started by the first write of a nonzero value to
12*4882a593Smuzhiyunnfsd/threads.
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunBefore doing that, NFSD can be told which sockets to listen on by
15*4882a593Smuzhiyunwriting to nfsd/portlist; that write may be:
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun	-  an ascii-encoded file descriptor, which should refer to a
18*4882a593Smuzhiyun	   bound (and listening, for tcp) socket, or
19*4882a593Smuzhiyun	-  "transportname port", where transportname is currently either
20*4882a593Smuzhiyun	   "udp", "tcp", or "rdma".
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunIf nfsd is started without doing any of these, then it will create one
23*4882a593Smuzhiyunudp and one tcp listener at port 2049 (see nfsd_init_socks).
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunOn startup, nfsd and lockd grace periods start. nfsd is shut down by a write of
26*4882a593Smuzhiyun0 to nfsd/threads.  All locks and state are thrown away at that point.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunBetween startup and shutdown, the number of threads may be adjusted up
29*4882a593Smuzhiyunor down by additional writes to nfsd/threads or by writes to
30*4882a593Smuzhiyunnfsd/pool_threads.
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunFor more detail about files under nfsd/ and what they control, see
33*4882a593Smuzhiyunfs/nfsd/nfsctl.c; most of them have detailed comments.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunImplementation notes
36*4882a593Smuzhiyun====================
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunNote that the rpc server requires the caller to serialize addition and
39*4882a593Smuzhiyunremoval of listening sockets, and startup and shutdown of the server.
40*4882a593SmuzhiyunFor nfsd this is done using nfsd_mutex.
41