Hi.
>>Firstly anaconda executes "grub-install --just-copy", and executes
>>sync() three times.
>
> grub is braindead then. Calling sync() once should suffice.
Grub does it as a workaround.
>>Then anaconda runs "grub --batch" to really install grub into MBR of
>>the disk, but grub cannot find files which should have been already
>>written in the partition by sync().
>
> That sounds like something else. sync() ensures dirty buffers are
> on-disk. Even if you don't sync() you can still read-back using the
> buffer-cache/page-cache.
Or.. Should.
>>When I put 1 minutes of sleep() next to sync(), grub finds those
>>files and is installed successfully.
>
> I'm not sure I follow, but I'n not convinced it's XFS failing to
> sync() to disk unless it's a really old tree.
Happens with current tree I can tell you that me and .. Steve I think
discussed it on IRC a while back and he looked into the POSIX spec
and according to POSIX a filesystem does not have to keep the block
device the same as the filesystem after a sync() (or mounting SYNC).
In the case of XFS it _should_ but doesn't but it's not violating
any specs.
And Grub relies on the filesystem keeping the block device in sync
with the filesystem after a sync() call. That's a bug in both Grub and
XFS but XFS isn't the one violating the spec, even though it's a bug.
// Stefan
|