Next Previous Contents

7. Tracing/sanity

The knfsd code has a number of hooks for tracing and sanity checking. Some of them are described here.

7.1 nfsd_nr_put/nfsd_nr_verified

File handle structures are used extensivly in the nfsd code. Presumably as a check that they were being allocated and freed properly, a count of the number that have been properly verify, and the number that have been properly released is kept. The difference between these two should be the number that are currently in use which should never be more than 3 times the number of threads. However this is never checked, and the number a no accessible at all. Maybe they can be discards.

7.2 dprintk

The sunrpc module provides a very nice facility for turning on and off printk tracing of various modules. Each sunrpc related module (nfs, nfsd, nlm, rpc) has a "debug" variable which can be read or written through /proc/sys/sunrpc/module_debug. The value is a bitmask of different parts of the module that can be traced. Each file defines which part it is.

For example, nfsfh.c contains:


#define NFSDDBG_FACILITY NFSDDBG_FH

include/linux/nfsd/debug.h defines
#define NFSDDBG_FH              0x0002

so that the command
 echo 2 > /proc/sys/sunrpc/nfsd_debug

will enable all the dprintk statements in nfsfh.c.

7.3 nfsd_stats

knfsd keeps a few counters to measure various events, as does the sunrpc modules. These are made available throughhe file /proc/net/rpc/nfsd This file contains one line for each sort of statistics. The first line is specific to knfsd, the remainder are provided by the rpc layer.

Though 9 counters are currently defined, only 4 are still used. They are the hits, misses, and refusals(?) for the request cache, and the count of stale file handles that have been seen. These are the first, second, third, and 8th numbers on the line.


Next Previous Contents