public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Stan Hoeppner <stan@hardwarefreak.com>, xfs@oss.sgi.com
Subject: Re: Corruption of root fs during git bisect of drm system hang
Date: Fri, 12 Jul 2013 12:38:12 +1000	[thread overview]
Message-ID: <20130712023812.GB5228@dastard> (raw)
In-Reply-To: <20130711204033.GA355@x4>

On Thu, Jul 11, 2013 at 10:40:33PM +0200, Markus Trippelsdorf wrote:
> On 2013.07.11 at 15:24 -0500, Stan Hoeppner wrote:
> > On 7/11/2013 6:28 AM, Markus Trippelsdorf wrote:
> > ...
> > >> Looking at the source:
> > >> http://api.kde.org/4.10-api/kdelibs-apidocs/kdecore/html/ksavefile_8cpp_source.html#l00219
> > >> it appears that one can set an environment variable KDE_EXTRA_FSYNC to
> > >> address this issue.
> > >>
> > >> However in my case it doesn't help. Even with KDE_EXTRA_FSYNC=1 I still
> > >> loose my KDE settings in case of a crash. So the whole fsync thing might
> > >> be a red herring.
> > > 
> > > It turned out that the KDE_EXTRA_FSYNC variable doesn't affect KDE
> > > config file handling at all.
> > > So I've added an fsync in kconfigini.cpp (KConfigIniBackend::writeConfig)
> > > and now I don't loose my settings anymore during kernel crash testing.
> > > 
> > > That is until xfs eats my KDE config files (kwinrulesr in this case):
> > 
> > Adding fsync in kconfigini.cpp apparently doesn't force fsync for all
> > KDE file operations.  You also have some Open Office files getting hosed
> > due to lack of fsync.  XFS is not the cause of these problems.
> >
> > The problem is that all of this desktop code was developed atop EXT3
> > which flushed to disk every 5 seconds.  This made programmers sloppy as
> > they didn't have to fsync to make sure data hit disk.  This problem has
> > been covered extensively by many, including Eric in other posts on his
> > blog.  There's a really simple way to test this:  mount with sync.
> > Report results after the next crash.  If no files are corrupted then
> > you've verified the problem lay squarely on the shoulders of these
> > desktop developers who have abdicated their responsibility to make sure
> > their file changes hit the disk, instead of relying on a broken
> > filesystem do it for them.
> > 
> > Worth noting, using EXT4 without the EXT3 flush emulation enabled will
> > yield similar file corruption upon a crash.
> 
> I'm not so sure. Of course a journaled filesystem is not a database
> replacement, but wouldn't it be easier to address this issue in xfs
> directly instead of hoping in vain that application developers will
> fix their code someday?

The problem is that there is a small minority of vocal users who
complain loudly and vigorously that something is slow when
application developers use proper caution and ensure files are
safely written using fsync. Those users yell and scream that they
care more about speed than they do about losing their config
settings on a crash, and demand the problem be fixed. Hence we end
up with special environment variables that nobody knows about that
try to provide some measure of data integrity. As you've found out,
it's not sufficient.

It's not up to the filesystem to enforce a "you must do everything
safely" policy. The filesystem provides mechanisms for users and
developers to decide if they want to be fast or safe. Unfortunately
for us, while XFS is pretty fast even when running in "safe" mode,
other filesystems aren't, and that's where the problem lies.

If you want everything to be safe, mount the filesystem with -o
sync. But it will be slow. The only way to be fast and safe is for
applications to Do The Right Thing - no hacks in the filesystem can
provide both fast and safe with compromising either fast or safe in
some manner for someone.

It's unfortunate that after several years of educating people to use
fsync when data integrity is important that we are seeing a
significant back-slide to trying to avoid fsync again. it appeared
recently on the ext4 list, when a gnome developer said they turned
off fsync because users were complaining, trying to rely on a side
effect of ext4 data=ordered mode for integrity and they failed and
users started reporting that they were losing files on crashes....

This is an application layer problem, not a filesystem layer problem.
The filesystems can provide mechanisms to try to help minimise the
impact of requiring data integrity operations, but we haven't been
able to get any significant set of userspace developers to agree on
a sane set of functionality that filesystems can provide over and
above what POSIX already gives them.

And besides, a filesystem can't fix the problems of applications
that use fsync to write inconsequential data that doesn't need
persistence across crashs. Thats clearly an application problem....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2013-07-12  2:38 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  9:06 Corruption of root fs during git bisect of drm system hang Markus Trippelsdorf
2013-07-11  0:31 ` Dave Chinner
2013-07-11  3:36   ` Markus Trippelsdorf
2013-07-11  3:58     ` Dave Chinner
2013-07-11  4:12       ` Stan Hoeppner
2013-07-11  9:07         ` Markus Trippelsdorf
2013-07-11 11:28           ` Markus Trippelsdorf
2013-07-11 20:24             ` Stan Hoeppner
2013-07-11 20:40               ` Markus Trippelsdorf
2013-07-11 23:01                 ` Stan Hoeppner
2013-07-12  2:38                 ` Dave Chinner [this message]
2013-07-12  2:17           ` Dave Chinner
2013-07-12  7:07             ` Markus Trippelsdorf
2013-07-13  9:05               ` Markus Trippelsdorf
2013-07-15  2:28               ` Dave Chinner
2013-07-15  6:47                 ` Markus Trippelsdorf
2013-07-19 12:22                   ` [Bisected] " Markus Trippelsdorf
2013-07-19 12:41                     ` Stefan Ring
2013-07-19 12:51                       ` Markus Trippelsdorf
2013-07-19 16:02                         ` Eric Sandeen
2013-07-19 16:32                           ` Markus Trippelsdorf
2013-07-19 19:13                             ` Ben Myers
2013-07-19 19:56                               ` Markus Trippelsdorf
2013-07-19 20:28                                 ` Markus Trippelsdorf
2013-07-19 19:23                             ` Eric Sandeen
2013-07-19 19:53                               ` Markus Trippelsdorf
2013-07-19 21:11                     ` Mark Tinguely
2013-07-20  3:18                       ` Dave Chinner
2013-07-20 17:21                         ` Mark Tinguely
2013-07-21  7:37                           ` Dave Chinner
2013-07-20  1:48                     ` Dave Chinner
2013-07-22 10:22                       ` Dave Chinner
2013-07-22 10:47                         ` Markus Trippelsdorf
2013-07-22 22:54                           ` Dave Chinner
2013-07-11  4:15       ` Markus Trippelsdorf
2013-07-11  0:37 ` Stan Hoeppner
2013-07-11  3:47   ` Markus Trippelsdorf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130712023812.GB5228@dastard \
    --to=david@fromorbit.com \
    --cc=markus@trippelsdorf.de \
    --cc=stan@hardwarefreak.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox