From: Neil Brown <neilb@suse.de>
To: Luca Berra <bluca@comedia.it>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>
Subject: Re: [mdadm PATCH 6/9] mdmon: connect_monitor should use socket from either dir
Date: Wed, 3 Mar 2010 12:51:35 +1100 [thread overview]
Message-ID: <20100303125135.5bcd4332@notabene.brown> (raw)
In-Reply-To: <20100228144424.GE24781@maude.comedia.it>
On Sun, 28 Feb 2010 15:44:24 +0100
Luca Berra <bluca@comedia.it> wrote:
> connect_monitor is called by ping_monitor in various places
> the socket should be checked in either VAR_RUN or ALT_RUN
I agree with this even less, for much the same reasons.
If you still see a need for something like this in my latest git tree (not
yet published - wait an hour or two at least), please explain.
Thanks,
NeilBrown
>
> Signed-off-by: Luca Berra <bluca@comedia.it>
> ---
> mdmon.c | 2 +-
> msg.c | 15 ++++++++++++---
> msg.h | 2 +-
> util.c | 2 +-
> 4 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/mdmon.c b/mdmon.c
> index 3410e84..3627a80 100644
> --- a/mdmon.c
> +++ b/mdmon.c
> @@ -447,7 +447,7 @@ static int mdmon(char *devname, int devnum, int must_fork, int takeover)
> victim = mdmon_pid(container->devnum, pid_dir);
> }
> if (victim >= 0)
> - victim_sock = connect_monitor(container->devname);
> + victim_sock = connect_monitor(container->devname, pid_dir);
> }
>
> ignore = chdir("/");
> diff --git a/msg.c b/msg.c
> index d2d8445..78a7964 100644
> --- a/msg.c
> +++ b/msg.c
> @@ -138,7 +138,7 @@ int wait_reply(int fd, int tmo)
> return receive_message(fd, &msg, tmo);
> }
>
> -int connect_monitor(char *devname)
> +int connect_monitor(char *devname, const char *pid_dir)
> {
> char path[100];
> int sfd;
> @@ -147,6 +147,15 @@ int connect_monitor(char *devname)
> int pos;
> char *c;
>
> + /* if pid_dir is null try to detect it */
> + if (!pid_dir) {
> + sfd = connect_monitor(devname, VAR_RUN);
> + if (sfd >= 0)
> + return sfd;
> + else
> + return connect_monitor(devname, ALT_RUN);
> + }
> +
> pos = sprintf(path, "%s/", pid_dir);
> if (is_subarray(devname)) {
> devname++;
> @@ -199,7 +208,7 @@ int fping_monitor(int sfd)
> /* give the monitor a chance to update the metadata */
> int ping_monitor(char *devname)
> {
> - int sfd = connect_monitor(devname);
> + int sfd = connect_monitor(devname, NULL);
> int err = fping_monitor(sfd);
>
> close(sfd);
> @@ -213,7 +222,7 @@ int ping_monitor(char *devname)
> */
> int ping_manager(char *devname)
> {
> - int sfd = connect_monitor(devname);
> + int sfd = connect_monitor(devname, NULL);
> struct metadata_update msg = { .len = -1 };
> int err = 0;
>
> diff --git a/msg.h b/msg.h
> index f8e89fd..46299db 100644
> --- a/msg.h
> +++ b/msg.h
> @@ -25,7 +25,7 @@ extern int receive_message(int fd, struct metadata_update *msg, int tmo);
> extern int send_message(int fd, struct metadata_update *msg, int tmo);
> extern int ack(int fd, int tmo);
> extern int wait_reply(int fd, int tmo);
> -extern int connect_monitor(char *devname);
> +extern int connect_monitor(char *devname, const char *pid_dir);
> extern int ping_monitor(char *devname);
> extern int fping_monitor(int sock);
> extern int ping_manager(char *devname);
> diff --git a/util.c b/util.c
> index 50e04bf..c22886b 100644
> --- a/util.c
> +++ b/util.c
> @@ -1585,7 +1585,7 @@ int flush_metadata_updates(struct supertype *st)
> return -1;
> }
>
> - sfd = connect_monitor(devnum2devname(st->container_dev));
> + sfd = connect_monitor(devnum2devname(st->container_dev), NULL);
> if (sfd < 0)
> return -1;
>
next prev parent reply other threads:[~2010-03-03 1:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-27 15:05 [mdadm PATCH 0/2] *** mdmon fixes *** Luca Berra
2010-02-27 15:07 ` [mdadm PATCH 1/2] fix mdmon option parsing Luca Berra
2010-02-27 15:21 ` Luca Berra
2010-03-02 5:40 ` Neil Brown
2010-03-02 7:42 ` Luca Berra
2010-02-27 15:07 ` [mdadm PATCH 2/2] fix mdmon takeover Luca Berra
2010-03-03 0:52 ` Neil Brown
2010-02-28 14:41 ` [mdadm PATCH 0/2] *** mdmon fixes *** Luca Berra
2010-02-28 14:42 ` [mdadm PATCH 3/9] add missing newline to mdmon usage message Luca Berra
2010-02-28 14:42 ` [mdadm PATCH 4/9] mdmon: check select a writable pid_dir Luca Berra
2010-03-03 1:07 ` Neil Brown
2010-02-28 14:43 ` [mdadm PATCH 5/9] mdmon: mdmon_pid should return pid from either dir Luca Berra
2010-03-03 1:50 ` Neil Brown
2010-03-03 6:44 ` Luca Berra
2010-03-03 6:55 ` Neil Brown
2010-03-03 7:09 ` Luca Berra
2010-02-28 14:44 ` [mdadm PATCH 6/9] mdmon: connect_monitor should use socket " Luca Berra
2010-03-03 1:51 ` Neil Brown [this message]
2010-02-28 14:45 ` [mdadm PATCH 7/9] mdmon: move pid_dir to mdmon.c Luca Berra
2010-02-28 14:45 ` [mdadm PATCH 8/9] mdmon: rework startup and takeover logic Luca Berra
2010-03-03 1:52 ` Neil Brown
2010-03-03 6:48 ` Luca Berra
2010-02-28 14:46 ` [mdadm PATCH 9/9] allow redefinition of VAR_RUN Luca Berra
2010-03-03 1:53 ` Neil Brown
2010-02-28 15:41 ` [mdadm PATCH 0/2] *** mdmon fixes *** Bill Davidsen
2010-02-28 17:37 ` Luca Berra
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=20100303125135.5bcd4332@notabene.brown \
--to=neilb@suse.de \
--cc=bluca@comedia.it \
--cc=linux-raid@vger.kernel.org \
/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).