forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'for-3.3' of git://linux-nfs.org/~bfields/linux
* 'for-3.3' of git://linux-nfs.org/~bfields/linux: (31 commits) nfsd4: nfsd4_create_clid_dir return value is unused NFSD: Change name of extended attribute containing junction svcrpc: don't revert to SVC_POOL_DEFAULT on nfsd shutdown svcrpc: fix double-free on shutdown of nfsd after changing pool mode nfsd4: be forgiving in the absence of the recovery directory nfsd4: fix spurious 4.1 post-reboot failures NFSD: forget_delegations should use list_for_each_entry_safe NFSD: Only reinitilize the recall_lru list under the recall lock nfsd4: initialize special stateid's at compile time NFSd: use network-namespace-aware cache registering routines SUNRPC: create svc_xprt in proper network namespace svcrpc: update outdated BKL comment nfsd41: allow non-reclaim open-by-fh's in 4.1 svcrpc: avoid memory-corruption on pool shutdown svcrpc: destroy server sockets all at once svcrpc: make svc_delete_xprt static nfsd: Fix oops when parsing a 0 length export nfsd4: Use kmemdup rather than duplicating its implementation nfsd4: add a separate (lockowner, inode) lookup nfsd4: fix CONFIG_NFSD_FAULT_INJECTION compile error ...
- Loading branch information
Showing
26 changed files
with
624 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -514,6 +514,11 @@ S: Bessemerstraat 21 | |
S: Amsterdam | ||
S: The Netherlands | ||
|
||
N: NeilBrown | ||
E: [email protected] | ||
P: 4096R/566281B9 1BC6 29EB D390 D870 7B5F 497A 39EC 9EDD 5662 81B9 | ||
D: NFSD Maintainer 2000-2007 | ||
|
||
N: Zach Brown | ||
E: [email protected] | ||
D: maestro pci sound | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
Fault Injection | ||
=============== | ||
Fault injection is a method for forcing errors that may not normally occur, or | ||
may be difficult to reproduce. Forcing these errors in a controlled environment | ||
can help the developer find and fix bugs before their code is shipped in a | ||
production system. Injecting an error on the Linux NFS server will allow us to | ||
observe how the client reacts and if it manages to recover its state correctly. | ||
|
||
NFSD_FAULT_INJECTION must be selected when configuring the kernel to use this | ||
feature. | ||
|
||
|
||
Using Fault Injection | ||
===================== | ||
On the client, mount the fault injection server through NFS v4.0+ and do some | ||
work over NFS (open files, take locks, ...). | ||
|
||
On the server, mount the debugfs filesystem to <debug_dir> and ls | ||
<debug_dir>/nfsd. This will show a list of files that will be used for | ||
injecting faults on the NFS server. As root, write a number n to the file | ||
corresponding to the action you want the server to take. The server will then | ||
process the first n items it finds. So if you want to forget 5 locks, echo '5' | ||
to <debug_dir>/nfsd/forget_locks. A value of 0 will tell the server to forget | ||
all corresponding items. A log message will be created containing the number | ||
of items forgotten (check dmesg). | ||
|
||
Go back to work on the client and check if the client recovered from the error | ||
correctly. | ||
|
||
|
||
Available Faults | ||
================ | ||
forget_clients: | ||
The NFS server keeps a list of clients that have placed a mount call. If | ||
this list is cleared, the server will have no knowledge of who the client | ||
is, forcing the client to reauthenticate with the server. | ||
|
||
forget_openowners: | ||
The NFS server keeps a list of what files are currently opened and who | ||
they were opened by. Clearing this list will force the client to reopen | ||
its files. | ||
|
||
forget_locks: | ||
The NFS server keeps a list of what files are currently locked in the VFS. | ||
Clearing this list will force the client to reclaim its locks (files are | ||
unlocked through the VFS as they are cleared from this list). | ||
|
||
forget_delegations: | ||
A delegation is used to assure the client that a file, or part of a file, | ||
has not changed since the delegation was awarded. Clearing this list will | ||
force the client to reaquire its delegation before accessing the file | ||
again. | ||
|
||
recall_delegations: | ||
Delegations can be recalled by the server when another client attempts to | ||
access a file. This test will notify the client that its delegation has | ||
been revoked, forcing the client to reaquire the delegation before using | ||
the file again. | ||
|
||
|
||
tools/nfs/inject_faults.sh script | ||
================================= | ||
This script has been created to ease the fault injection process. This script | ||
will detect the mounted debugfs directory and write to the files located there | ||
based on the arguments passed by the user. For example, running | ||
`inject_faults.sh forget_locks 1` as root will instruct the server to forget | ||
one lock. Running `inject_faults forget_locks` will instruct the server to | ||
forgetall locks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3775,7 +3775,6 @@ S: Odd Fixes | |
|
||
KERNEL NFSD, SUNRPC, AND LOCKD SERVERS | ||
M: "J. Bruce Fields" <[email protected]> | ||
M: Neil Brown <[email protected]> | ||
L: [email protected] | ||
W: http://nfs.sourceforge.net/ | ||
S: Supported | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright (c) 2011 Bryan Schumaker <[email protected]> | ||
* | ||
* Uses debugfs to create fault injection points for client testing | ||
*/ | ||
|
||
#include <linux/types.h> | ||
#include <linux/fs.h> | ||
#include <linux/debugfs.h> | ||
#include <linux/module.h> | ||
|
||
#include "state.h" | ||
#include "fault_inject.h" | ||
|
||
struct nfsd_fault_inject_op { | ||
char *file; | ||
void (*func)(u64); | ||
}; | ||
|
||
static struct nfsd_fault_inject_op inject_ops[] = { | ||
{ | ||
.file = "forget_clients", | ||
.func = nfsd_forget_clients, | ||
}, | ||
{ | ||
.file = "forget_locks", | ||
.func = nfsd_forget_locks, | ||
}, | ||
{ | ||
.file = "forget_openowners", | ||
.func = nfsd_forget_openowners, | ||
}, | ||
{ | ||
.file = "forget_delegations", | ||
.func = nfsd_forget_delegations, | ||
}, | ||
{ | ||
.file = "recall_delegations", | ||
.func = nfsd_recall_delegations, | ||
}, | ||
}; | ||
|
||
static long int NUM_INJECT_OPS = sizeof(inject_ops) / sizeof(struct nfsd_fault_inject_op); | ||
static struct dentry *debug_dir; | ||
|
||
static int nfsd_inject_set(void *op_ptr, u64 val) | ||
{ | ||
struct nfsd_fault_inject_op *op = op_ptr; | ||
|
||
if (val == 0) | ||
printk(KERN_INFO "NFSD Fault Injection: %s (all)", op->file); | ||
else | ||
printk(KERN_INFO "NFSD Fault Injection: %s (n = %llu)", op->file, val); | ||
|
||
op->func(val); | ||
return 0; | ||
} | ||
|
||
static int nfsd_inject_get(void *data, u64 *val) | ||
{ | ||
return 0; | ||
} | ||
|
||
DEFINE_SIMPLE_ATTRIBUTE(fops_nfsd, nfsd_inject_get, nfsd_inject_set, "%llu\n"); | ||
|
||
void nfsd_fault_inject_cleanup(void) | ||
{ | ||
debugfs_remove_recursive(debug_dir); | ||
} | ||
|
||
int nfsd_fault_inject_init(void) | ||
{ | ||
unsigned int i; | ||
struct nfsd_fault_inject_op *op; | ||
mode_t mode = S_IFREG | S_IRUSR | S_IWUSR; | ||
|
||
debug_dir = debugfs_create_dir("nfsd", NULL); | ||
if (!debug_dir) | ||
goto fail; | ||
|
||
for (i = 0; i < NUM_INJECT_OPS; i++) { | ||
op = &inject_ops[i]; | ||
if (!debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd)) | ||
goto fail; | ||
} | ||
return 0; | ||
|
||
fail: | ||
nfsd_fault_inject_cleanup(); | ||
return -ENOMEM; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) 2011 Bryan Schumaker <[email protected]> | ||
* | ||
* Function definitions for fault injection | ||
*/ | ||
|
||
#ifndef LINUX_NFSD_FAULT_INJECT_H | ||
#define LINUX_NFSD_FAULT_INJECT_H | ||
|
||
#ifdef CONFIG_NFSD_FAULT_INJECTION | ||
int nfsd_fault_inject_init(void); | ||
void nfsd_fault_inject_cleanup(void); | ||
void nfsd_forget_clients(u64); | ||
void nfsd_forget_locks(u64); | ||
void nfsd_forget_openowners(u64); | ||
void nfsd_forget_delegations(u64); | ||
void nfsd_recall_delegations(u64); | ||
#else /* CONFIG_NFSD_FAULT_INJECTION */ | ||
static inline int nfsd_fault_inject_init(void) { return 0; } | ||
static inline void nfsd_fault_inject_cleanup(void) {} | ||
static inline void nfsd_forget_clients(u64 num) {} | ||
static inline void nfsd_forget_locks(u64 num) {} | ||
static inline void nfsd_forget_openowners(u64 num) {} | ||
static inline void nfsd_forget_delegations(u64 num) {} | ||
static inline void nfsd_recall_delegations(u64 num) {} | ||
#endif /* CONFIG_NFSD_FAULT_INJECTION */ | ||
|
||
#endif /* LINUX_NFSD_FAULT_INJECT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.