Re: syncing the disks when entering sleep

Pavel Machek
2010-02-16T06:38:45Z

> > > > > Actually, doing the sync() in the kernel is a hack that we decided not to
> > > > > remove just because the users space didin't do the right thing on some systems.
> > > > > If the user space always synced disks before suspending, we wouldn't have to
> > > > > do that in the kernel.
> > > >
> > > > If you sync in user space will you not have an inevitable race condition?
> > >
> > > Do you mean the race with applications that write to disks while the sustem is
> > > suspending?
> >
> > Yes.
>
> That would matter if sync meant mandatory flushing all data to the storage
> medium, but it doesn't. From a filesystem point of view it's an advisory
> thing, something like "I wish you flushed buffers right now".

No, I don't think so. Maybe posix states its advisory and only starts
a writeback, but linux historicaly did the right thing.

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html