#include #include #include #include "slab.h" static struct { struct fault_attr attr; bool ignore_gfp_reclaim; bool cache_filter; } failslab = { .attr = FAULT_ATTR_INITIALIZER, .ignore_gfp_reclaim = true, .cache_filter = false, }; bool should_failslab(struct kmem_cache *s, gfp_t gfpflags) { /* No fault-injection for bootstrap cache */ if (unlikely(s == kmem_cache)) return false; if (gfpflags & __GFP_NOFAIL) return false; if (failslab.ignore_gfp_reclaim && (gfpflags & __GFP_RECLAIM)) return false; if (failslab.cache_filter && !(s->flags & SLAB_FAILSLAB)) return false; return should_fail(&failslab.attr, s->object_size); } static int __init setup_failslab(char *str) { return setup_fault_attr(&failslab.attr, str); } __setup("failslab=", setup_failslab); #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS static int __init failslab_debugfs_init(void) { struct dentry *dir; umode_t mode = S_IFREG | S_IRUSR | S_IWUSR; dir = fault_create_debugfs_attr("failslab", NULL, &failslab.attr); if (IS_ERR(dir)) return PTR_ERR(dir); if (!debugfs_create_bool("ignore-gfp-wait", mode, dir, &failslab.ignore_gfp_reclaim)) goto fail; if (!debugfs_create_bool("cache-filter", mode, dir, &failslab.cache_filter)) goto fail; return 0; fail: debugfs_remove_recursive(dir); return -ENOMEM; } late_initcall(failslab_debugfs_init); #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */ /linux/net-next.git/'>summaryrefslogtreecommitdiff
path: root/net
AgeCommit message (Expand)AuthorFilesLines
2017-02-09kcm: fix 0-length case for kcm_sendmsg()WANG Cong1-18/+22
2017-02-08net: dsa: Do not destroy invalid network devicesFlorian Fainelli1-0/+1
2017-02-08ping: fix a null pointer dereferenceWANG Cong1-0/+2
2017-02-08packet: round up linear to header lenWillem de Bruijn1-3/+4
2017-02-08net: introduce device min_header_lenWillem de Bruijn1-0/+1
2017-02-08sit: fix a double free on error pathWANG Cong1-0/+1
2017-02-08ipv6: addrconf: fix generation of new temporary addressesMarcus Huewe1-0/+6
2017-02-07Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netLinus Torvalds