public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Jon Masters <jonathan@jonmasters.org>,
	linux-modules <linux-modules@vger.kernel.org>,
	Lucas De Marchi <lucas.de.marchi@gmail.com>
Subject: Re: [PATCH 2/2] module: wait when loading a module which is currently initializing.
Date: Mon, 17 Sep 2012 14:06:16 +0930	[thread overview]
Message-ID: <878vc9s1tr.fsf@rustcorp.com.au> (raw)
In-Reply-To: <CAMOw1v6Qy1wHhRcPQkyhDe7LrGaM_qRdhufr8YtHnfp5pTPFAA@mail.gmail.com>

Lucas De Marchi <lucas.demarchi@profusion.mobi> writes:
>> -       if (find_module(mod->name)) {
>> +       if ((old = find_module(mod->name)) != NULL) {
>> +               if (old->state == MODULE_STATE_COMING) {
>> +                       /* Wait in case it fails to load. */
>> +                       mutex_unlock(&module_mutex);
>> +                       err = wait_event_interruptible(module_wq,
>> +                                              finished_loading(mod->name));
>> +                       if (err)
>> +                               goto free_arch_cleanup;
>> +                       goto again;
>
> I wonder if we should indeed retry in case the module failed to load
> or if we should just skip straight to returning the error code. We
> don't have the return code for the failed load, but maybe we can
> fabricate one here.
>
> Thoughts?

Could have different cmdline parameters, or other randomness like
out-of-memory.  I think this is safest.

Cheers,
Rusty.

  reply	other threads:[~2012-09-17 11:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14  7:09 [PATCH 1/2] module: fix symbol waiting when module fails before init Rusty Russell
2012-09-14  7:11 ` [PATCH 2/2] module: wait when loading a module which is currently initializing Rusty Russell
2012-09-14 16:37   ` Lucas De Marchi
2012-09-17  4:36     ` Rusty Russell [this message]
2012-09-17 17:37       ` Lucas De Marchi
2012-09-14  7:12 ` module: test code for waiting Rusty Russell
2012-09-14 16:41 ` [PATCH 1/2] module: fix symbol waiting when module fails before init Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878vc9s1tr.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=jonathan@jonmasters.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=lucas.demarchi@profusion.mobi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox