From: Jan Kara <jack@suse.cz>
To: Dave Chinner <david@fromorbit.com>
Cc: Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org,
Ross Zwisler <ross.zwisler@linux.intel.com>,
Dan Williams <dan.j.williams@intel.com>,
"Wilcox, Matthew R" <matthew.r.wilcox@intel.com>
Subject: Re: DAX data corruption for mmaped and written files
Date: Thu, 31 Mar 2016 15:47:21 +0200 [thread overview]
Message-ID: <20160331134721.GA10434@quack.suse.cz> (raw)
In-Reply-To: <20160328223916.GB30721@dastard>
On Tue 29-03-16 09:39:16, Dave Chinner wrote:
> On Thu, Mar 24, 2016 at 02:12:23PM +0100, Jan Kara wrote:
> > Hello,
> >
> > yesterday I have been stress-testing mmap code with my new fault locking
> > patches and I have found a data corruption issue when file is written both
> > via mmap and standard write(2). The problem is following:
> >
> > CPU1 CPU2
> > dax_io() dax_fault()
> > get_block() - allocates block
> > ... get_block() - finds allocated block
> > - zeroes it inside fs
> > fault completese
> >
> > if (buffer_unwritten(bh) || buffer_new(bh)) -> new buffer
> > dax_new_buf() -> zeroes buffer which may
> > overwrite user data
>
> Which filesystem? XFS should be, in both cases, zeroing the
> block entirely inside get_block() when it is first allocated. i.e we
> should see:
>
> CPU1 CPU2
> dax_io() dax_fault()
> get_block() - allocates block
> - zeroes it inside fs
> ... get_block() - finds allocated block
> fault completes
>
> buffer returned is not new or unwritten.
>
>
> > In some cases the race can also go the other way around and we lose data
> > written by write.
Yeah, correct. This is ext4 specific issue because ext4 doesn't return
prezeroed blocks from get_block() callback used for dax_io().
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
prev parent reply other threads:[~2016-04-04 8:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-24 13:12 DAX data corruption for mmaped and written files Jan Kara
2016-03-24 22:37 ` Ross Zwisler
2016-03-28 22:39 ` Dave Chinner
2016-03-31 13:47 ` Jan Kara [this message]
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=20160331134721.GA10434@quack.suse.cz \
--to=jack@suse.cz \
--cc=dan.j.williams@intel.com \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=matthew.r.wilcox@intel.com \
--cc=ross.zwisler@linux.intel.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;
as well as URLs for NNTP newsgroup(s).