All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Vlasenko <vda@ilport.com.ua>
To: Helge Hafting <helge.hafting@aitel.hist.no>,
	Nico Schottelius <nico-kernel@schottelius.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Why is one sync() not enough?
Date: Wed, 15 Jun 2005 12:28:27 +0300	[thread overview]
Message-ID: <200506151228.27474.vda@ilport.com.ua> (raw)
In-Reply-To: <42AFE432.8000204@aitel.hist.no>

On Wednesday 15 June 2005 11:17, Helge Hafting wrote:
> Nico Schottelius wrote:
> 
> >Hello again!
> >
> >When my system shuts down and init calls sync() and after that
> >umount and then reboot, the filesystem is left in an unclean state.
> >
> >If I do sync() two times (one before umount, one after umount) it
> >seems to work.

sync before umount is superfluous.

> >Can someboy explain that to me?
> >  
> >
> You shouldn't need those syncs, as umount does its own
> syncing.  There may be other explanations:
> 
> * Your reboot actually powers down (or resets) the disk.
>    IDE disks are known for caching stuff, they may indicate
>    that data is written slightly before it actually happens.
>    (The same applies to scsi - if you enable caching there for
>    the little extra performance it buys.)
>  
>    Rebooting really quickly after umount in such a case can cut
>    power to the disk before it finishes writing.  If this is the case,
>    then a few seconds of sleep after umount before reboot
>    will work just as well as that sync.  I don't recommend this
>    as a solution, but it is an easy diagnostic!
> 
> * Your startup script accidentally mounted the fs twice.
>   (Yes - linux support that, and the first umount won't undo
>    both mounts.)  This simply means the fs isn't umounted
>   when you reboot, but an extra sync and you might get lucky.

My reboot script is checking (/proc/mounts) for stray rw mounts on reboot,
prints a warning and waits for a keypress. This helps spot such things.
--
vda


  reply	other threads:[~2005-06-15  9:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-14  9:41 Why is one sync() not enough? Nico Schottelius
2005-06-14 12:58 ` Martin Waitz
2005-06-14 15:58   ` Jesper Juhl
2005-06-14 18:36     ` Valdis.Kletnieks
2005-06-15  6:19     ` Nico Schottelius
2005-06-15  4:50 ` Andrew Morton
2005-06-15  3:39   ` jmerkey
2005-06-15  8:20   ` Bernd Eckenfels
2005-06-15 10:55   ` Nico Schottelius
2005-06-15 19:41     ` Andrew Morton
2005-06-15  8:17 ` Helge Hafting
2005-06-15  9:28   ` Denis Vlasenko [this message]
2005-06-15  9:43     ` Coywolf Qi Hunt

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=200506151228.27474.vda@ilport.com.ua \
    --to=vda@ilport.com.ua \
    --cc=helge.hafting@aitel.hist.no \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico-kernel@schottelius.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 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.