Re: [PATCH] module, async: async_synchronize_full() on module init iff async is used

From: Rusty Russell
Date: Tue Jan 15 2013 - 23:24:36 EST


Tejun Heo <tj@xxxxxxxxxx> writes:
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -3058,8 +3064,25 @@ static int do_init_module(struct module
> blocking_notifier_call_chain(&module_notify_list,
> MODULE_STATE_LIVE, mod);
>
> - /* We need to finish all async code before the module init sequence is done */
> - async_synchronize_full();

Linus put async_synchronize_full() here as a fix but beware: you can
start using the module before this call. Normally the potential caller
is the one requesting the module load so it works, but if we get more
async stuff we may land in that hole.

Changing every caller of any async-initializing service is not going to
be pretty, but maybe put an async_cookie_t in struct module for
module_init to use, and sync it in try_module_get()? Which would now
need a can_sleep flag... but the result would be more async.

Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/