lkml.org 
[lkml]   [2005]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Why is one sync() not enough?
From
Date
On Tue, 14 Jun 2005 17:58:36 +0200, Jesper Juhl said:

> actually written. Thus it was common in ages past to run sync ; sync
> ; halt when shutting down a system since even though the first sync
> might return before writing was done

Actually, it was:

# sync
# sync
# sync
# halt

If you enter 'sync;sync;sync' all 3 will get scheduled almost on top of each
other when you hit return. If you hit return on each one, the first one starts
running when you hit return, and hopefully completes while you're typing the second
and third ones.....
'sync' on recent Linux kernels appears to be synchronous and not return until
the data is out the door. If you're seeing 'sync; unmount; sync' being needed,
the most likely cause is that the *first* sync is bogus (as unmount will flush
the buffers too) - and the *second* sync is flushing out blocks from some file
that was opened in the directory *before you did the mount*:

# cd /usr/local (with nothing mounted on it, so it's an empty dir in /usr)
# touch foo
# tail -f foo &
# mount /usr/local

Now that 'foo' is an open but unreachable file on the /usr filesystem, and will
likely cause the need for a sync *for /usr* after unmounting /usr/local at system
shutdown.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-06-14 20:40    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean