From: NeilBrown <neilb@suse.de>
To: Adam Kwolek <adam.kwolek@intel.com>
Cc: linux-raid@vger.kernel.org, ed.ciechanowski@intel.com,
marcin.labun@intel.com, dan.j.williams@intel.com
Subject: Re: [PATCH 1/3] Move code to check_mdmon_version() function
Date: Mon, 3 Oct 2011 10:45:56 +1100 [thread overview]
Message-ID: <20111003104556.4b640532@notabene.brown> (raw)
In-Reply-To: <20110929155336.22854.2583.stgit@gklab-128-013.igk.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2837 bytes --]
On Thu, 29 Sep 2011 17:53:36 +0200 Adam Kwolek <adam.kwolek@intel.com> wrote:
> Move code to function for code reuse.
>
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Applied, thanks.
though it might be better for "check_mdmon_version" also took a version
number to compare against.
NeilBrown
> ---
>
> msg.c | 59 ++++++++++++++++++++++++++++++++++++-----------------------
> 1 files changed, 36 insertions(+), 23 deletions(-)
>
> diff --git a/msg.c b/msg.c
> index a10c930..98d6d13 100644
> --- a/msg.c
> +++ b/msg.c
> @@ -281,6 +281,40 @@ int block_subarray(struct mdinfo *sra)
>
> return rc;
> }
> +
> +/* check mdmon version if it supports
> + * array blocking mechanism
> + */
> +int check_mdmon_version(char *container)
> +{
> + char *version = NULL;
> + int devnum = devname2devnum(container);
> +
> + if (!mdmon_running(devnum)) {
> + /* if mdmon is not active we assume that any instance that is
> + * later started will match the current mdadm version, if this
> + * assumption is violated we may inadvertantly rebuild an array
> + * that was meant for reshape, or start rebuild on a spare that
> + * was to be moved to another container
> + */
> + /* pass */;
> + } else {
> + int ver;
> +
> + version = ping_monitor_version(container);
> + ver = version ? mdadm_version(version) : -1;
> + free(version);
> + if (ver < 3002000) {
> + fprintf(stderr, Name
> + ": mdmon instance for %s cannot be disabled\n",
> + container);
> + return -1;
> + }
> + }
> +
> + return 0;
> +}
> +
> /**
> * block_monitor - prevent mdmon spare assignment
> * @container - container to block
> @@ -302,34 +336,13 @@ int block_subarray(struct mdinfo *sra)
> */
> int block_monitor(char *container, const int freeze)
> {
> - int devnum = devname2devnum(container);
> struct mdstat_ent *ent, *e, *e2;
> struct mdinfo *sra = NULL;
> - char *version = NULL;
> char buf[64];
> int rv = 0;
>
> - if (!mdmon_running(devnum)) {
> - /* if mdmon is not active we assume that any instance that is
> - * later started will match the current mdadm version, if this
> - * assumption is violated we may inadvertantly rebuild an array
> - * that was meant for reshape, or start rebuild on a spare that
> - * was to be moved to another container
> - */
> - /* pass */;
> - } else {
> - int ver;
> -
> - version = ping_monitor_version(container);
> - ver = version ? mdadm_version(version) : -1;
> - free(version);
> - if (ver < 3002000) {
> - fprintf(stderr, Name
> - ": mdmon instance for %s cannot be disabled\n",
> - container);
> - return -1;
> - }
> - }
> + if (check_mdmon_version(container))
> + return -1;
>
> ent = mdstat_read(0, 0);
> if (!ent) {
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
next prev parent reply other threads:[~2011-10-02 23:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 15:53 [PATCH 0/3] Fix freezing multiple array in container during assembly Adam Kwolek
2011-09-29 15:53 ` [PATCH 1/3] Move code to check_mdmon_version() function Adam Kwolek
2011-10-02 23:45 ` NeilBrown [this message]
2011-09-29 15:53 ` [PATCH 2/3] FIX: Block array monitoring if any array is under reshape in container Adam Kwolek
2011-10-02 23:54 ` NeilBrown
2011-09-29 15:53 ` [PATCH 3/3] FIX: Remove error message during reshape restart (v2) Adam Kwolek
2011-10-02 23:57 ` NeilBrown
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=20111003104556.4b640532@notabene.brown \
--to=neilb@suse.de \
--cc=adam.kwolek@intel.com \
--cc=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=marcin.labun@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).