Hi.
>>Grub does it as a workaround.
>
> It's stupid. How does sync() multiple times in secession work better
> than once?
I never claimed it was smart :)
>>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).
>
> Well, not to split hair, sync() means all data needs to hit the disk.
> Accessing it via a bock device for a mounted filesystem will cause bad
> stuff --- is this what grub does?
Yup.
> I umount/mount should enforce everything is written an consistent.
It does, but you can't unmount and then mount the filesystem if you
don't have a seperate /boot partition.
> Grub could also use O_DIRECT if it didn't trust direct-block access
> was going to be in sync. with the fs after a sync() call (which as you
> say strictly speaking it need not be).
Yup. I'd need to check up if O_DIRECT is supported in the XFS I run.
>>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.
>
> If the filesystem is mounted, grub is doing something it can't rely
> on. Grub could use O_DIRECT probably to work around this.
Yup. My sentiments exactly. I'll have a look into it and see if
I can't get it to work that way - at least it would work for a few
more cases (those where O_DIRECT is supported).
// Stefan
|