Re: Why is one sync() not enough?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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.

 Check to see that nothing at all is mounted as you reboot.

Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux