linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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,
	Jes.Sorensen@redhat.com
Subject: Re: [PATCH 1/2] FIX: mdmon doesn't start
Date: Mon, 7 Nov 2011 11:46:16 +1100	[thread overview]
Message-ID: <20111107114616.580d7b0f@notabene.brown> (raw)
In-Reply-To: <20111103165532.8864.80753.stgit@gklab-128-013.igk.intel.com>

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

On Thu, 03 Nov 2011 17:55:33 +0100 Adam Kwolek <adam.kwolek@intel.com> wrote:

> When array is not clean dismounted directory /dev/.mdadm is not cleaned up.
> On array re-assembly read pid is not valid and it is not possible
> to connect to monitor. This causes mdmon to exit and array remains
> not monitored.
> Problem is introduced by fix:
>    mdmon(): Error out if failing to connect to victim monitor
>    819c158866f466075a1c719f0dc496deb2fb3814
> 
> This is critical for container reshape when mdmon is should finish reshape.
> when reshape is not finished, array is reshaped again by mdadm.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
> 
>  mdmon.c |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/mdmon.c b/mdmon.c
> index bdcda0e..5ac7cd6 100644
> --- a/mdmon.c
> +++ b/mdmon.c
> @@ -458,11 +458,16 @@ static int mdmon(char *devname, int devnum, int must_fork, int takeover)
>  
>  	victim = mdmon_pid(container->devnum);
>  	if (victim >= 0) {
> -		victim_sock = connect_monitor(container->devname);
> -		if (victim_sock < 0) {
> -			fprintf(stderr, "mdmon: %s unable to connect monitor\n",
> -				container->devname);
> -			exit(3);
> +		/* It is possible that mdmon that wrote pid file was killed.
> +		 * check if read pid is valid/mdmon is running
> +		 */
> +		if (mdmon_running(victim)) {
> +			victim_sock = connect_monitor(container->devname);
> +			if (victim_sock < 0) {
> +				fprintf(stderr, "mdmon: %s unable to connect "
> +					"monitor\n", container->devname);
> +				exit(3);
> +			}
>  		}
>  	}
>  

Thanks for the patch.
I decided to revert the patch that originally caused the problem instead - it
really isn't needed.
I then added a patch to make sure we never use victim_sock when it is -1.
The places were we might have used it we not dangerous at all, but it is
cleaner to check.

Thanks,
NeilBrown

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

      parent reply	other threads:[~2011-11-07  0:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03 16:55 [PATCH 1/2] FIX: mdmon doesn't start Adam Kwolek
2011-11-03 16:55 ` [PATCH 2/2] FIX: Do not continue container reshape when mdmon is absent Adam Kwolek
2011-11-07  0:47   ` NeilBrown
2011-11-07  0:46 ` NeilBrown [this message]

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=20111107114616.580d7b0f@notabene.brown \
    --to=neilb@suse.de \
    --cc=Jes.Sorensen@redhat.com \
    --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).