linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mdadm: do not read the 'clean' flag from potentially non-up-to-date drive
@ 2012-04-06 12:24 Alexander Lyakas
  2012-04-09  9:07 ` Alexander Lyakas
  2012-04-09 23:54 ` NeilBrown
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Lyakas @ 2012-04-06 12:24 UTC (permalink / raw)
  To: linux-raid, NeilBrown

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.

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-09 23:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).