-
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.
- Loading branch information
Bryan Schumaker
authored and
J. Bruce Fields
committed
Nov 8, 2011
1 parent
14968ec
commit 60180a8
Showing
2 changed files
with
50 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 65178db42a02c7984f711614546e97e9952d8e01 | ||
refs/heads/master: 800b927b38c7cdfbd7df39d7a8a4b065637ab7b6 |
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,49 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2011 Bryan Schumaker <bjschuma@netapp.com> | ||
# | ||
# Script for easier NFSD fault injection | ||
|
||
# Check that debugfs has been mounted | ||
DEBUGFS=`cat /proc/mounts | grep debugfs` | ||
if [ "$DEBUGFS" == "" ]; then | ||
echo "debugfs does not appear to be mounted!" | ||
echo "Please mount debugfs and try again" | ||
exit 1 | ||
fi | ||
|
||
# Check that the fault injection directory exists | ||
DEBUGDIR=`echo $DEBUGFS | awk '{print $2}'`/nfsd | ||
if [ ! -d "$DEBUGDIR" ]; then | ||
echo "$DEBUGDIR does not exist" | ||
echo "Check that your .config selects CONFIG_NFSD_FAULT_INJECTION" | ||
exit 1 | ||
fi | ||
|
||
function help() | ||
{ | ||
echo "Usage $0 injection_type [count]" | ||
echo "" | ||
echo "Injection types are:" | ||
ls $DEBUGDIR | ||
exit 1 | ||
} | ||
|
||
if [ $# == 0 ]; then | ||
help | ||
elif [ ! -f $DEBUGDIR/$1 ]; then | ||
help | ||
elif [ $# != 2 ]; then | ||
COUNT=0 | ||
else | ||
COUNT=$2 | ||
fi | ||
|
||
BEFORE=`mktemp` | ||
AFTER=`mktemp` | ||
dmesg > $BEFORE | ||
echo $COUNT > $DEBUGDIR/$1 | ||
dmesg > $AFTER | ||
# Capture lines that only exist in the $AFTER file | ||
diff $BEFORE $AFTER | grep ">" | ||
rm -f $BEFORE $AFTER |