···22 - this file (nfs-related documentation).33Exporting44 - explanation of how to make filesystems exportable.55+fault_injection.txt66+ - information for using fault injection on the server57knfsd-stats.txt68 - statistics which the NFS server makes available to user space.79nfs.txt
+69
Documentation/filesystems/nfs/fault_injection.txt
···11+22+Fault Injection33+===============44+Fault injection is a method for forcing errors that may not normally occur, or55+may be difficult to reproduce. Forcing these errors in a controlled environment66+can help the developer find and fix bugs before their code is shipped in a77+production system. Injecting an error on the Linux NFS server will allow us to88+observe how the client reacts and if it manages to recover its state correctly.99+1010+NFSD_FAULT_INJECTION must be selected when configuring the kernel to use this1111+feature.1212+1313+1414+Using Fault Injection1515+=====================1616+On the client, mount the fault injection server through NFS v4.0+ and do some1717+work over NFS (open files, take locks, ...).1818+1919+On the server, mount the debugfs filesystem to <debug_dir> and ls2020+<debug_dir>/nfsd. This will show a list of files that will be used for2121+injecting faults on the NFS server. As root, write a number n to the file2222+corresponding to the action you want the server to take. The server will then2323+process the first n items it finds. So if you want to forget 5 locks, echo '5'2424+to <debug_dir>/nfsd/forget_locks. A value of 0 will tell the server to forget2525+all corresponding items. A log message will be created containing the number2626+of items forgotten (check dmesg).2727+2828+Go back to work on the client and check if the client recovered from the error2929+correctly.3030+3131+3232+Available Faults3333+================3434+forget_clients:3535+ The NFS server keeps a list of clients that have placed a mount call. If3636+ this list is cleared, the server will have no knowledge of who the client3737+ is, forcing the client to reauthenticate with the server.3838+3939+forget_openowners:4040+ The NFS server keeps a list of what files are currently opened and who4141+ they were opened by. Clearing this list will force the client to reopen4242+ its files.4343+4444+forget_locks:4545+ The NFS server keeps a list of what files are currently locked in the VFS.4646+ Clearing this list will force the client to reclaim its locks (files are4747+ unlocked through the VFS as they are cleared from this list).4848+4949+forget_delegations:5050+ A delegation is used to assure the client that a file, or part of a file,5151+ has not changed since the delegation was awarded. Clearing this list will5252+ force the client to reaquire its delegation before accessing the file5353+ again.5454+5555+recall_delegations:5656+ Delegations can be recalled by the server when another client attempts to5757+ access a file. This test will notify the client that its delegation has5858+ been revoked, forcing the client to reaquire the delegation before using5959+ the file again.6060+6161+6262+tools/nfs/inject_faults.sh script6363+=================================6464+This script has been created to ease the fault injection process. This script6565+will detect the mounted debugfs directory and write to the files located there6666+based on the arguments passed by the user. For example, running6767+`inject_faults.sh forget_locks 1` as root will instruct the server to forget6868+one lock. Running `inject_faults forget_locks` will instruct the server to6969+forgetall locks.