Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Chris Mason <clmason@fusionio.com>
To: Alexandre Oliva <oliva@gnu.org>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: Re: corruption of active mmapped files in btrfs snapshots
Date: Tue, 19 Mar 2013 08:09:40 -0400	[thread overview]
Message-ID: <20130319120940.29898.80124@localhost.localdomain> (raw)
In-Reply-To: <orzjy0dkz9.fsf@livre.home>

Quoting Alexandre Oliva (2013-03-19 01:20:10)
> On Mar 18, 2013, Chris Mason <chris.mason@fusionio.com> wrote:
> 
> > A few questions.  Does leveldb use O_DIRECT and mmap together?
> 
> No, it doesn't use O_DIRECT at all.  Its I/O interface is very
> simplified: it just opens each new file (database chunks limited to 2MB)
> with O_CREAT|O_RDWR|O_TRUNC, and then uses ftruncate, mmap, msync,
> munmap and fdatasync.  It doesn't seem to modify data once it's written;
> it only appends.  Reading data back from it uses a completely different
> class interface, using separate descriptors and using pread only.
> 
> > (the source of a write being pages that are mmap'd from somewhere
> > else)
> 
> AFAICT the source of the memcpy()s that append to the file are
> malloc()ed memory.
> 
> > That's the most likely place for this kind of problem.  Also, you
> > mention crc errors.  Are those reported by btrfs or are they application
> > level crcs.
> 
> These are CRCs leveldb computes and writes out after each db block.  No
> btrfs CRC errors are reported in this process.

Ok, so we have three moving pieces here.

1) leveldb truncating the files
2) leveldb using mmap to write
3) btrfs snapshots

My guess is the truncate is creating a orphan item that is being
processed inside the snapshot.

Is it possible to create a smaller leveldb unit test that we might use
to exercise all of this?

-chris


  reply	other threads:[~2013-03-19 12:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18 21:14 corruption of active mmapped files in btrfs snapshots Alexandre Oliva
2013-03-18 22:43 ` Alexandre Oliva
2013-03-18 22:52 ` Chris Mason
2013-03-19  5:20   ` Alexandre Oliva
2013-03-19 12:09     ` Chris Mason [this message]
2013-03-19 17:29       ` Sage Weil
2013-03-19 19:26         ` Alexandre Oliva
2013-03-19 19:26       ` Alexandre Oliva
2013-03-20  1:58         ` Alexandre Oliva
2013-03-21  7:14           ` Alexandre Oliva
2013-03-21 18:06             ` Chris Mason
2013-03-21 23:06               ` Chris Mason
2013-03-22  5:27                 ` Alexandre Oliva
2013-03-22 12:07                   ` Chris Mason
2013-03-22 14:17                     ` Alexandre Oliva
2013-03-22 14:26                       ` Chris Mason
2013-03-22 17:06                         ` Samuel Just
2013-03-22 17:12                           ` Chris Mason
2013-03-23  9:47                             ` Alexandre Oliva
2013-03-22 17:08                         ` David Sterba
2013-03-23  9:48                           ` Alexandre Oliva
2013-03-25 15:33                             ` David Sterba
2013-03-22 17:18                         ` Sage Weil
2013-03-22 18:07 ` Chris Mason
2013-03-22 20:31   ` Chris Mason
2013-03-26  0:08     ` Chris Mason
2013-03-29  9:56       ` Alexandre Oliva
2013-03-29 11:35         ` Chris Mason

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=20130319120940.29898.80124@localhost.localdomain \
    --to=clmason@fusionio.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=oliva@gnu.org \
    /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