From: NeilBrown <neilb@suse.de>
To: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Cc: linux-raid@vger.kernel.org, pawel.baldysiak@intel.com
Subject: Re: [PATCH] imsm: retry load_and_parse_mpb if we suspect mdmon has made modifications
Date: Mon, 2 Jun 2014 12:36:56 +1000 [thread overview]
Message-ID: <20140602123656.2e52d529@notabene.brown> (raw)
In-Reply-To: <1401455913-28657-1-git-send-email-artur.paszkiewicz@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]
On Fri, 30 May 2014 15:18:33 +0200 Artur Paszkiewicz
<artur.paszkiewicz@intel.com> wrote:
> If the checksum verification fails in mdadm and mdmon is running, retry
> the load to get a consistent snapshot of the mpb.
>
> Based on db575f3b
>
> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
> Reviewed-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> ---
> super-intel.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/super-intel.c b/super-intel.c
> index f0a7ab5..037c018 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -4422,6 +4422,7 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
> {
> struct intel_super *super;
> int rv;
> + int retry;
>
> if (test_partition(fd))
> /* IMSM not allowed on partitions */
> @@ -4444,6 +4445,22 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
> }
> rv = load_and_parse_mpb(fd, super, devname, 0);
>
> + /* retry the load if we might have raced against mdmon */
> + if (rv == 3) {
> + struct mdstat_ent *mdstat = mdstat_by_component(fd2devnm(fd));
> +
> + if (mdmon_running(mdstat->devnm) && getpid() != mdmon_pid(mdstat->devnm)) {
> + for (retry = 0; retry < 3; retry++) {
> + usleep(3000);
> + rv = load_and_parse_mpb(fd, super, devname, 0);
> + if (rv != 3)
> + break;
> + }
> + }
The only thing you use from mdstat is devnm, and that is the thing you passed
to mdstat_by_component to get mdstat....
Can you just do
char *devnm = fd2devnm(fd);
if (mdmon_running(devnm) && ......)
??
NeilBrown
> +
> + free_mdstat(mdstat);
> + }
> +
> if (rv) {
> if (devname)
> pr_err("Failed to load all information "
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2014-06-02 2:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-30 13:18 [PATCH] imsm: retry load_and_parse_mpb if we suspect mdmon has made modifications Artur Paszkiewicz
2014-06-02 2:36 ` NeilBrown [this message]
2014-06-02 13:02 ` Artur Paszkiewicz
2014-06-02 23:10 ` 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=20140602123656.2e52d529@notabene.brown \
--to=neilb@suse.de \
--cc=artur.paszkiewicz@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=pawel.baldysiak@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.