public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Guoqing Jiang <gqjiang@suse.com>, Marc Smith <marc.smith@mcc.edu>,
	linux-raid@vger.kernel.org
Subject: Re: md-cluster Module Requirement
Date: Thu, 01 Sep 2016 20:51:52 +1000	[thread overview]
Message-ID: <877favdh9z.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <57C7F534.3040400@suse.com>

[-- Attachment #1: Type: text/plain, Size: 2098 bytes --]

On Thu, Sep 01 2016, Guoqing Jiang wrote:

>
> Thanks, how about below changes?
>
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -7619,20 +7619,19 @@ EXPORT_SYMBOL(unregister_md_cluster_operations);
>
>   int md_setup_cluster(struct mddev *mddev, int nodes)
>   {
> -       int err;
> -
> -       err = request_module("md-cluster");
> -       if (err) {
> -               pr_err("md-cluster module not found.\n");
> -               return -ENOENT;
> -       }
> -
>          spin_lock(&pers_lock);
> -       if (!md_cluster_ops || !try_module_get(md_cluster_mod)) {
> -               spin_unlock(&pers_lock);
> -               return -ENOENT;
> +       if (!md_cluster_ops) {
> +               /* load module and ensure it won't be unloaded */
> +               if (!request_module("md-cluster") &&

Calling request_module() under a spin_lock is not OK.  request_module()
needs to wait while the module is loaded.

Just call request_module, ignore the error, then take the spinlock and
see if the module is registered.

NeilBrown

> +                   !try_module_get(md_cluster_mod)) {
> +                       pr_err("md-cluster module found.\n");
> +                       spin_unlock(&pers_lock);
> +               } else {
> +                       pr_err("md-cluster module not found.\n");
> +                       spin_unlock(&pers_lock);
> +                       return -ENODEV;
> +               }
>          }
> -       spin_unlock(&pers_lock);
>
>          return md_cluster_ops->join(mddev, nodes);
>   }
>
>>>> I looked at linux-next and it appears this code is the same; is there
>>>> a test we can do before attempting to load the module in the case that
>>>> its built-in, or is there some other requirement that md-cluster needs
>>>> to be built as a module?
>>> Yes, we need some additional modules corosync/pacemaker and dlm,
>> That doesn't explain the error message though.
>
> You are right, I should read carefully :(
>
>> If MD_CLUSTER is built in, then DLM must be too.
>
> Sure,  then only need to ensure cluster is configured right.
>
> Best Regards,
> Guoqing

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

  reply	other threads:[~2016-09-01 10:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26 14:40 md-cluster Module Requirement Marc Smith
2016-09-01  2:18 ` Guoqing Jiang
2016-09-01  5:52   ` NeilBrown
2016-09-01  9:30     ` Guoqing Jiang
2016-09-01 10:51       ` NeilBrown [this message]
2016-09-01 15:45         ` Marc Smith

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=877favdh9z.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=gqjiang@suse.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=marc.smith@mcc.edu \
    /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