aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fault-inject.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 16:00:36 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 16:00:36 -0500
commit78a45c6f067824cf5d0a9fedea7339ac2e28603c (patch)
treeb4f78c8b6b9059ddace0a18c11629b8d2045f793 /lib/fault-inject.c
parentf96fe225677b3efb74346ebd56fafe3997b02afa (diff)
parent29d293b6007b91a4463f05bc8d0b26e0e65c5816 (diff)
Merge branch 'akpm' (second patch-bomb from Andrew)
Merge second patchbomb from Andrew Morton: - the rest of MM - misc fs fixes - add execveat() syscall - new ratelimit feature for fault-injection - decompressor updates - ipc/ updates - fallocate feature creep - fsnotify cleanups - a few other misc things * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (99 commits) cgroups: Documentation: fix trivial typos and wrong paragraph numberings parisc: percpu: update comments referring to __get_cpu_var percpu: update local_ops.txt to reflect this_cpu operations percpu: remove __get_cpu_var and __raw_get_cpu_var macros fsnotify: remove destroy_list from fsnotify_mark fsnotify: unify inode and mount marks handling fallocate: create FAN_MODIFY and IN_MODIFY events mm/cma: make kmemleak ignore CMA regions slub: fix cpuset check in get_any_partial slab: fix cpuset check in fallback_alloc shmdt: use i_size_read() instead of ->i_size ipc/shm.c: fix overly aggressive shmdt() when calls span multiple segments ipc/msg: increase MSGMNI, remove scaling ipc/sem.c: increase SEMMSL, SEMMNI, SEMOPM ipc/sem.c: change memory barrier in sem_lock() to smp_rmb() lib/decompress.c: consistency of compress formats for kernel image decompress_bunzip2: off by one in get_next_block() usr/Kconfig: make initrd compression algorithm selection not expert fault-inject: add ratelimit option ratelimit: add initialization macro ...
Diffstat (limited to 'lib/fault-inject.c')
-rw-r--r--lib/fault-inject.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index d7d501ea856d..f1cdeb024d17 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -40,10 +40,16 @@ EXPORT_SYMBOL_GPL(setup_fault_attr);
40 40
41static void fail_dump(struct fault_attr *attr) 41static void fail_dump(struct fault_attr *attr)
42{ 42{
43 if (attr->verbose > 0) 43 if (attr->verbose > 0 && __ratelimit(&attr->ratelimit_state)) {
44 printk(KERN_NOTICE "FAULT_INJECTION: forcing a failure\n"); 44 printk(KERN_NOTICE "FAULT_INJECTION: forcing a failure.\n"
45 if (attr->verbose > 1) 45 "name %pd, interval %lu, probability %lu, "
46 dump_stack(); 46 "space %d, times %d\n", attr->dname,
47 attr->probability, attr->interval,
48 atomic_read(&attr->space),
49 atomic_read(&attr->times));
50 if (attr->verbose > 1)
51 dump_stack();
52 }
47} 53}
48 54
49#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) 55#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)
@@ -202,6 +208,12 @@ struct dentry *fault_create_debugfs_attr(const char *name,
202 goto fail; 208 goto fail;
203 if (!debugfs_create_ul("verbose", mode, dir, &attr->verbose)) 209 if (!debugfs_create_ul("verbose", mode, dir, &attr->verbose))
204 goto fail; 210 goto fail;
211 if (!debugfs_create_u32("verbose_ratelimit_interval_ms", mode, dir,
212 &attr->ratelimit_state.interval))
213 goto fail;
214 if (!debugfs_create_u32("verbose_ratelimit_burst", mode, dir,
215 &attr->ratelimit_state.burst))
216 goto fail;
205 if (!debugfs_create_bool("task-filter", mode, dir, &attr->task_filter)) 217 if (!debugfs_create_bool("task-filter", mode, dir, &attr->task_filter))
206 goto fail; 218 goto fail;
207 219
@@ -222,6 +234,7 @@ struct dentry *fault_create_debugfs_attr(const char *name,
222 234
223#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ 235#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */
224 236
237 attr->dname = dget(dir);
225 return dir; 238 return dir;
226fail: 239fail:
227 debugfs_remove_recursive(dir); 240 debugfs_remove_recursive(dir);