On Wed, 22.03.17 11:05, Chris Murphy (li...@colorremedies.com) wrote:

> > Result code of "remount ro" is not evaluated or logged. systemd does
> >
> > (void) mount(NULL, m->path, NULL, MS_REMOUNT|MS_RDONLY, options);
> >
> > where "options" are those from /proc/self/mountinfo sans ro|rw.
> >
> > Probably it should log it at least with debug level.
> 
> So I've asked over on the XFS about this, and they suggest all of this
> is expected behavior under the circumstances. The sync only means data
> is committed to disk with an appropriate journal entry, it doesn't
> mean fs metadata is up to date, and it's the fs metadata that GRUB is
> depending on, but isn't up to date yet. So the suggestion is that if
> remount-ro fails, to use freeze/unfreeze and then reboot. The

I am sorry, but XFS is really broken here. All init systems since time
began kinda did the same thing when shutting down:

a) try to unmount all fs that can be unmounted
b) for the remaining ones, try to remount ro (the root fs usually qualifies)
c) sync()
d) reboot()

That's how sysvinit does it, how Upstart does it, and systemd does it
the same way. (Well, if the initrd supports it we go one step further
though, and optionally pivot back to the initrd which can then unmount
the root file system, too. That's a systemd innovation however, and
only supported on initrd systems where the initrd supports it)

If the XFS devs think that the sync() before reboot() can be partially
ignored, then I am sorry for them, but that makes XFS pretty much
incompatible with every init system in existence.

Or to say this differently: if they expect us to invoke some magic
per-filesystem ioctl() before reboot(), then that's nonsense. No init
system calls that, and I am strongly against such hacks. They should
just fix their APIs.

Moreover, the man page of sync() is pretty clear on this:

          "sync() causes all pending modifications to file system
          metadata and cached file data to be written to the
          underlying filesystems."

It explicitly mentions metadata. Any way you turn it, the XFS folks
are just confused if they really claim sync() doesn't have to sync
metadata. History says differently, and so does the man page
documentation.

> If it's useful I'll file an issue with systemd on github to get a
> freeze/unfreeze inserted. remount-ro isn't always successful, and
> clearly it's not ok to reboot anyway if remount-ro fails.

I don't think we'd merge such a patch. The XFS folks should implement
documented behaviour and that'll not just fix things with systemd, but
with any init system.

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to