^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ==================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Administrative interfaces for nfsd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ==================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Note that normally these interfaces are used only by the utilities in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) nfs-utils.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) nfsd is controlled mainly by pseudofiles under the "nfsd" filesystem,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) which is normally mounted at /proc/fs/nfsd/.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) The server is always started by the first write of a nonzero value to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) nfsd/threads.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) Before doing that, NFSD can be told which sockets to listen on by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) writing to nfsd/portlist; that write may be:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) - an ascii-encoded file descriptor, which should refer to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) bound (and listening, for tcp) socket, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) - "transportname port", where transportname is currently either
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) "udp", "tcp", or "rdma".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) If nfsd is started without doing any of these, then it will create one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) udp and one tcp listener at port 2049 (see nfsd_init_socks).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) On startup, nfsd and lockd grace periods start. nfsd is shut down by a write of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 0 to nfsd/threads. All locks and state are thrown away at that point.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Between startup and shutdown, the number of threads may be adjusted up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) or down by additional writes to nfsd/threads or by writes to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) nfsd/pool_threads.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) For more detail about files under nfsd/ and what they control, see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) fs/nfsd/nfsctl.c; most of them have detailed comments.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Implementation notes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) Note that the rpc server requires the caller to serialize addition and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) removal of listening sockets, and startup and shutdown of the server.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) For nfsd this is done using nfsd_mutex.