Re: ext3fs: umount+sync not enough to guarantee metadata-on-disk

Andrew Morton
2007-06-07T19:45:35Z

On Thu, 07 Jun 2007 12:11:58 -0400
Chuck Ebbert <cebbert@redhat.com> wrote:

> On 06/07/2007 11:41 AM, Andrew Morton wrote:
> >> mount /var/lib/mythtv -oremount,ro
> >> sync
> >> umount /var/lib/mythtv
> >
> > Did this succeed? If the application is still truncating that file, the
> > umount should have failed.
>
> Shouldn't sync should wait for truncate to finish?

I can't think of anything in there at present which would cause that to
happen, and it's not immediately obvious how we _could_ make it happen - we
have an inode which potentially has no dirty pages and which is itself
clean. The truncate can span multiple journal commits, so forcing a
journal commit in sync() won't necessarily block behind the truncate.

I guess we could ask sync to speculatively take and release every inode's
i_mutex or something. But even that would involve quite some hoop-jumping
due to those infuriating spinlock-protected list_heads on the superblock.

hmm.