Linux RAID subsystem development
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Daniel Frey <djqfrey@gmail.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: mdadm forces resync every boot
Date: Wed, 10 Aug 2011 11:31:46 +1000	[thread overview]
Message-ID: <20110810113146.3667affb@notabene.brown> (raw)
In-Reply-To: <4E41D9EC.1070706@gmail.com>

On Tue, 09 Aug 2011 18:07:56 -0700 Daniel Frey <djqfrey@gmail.com> wrote:

> On 08/08/11 16:34, NeilBrown wrote:
> > 
> > When there have been no writes for a little while, mdmon will notice and mark
> > the array as 'clean'.  It will then mark it 'dirty' before the first write is
> > allowed to proceed.
> > On a clean shutdown of the array it will mark that array as 'clean'.
> > 
> > But for you, the system shuts down with the array marked 'dirty'.  This
> > suggests that on your machine 'mdmon' is being killed while the array is
> > still active.
> > 
> > Presumably your root is on the IMSM RAID10 array?  When the root filesystem
> > is marked 'read only' it will probably write to the filesystem to record that
> > a fsck is not needed.  So the array will be 'dirty'.  If you then halt before
> > mdmon has a chance to mark the array 'clean' you will get exactly the result
> > you see.
> > 
> > If you arrange that the shutdown script runs
> >   mdadm --wait-clean --scan
> > 
> > after marking the root filesystem readonly, it will wait until all arrays are
> > recorded as 'clean'.
> > 
> 
> Neil,
> 
> I see by the switches it is watching /proc/mdstat for updates, but /proc
> was likely unmounted earlier in the shutdown process, and root is now
> read-only.

It need /proc, /sys, and /dev (assuming udev).
There is really no point in unmounting any of these as they are virtual.
Unmount everything else, remount root readonly, then "mdadm --wait-clean".

However I would expect missing filesystems to cause an early failure rather
than a hang.  If mdmon had been killed already that might cause a bit of a
hang, but it should be limited to 5 seconds.

Maybe run 'mdadm --wait-clean --scan' under 'strace' and see what it is
doing??

NeilBrown


> 
> I've put it in the shutdown scripts and the system hangs on shutdown -
> I've traced the hang to the command I put in above `mdadm --wait-clean
> --scan`.
> 
> Is it possible it's waiting for a write somewhere? I'm so close to
> having it working now...
> 
> Dan


  reply	other threads:[~2011-08-10  1:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05 15:05 mdadm forces resync every boot Daniel Frey
2011-08-06 10:18 ` Erwan Leroux
2011-08-07  0:09   ` Daniel Frey
2011-08-08 23:34 ` NeilBrown
2011-08-09 19:34   ` Daniel Frey
2011-08-10  1:07   ` Daniel Frey
2011-08-10  1:31     ` NeilBrown [this message]
2012-09-13  1:11       ` Daniel Frey

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=20110810113146.3667affb@notabene.brown \
    --to=neilb@suse.de \
    --cc=djqfrey@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