From: NeilBrown <neilb@suse.de>
To: Alexander Lyakas <alex.bolshoy@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH] mdadm: do not read the 'clean' flag from potentially non-up-to-date drive
Date: Tue, 10 Apr 2012 09:54:59 +1000 [thread overview]
Message-ID: <20120410095459.4799c6f4@notabene.brown> (raw)
In-Reply-To: <CAGRgLy5=xP3ZJz71j2qYiCFLFFD6uCH0O92p3Ev2s2GnonRc8A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2002 bytes --]
On Fri, 6 Apr 2012 15:24:22 +0300 Alexander Lyakas <alex.bolshoy@gmail.com>
wrote:
> Hi Neil,
>
> I noticed that mdadm may decide that array is dirty, based on the
> non-freshest drive. This happens, e.g., when there is a drive failure
> during initial resync, and then array is stopped and re-assembled. The
> failed drive still has a valid sb->resync_offset, so if this drive is
> visible during assembly, array will be considered dirty, even though
> the rest of the drives have sb->resync_offset==MaxSector.
>
> Do you think array should be considered as dirty in this case? Because
> if the failed drive was not visible during assembly, array would have
> been considered clean.
>
> The below patch is only to demonstrate the possible fix. The idea is
> that we decide that array is dirty only according to up-to-date
> drives. Currently the "clean" flag is initialized from the first
> superblock, which might not be the freshest one.
>
> I haven't tested it at all. If you think the direction is reasonable,
> I will test.
Yes, that does seem reasonable.
If nothing surprising shows up in testing I'll be happy to apply it.
Thanks,
NeilBrown
>
> Thanks,
> Alex.
>
>
> diff --git a/Assemble.c b/Assemble.c
> index 23695e7..42cbbd5 100644
> --- a/Assemble.c
> +++ b/Assemble.c
> @@ -929,7 +929,6 @@ int Assemble(struct supertype *st, char *mddev,
> st->minor_version = 90;
>
> st->ss->getinfo_super(st, content, NULL);
> - clean = content->array.state & 1;
>
> /* now we have some devices that might be suitable.
> * I wonder how many
> @@ -1122,6 +1121,7 @@ int Assemble(struct supertype *st, char *mddev,
> #ifndef MDASSEMBLE
> sysfs_init(content, mdfd, 0);
> #endif
> + clean = 1; /* Assume that array is clean, until we see otherwise */
> for (i=0; i<bestcnt; i++) {
> int j = best[i];
> unsigned int desired_state;
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2012-04-09 23:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-06 12:24 [PATCH] mdadm: do not read the 'clean' flag from potentially non-up-to-date drive Alexander Lyakas
2012-04-09 9:07 ` Alexander Lyakas
2012-04-09 23:54 ` 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=20120410095459.4799c6f4@notabene.brown \
--to=neilb@suse.de \
--cc=alex.bolshoy@gmail.com \
--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).