linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: linux-raid@vger.kernel.org
Cc: Song Liu <songliubraving@fb.com>,
	shli@fb.com, kernel-team@fb.com, dan.j.williams@intel.com,
	hch@infradead.org, jes.sorensen@gmail.com
Subject: Re: [PATCH 2/2] mdadm: save previous journal_clean when reload super
Date: Tue, 29 Aug 2017 10:49:54 +1000	[thread overview]
Message-ID: <87val7gpu5.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20170828222036.3278481-3-songliubraving@fb.com>

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

On Mon, Aug 28 2017, Song Liu wrote:

> In Incremental.c:count_active(), max_events is tracked to show to
> which devices are up to date. If a device has events==max_events+1,
> getinfo_super() is called to reload the superblock from this
> device. getinfo_super1() blindly set journal_clean to 0, which is
> wrong. This patch fixes this issue by saving previous
> journal_clean before calling getinfo_super().
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  Incremental.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/Incremental.c b/Incremental.c
> index 6cf2174..b17b37f 100644
> --- a/Incremental.c
> +++ b/Incremental.c
> @@ -747,13 +747,16 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
>  				;
>  			else if (info.events == max_events+1) {
>  				int i;
> +				int journal_clean;
>  				max_events = info.events;
>  				for (i = 0; i < raid_disks; i++)
>  					if (avail[i])
>  						avail[i]--;
>  				avail[info.disk.raid_disk] = 2;
>  				best[info.disk.raid_disk] = devnum;
> +				journal_clean = bestinfo->journal_clean;
>  				st->ss->getinfo_super(st, bestinfo, NULL);
> +				bestinfo->journal_clean = journal_clean;
>  			} else { /* info.events much bigger */
>  				memset(avail, 0, raid_disks);
>  				max_events = info.events;


This is a hack to work around a symptom.  It is not a real fix.

I'm not sure what the real fix is.
Maybe when you find "raid_disk == MD_DISK_ROLE_JOURNAL" you set
"journal_events = info.events", then after the loop, if
"journal_events >= max_events-1", you set "bestinfo->journal_clean = 1",
or something like that.
But you need to make it obvious that the code is correct, and the above
code looks like a hack.

Thanks,
NeilBrown

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

  reply	other threads:[~2017-08-29  0:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28 22:20 [PATCH 0/2] mdadm patches for r5cache and mdadm.spec Song Liu
2017-08-28 22:20 ` [PATCH 1/2] mdadm: install two more udev rules in mdadm.spec Song Liu
2017-08-28 22:20 ` [PATCH 2/2] mdadm: save previous journal_clean when reload super Song Liu
2017-08-29  0:49   ` NeilBrown [this message]
2017-08-29 17:40 ` [PATCH 0/2] mdadm patches for r5cache and mdadm.spec Jes Sorensen

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=87val7gpu5.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@infradead.org \
    --cc=jes.sorensen@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=shli@fb.com \
    --cc=songliubraving@fb.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).