Re: Why is one sync() not enough?

From: Andrew Morton
Date: Tue Jun 14 2005 - 23:52:20 EST


Nico Schottelius <nico-kernel@xxxxxxxxxxxxxxx> 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.
>

That's a bug.

The standards say that sync() is supposed to "start" I/O, or something
similarly vague and waffly. The Linux implementation of sync() has always
started all I/O and then waited upon all of it before returning from
sync().

And umount() itself will sync everything to disk, so the additional sync()
calls should be unnecessary.

That being said, if umount was leaving dirty filesystems then about 1000000
people would be complaining. So there's something unusual about your
setup.

What filesystem? What kernel version? Any unusual bind mounts, loopback
mounts, etc? There must be something there...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/