#!/bin/bash## Usage: failmodule <failname> <modulename> [stacktrace-depth]## <failname>: "failslab", "fail_alloc_page", or "fail_make_request"## <modulename>: module name that you want to inject faults.## [stacktrace-depth]: the maximum number of stacktrace walking allowed#STACKTRACE_DEPTH=5if[$# -gt 2 ];thenSTACKTRACE_DEPTH=$3fiif[!-d /debug/$1];thenecho"Fault-injection $1 does not exist">&2exit 1fiif[!-d /sys/module/$2];thenecho"Module $2 does not exist">&2exit 1fi# Disable any fault injectionecho 0 > /debug/$1/stacktrace-depth