The patch titled Subject: mm: make should_failslab always available for fault injection has been removed from the -mm tree. Its filename was mm-make-should_failslab-always-available-for-fault-injection.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Howard McLauchlan <hmclauchlan@xxxxxx> Subject: mm: make should_failslab always available for fault injection should_failslab() is a convenient function to hook into for directed error injection into kmalloc(). However, it is only available if a config flag is set. The following BCC script, for example, fails kmalloc() calls after a btrfs umount: from bcc import BPF prog = r""" BPF_HASH(flag); #include <linux/mm.h> int kprobe__btrfs_close_devices(void *ctx) { u64 key = 1; flag.update(&key, &key); return 0; } int kprobe__should_failslab(struct pt_regs *ctx) { u64 key = 1; u64 *res; res = flag.lookup(&key); if (res != 0) { bpf_override_return(ctx, -ENOMEM); } return 0; } """ b = BPF(text=prog) while 1: b.kprobe_poll() This patch refactors the should_failslab implementation so that the function is always available for error injection, independent of flags. This change would be similar in nature to commit f5490d3ec921 ("block: Add should_fail_bio() for bpf error injection"). Link: http://lkml.kernel.org/r/20180222020320.6944-1-hmclauchlan@xxxxxx Signed-off-by: Howard McLauchlan <hmclauchlan@xxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Akinobu Mita <akinobu.mita@xxxxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Josef Bacik <jbacik@xxxxxx> Cc: Johannes Weiner <jweiner@xxxxxx> Cc: Alexei Starovoitov <ast@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/fault-inject.h | 5 +++-- mm/failslab.c | 2 +- mm/slab_common.c | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff -puN include/linux/fault-inject.h~mm-make-should_failslab-always-available-for-fault-injection include/linux/fault-inject.h --- a/include/linux/fault-inject.h~mm-make-should_failslab-always-available-for-fault-injection +++ a/include/linux/fault-inject.h @@ -64,10 +64,11 @@ static inline struct dentry *fault_creat struct kmem_cache; +int should_failslab(struct kmem_cache *s, gfp_t gfpflags); #ifdef CONFIG_FAILSLAB -extern bool should_failslab(struct kmem_cache *s, gfp_t gfpflags); +extern bool __should_failslab(struct kmem_cache *s, gfp_t gfpflags); #else -static inline bool should_failslab(struct kmem_cache *s, gfp_t gfpflags) +static inline bool __should_failslab(struct kmem_cache *s, gfp_t gfpflags) { return false; } diff -puN mm/failslab.c~mm-make-should_failslab-always-available-for-fault-injection mm/failslab.c --- a/mm/failslab.c~mm-make-should_failslab-always-available-for-fault-injection +++ a/mm/failslab.c @@ -14,7 +14,7 @@ static struct { .cache_filter = false, }; -bool should_failslab(struct kmem_cache *s, gfp_t gfpflags) +bool __should_failslab(struct kmem_cache *s, gfp_t gfpflags) { /* No fault-injection for bootstrap cache */ if (unlikely(s == kmem_cache)) diff -puN mm/slab_common.c~mm-make-should_failslab-always-available-for-fault-injection mm/slab_common.c --- a/mm/slab_common.c~mm-make-should_failslab-always-available-for-fault-injection +++ a/mm/slab_common.c @@ -1516,3 +1516,11 @@ EXPORT_TRACEPOINT_SYMBOL(kmalloc_node); EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc_node); EXPORT_TRACEPOINT_SYMBOL(kfree); EXPORT_TRACEPOINT_SYMBOL(kmem_cache_free); + +int should_failslab(struct kmem_cache *s, gfp_t gfpflags) +{ + if (__should_failslab(s, gfpflags)) + return -ENOMEM; + return 0; +} +ALLOW_ERROR_INJECTION(should_failslab, ERRNO); _ Patches currently in -mm which might be from hmclauchlan@xxxxxx are -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html