mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [2.6.30 and later] file corruption on ext3 filesystem.
Date: Sat, 9 Jan 2010 02:19:15 +1100	[thread overview]
Message-ID: <20100108151915.GC8654@discord.disaster> (raw)
In-Reply-To: <201001082215.EJH52647.JLtFSFFVQOHMOO@I-love.SAKURA.ne.jp>

On Fri, Jan 08, 2010 at 10:15:10PM +0900, Tetsuo Handa wrote:
> Dave Chinner wrote:
> > On Fri, Jan 08, 2010 at 11:54:24AM +0900, Tetsuo Handa wrote:
> > > I'm experiencing file corruption problem.
> > > Can somebody reproduce below result?
> > > 
> > > My environment:
> > >   VMware Workstation 6.5.3 with 2CPUs / 512MB RAM.
> > >   ext3 filesystem ( /dev/sda1 ) mounted on / .
> > > 
> > >   2.6.33-rc3 ( http://I-love.SAKURA.ne.jp/tmp/config-2.6.33-rc3-ext3 )
> > >   2.6.32.3   ( http://I-love.SAKURA.ne.jp/tmp/config-2.6.32.3-ext3 )
> > >   2.6.31.11  ( http://I-love.SAKURA.ne.jp/tmp/config-2.6.31.11-ext3 )
> > >   2.6.30.10
> > > 
> > >   So far, I haven't succeeded to reproduce this problem for 2.6.29 and earlier.
> > >   Maybe this problem exists in only 2.6.30 and later.
> > 
> > Isn't that when the default mount options  changed from data=ordered to
> > data=writeback?
> Ah, indeed. 2.6.31 mounts data=writeback whereas 2.6.29 mounts data=ordered.
> 
> In my Ubuntu 9.10 environment, it is using data=writeback mode, and therefore
> I got garbage data taken from other deleted files.
> 
> > You didn't fsync() it, so there is no reason for the kernel
> > to have ever written it to disk. Therefore the result after powerfail
> > is completely undefined - you data may be there, it may not...
> 
> I didn't call fsync(). Thus, I don't mind if the data I wrote is not written
> to disk.

Ok, I was making sure you weren't misunderstanding what the fflush()
is supposed to guarantee - many people do, but you're not one of
them :)

> However, I feel something is very wrong because the file got data which I
> didn't write. The file gets data from deleted files. Imagine that unprivileged
> user can get the content of /etc/shadow if power failure occurred when the user
> was running ./a.out .

Ah, so it was stale data you were seeing.

> The file should not get data from deleted files, but I can read the data from
> deleted files by "cat /testfile". I feel something is very wrong.

I agree that it is very wrong, but it's a known problem with writeback
mode in ext3:

http://thread.gmane.org/gmane.linux.kernel/818044/focus=819977

More info as to how this change came about and the proposed but not
yet realised fixes:

http://lwn.net/Articles/328363/

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2010-01-08 15:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-08  2:54 Tetsuo Handa
2010-01-08  4:07 ` Jamie Lokier
2010-01-08 12:36 ` Dave Chinner
2010-01-08 13:15   ` Tetsuo Handa
2010-01-08 15:19     ` Dave Chinner [this message]
2010-01-09  2:53       ` Tetsuo Handa
2010-01-11 20:13         ` Ric Wheeler
2010-01-15 20:01           ` Pavel Machek

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=20100108151915.GC8654@discord.disaster \
    --to=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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

Powered by JetHome