From: Mingming <cmm@us.ibm.com>
To: Theodore Tso <tytso@mit.edu>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
sandeen@redhat.com, linux-ext4@vger.kernel.org
Subject: Re: [RFC PATCH] mark buffer_head mapping preallocate area as new during write_begin with delayed allocation
Date: Tue, 28 Apr 2009 18:38:31 -0700 [thread overview]
Message-ID: <1240969111.5583.33.camel@BVR-FS.beaverton.ibm.com> (raw)
In-Reply-To: <20090428170047.GC24043@mit.edu>
On Tue, 2009-04-28 at 13:00 -0400, Theodore Tso wrote:
> On Tue, Apr 28, 2009 at 10:05:54PM +0530, Aneesh Kumar K.V wrote:
> > On Tue, Apr 28, 2009 at 08:48:21AM -0400, Theodore Tso wrote:
> > > On Tue, Apr 28, 2009 at 03:01:45PM +0530, Aneesh Kumar K.V wrote:
> > > >
> > > > Looking at the source again i guess setting just b_dev is not enough.
> > > > unmap_underlying_metadata looks at the mapping block number, which we
> > > > don't have in case on unwritten buffer_head. How about the below patch ?
> > > > It involve vfs changes. But i guess it is correct with respect to the
> > > > meaning of BH_New (Disk mapping was newly created by get_block). I guess
> > > > BH_New implies BH_Mapped.
> > >
> > > Argh. So we have multiple problems going on here. One is the
> > > original problem, namely that of a partial write into an preallocated
> > > block can leave garbage behind in that unitialized block.
> > >
> > > The other problem seems to be in the case of a delayed allocation
> > > write, where we return a buffer_head which is marked new, and this
> > > causes block_prepare_write() to call unmap_underlying_metadata(dev, 0).
> >
> > Not just that. On block allocation we are not calling
> > unmap_underlying_metadata(dev, blocknumber) for delayed allocated
> > blocks. That would imply file corruption.
>
> I don't think I'm following you . If we write into block that was
> delayed allocated. Are you saying we might get in trouble of the
> delayed allocation block is mmap'ed in?
>
> > The original reported problem is something really easy to reproduce. So
> > i guess if we can have a ext4 local change that would fix the original
> > problem that would be good. Considering that map_bh(bdev, 0) didn't
> > create any issues till now, what we can do is to do a similar update
> > for unwritten_buffer in ext4_da_block_write_prep. That's the v2 version
> > of the patch with the below addition
> > bh_result->b_blocknr = 0;
>
> OK, I can put togehter a patch to do this. Whatever we do, I think
> we're going to need a *lot* of testing.
>
> - Ted
Aneesh, Eric and I discussed this online today, we find a separate
issue, the lookup on the preallocated extent doesn't set the
buffer_mapped(), so loop up/write to the same preallocated block
multiple times (e.g. write 1 byte at a time, for 10 bytes total) will
end up calling ext4_get_blocks_wrap() multiple times.
It seems reasonable to set the buffer mapped for preallocated buffer,
with blocknr set to the real mapped block number (rather than faked -1
for the buffer blocknr in the V3 proposed fix for partial write garbage
issue), and later reply on unwritten flag to force the
writepage()/mpage_da_map_blocks calls get_block() to do the unintialized
extent split. But this change seems require more thoughts and heavy
auditing, and not as urgency as the data corruption problem.
Mingming
next prev parent reply other threads:[~2009-04-29 1:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 19:05 [RFC PATCH] mark buffer_head mapping preallocate area as new during write_begin with delayed allocation Aneesh Kumar K.V
2009-04-27 19:30 ` Eric Sandeen
2009-04-27 23:04 ` Mingming Cao
2009-04-28 3:03 ` Eric Sandeen
2009-04-28 4:20 ` Aneesh Kumar K.V
2009-04-28 9:31 ` Aneesh Kumar K.V
2009-04-28 12:48 ` Theodore Tso
2009-04-28 16:35 ` Aneesh Kumar K.V
2009-04-28 17:00 ` Theodore Tso
2009-04-28 18:57 ` Aneesh Kumar K.V
2009-04-28 19:35 ` Eric Sandeen
2009-04-29 11:57 ` Jan Kara
2009-04-29 14:08 ` Eric Sandeen
2009-04-29 18:13 ` Jan Kara
2009-04-29 1:38 ` Mingming [this message]
2009-04-28 16:37 ` Eric Sandeen
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=1240969111.5583.33.camel@BVR-FS.beaverton.ibm.com \
--to=cmm@us.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=tytso@mit.edu \
/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).