Re: [PATCH 2/9] mempool: add error injection support

Christoph Hellwig
2025-11-07T12:04:40Z

On Thu, Nov 06, 2025 at 07:29:00PM -0800, Eric Biggers wrote:
> > +static DECLARE_FAULT_ATTR(fail_mempool_alloc);
> > +
> > +static int __init mempool_faul_inject_init(void)
> > +{
> > + return PTR_ERR_OR_ZERO(fault_create_debugfs_attr("fail_mempool_alloc",
> > + NULL, &fail_mempool_alloc));
> > +}
> > +late_initcall(mempool_faul_inject_init);
>
> Initcalls usually go at the bottom of the file.

For a generic init function yes. But given that this is only for error
injection, I'd rather keep the error injection handling in one spot.

>
> > + if (should_fail_ex(&fail_mempool_alloc, 1, FAULT_NOWARN)) {
>
> This doesn't build when CONFIG_FAULT_INJECTION=n.

Yeah, the buildbot already told me. For some reason there is a
!CONFIG_FAULT_INJECTION stube for should_fail_ex, but the flags are
not defined in that case. I'll add another patch to the series to
fix it.