public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Mingming Cao <cmm@us.ibm.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: When reading from fallocated blocks make sure we return zero.
Date: Mon, 18 Feb 2008 13:15:12 +0530	[thread overview]
Message-ID: <20080218074512.GA16067@skywalker> (raw)
In-Reply-To: <20080216032334.GA6501@skywalker>

On Sat, Feb 16, 2008 at 08:53:34AM +0530, Aneesh Kumar K.V wrote:
> On Fri, Feb 15, 2008 at 11:43:04AM -0800, Mingming Cao wrote:
> > On Fri, 2008-02-15 at 23:46 +0530, Aneesh Kumar K.V wrote:
> > > fallocate blocks are considered as sparse area and read from them should
> > > return zero. ext4_ext_get_blocks should return zero for read request.
> > > 
> > 
> > The patch itself looks harmless, but I still don't see how this could
> > fix the problem you described at irc: a write hit a BUG_ON() in
> > fs/buffer.c saying the buffer is not mapped. Could you add more details
> > here?
> 
> Write will take the below call chain
> 
> ext4_write_begin
>   block_write_begin
>     __block_prepare_write
>        ext4_getblock
>          ext4_get_blocks_wrap
> (1)	   ext4_ext_get_blocks with create = 0 return allocated
>        ll_rw_block  if buffer not uptodate.
>          submit_bh
> 	   BUG_ON(!buffer_mapped(bh))
> 
> 
> ext4_ext_get_blocks at (1) should have returned 0. That would cause
> ext4_get_blocks_wrap to again call ext4_ext_get_blocks with create = 1
> and that would have returned us the buffer head which is mapped. This
> would also result in splitting the extent to initialized and
> uninitialized one.
> 

The change is also needed to get mmap on fallocate space to work.

------------[ cut here ]------------
WARNING: at fs/buffer.c:1680 __block_write_full_page+0x101/0x2f1()
 Modules linked in:
 Pid: 2478, comm: mmaptest Not tainted 2.6.25-rc1 #12
  [<c0120e84>] warn_on_slowpath+0x41/0x51
  [<c0108c00>] ?  native_sched_clock+0x2d/0x9f
  [<c013b44e>] ?  __lock_acquire+0xacb/0xb13
  [<c013b44e>] ?  __lock_acquire+0xacb/0xb13
  [<c0180f97>] __block_write_full_page+0x101/0x2f1
  [<c01d053f>] ?  ext4_get_block+0x0/0xc0
  [<c018124f>] block_write_full_page+0xc8/0xd1
  [<c01d053f>] ?  ext4_get_block+0x0/0xc0
  [<c01d1a36>] ext4_ordered_writepage+0xad/0x146
  [<c01cec12>] ? bget_one+0x0/0xb
  [<c014c5dd>] __writepage+0xb/0x25
  [<c014cab2>] write_cache_pages+0x180/0x287
  [<c014c5d2>] ? __writepage+0x0/0x25
  [<c01527d5>] ?  __do_fault+0x2e2/0x324
  [<c0147889>] ? unlock_page+0x25/0x28 
  [<c014cbd6>] generic_writepages+0x1d/0x27
  [<c014cc0c>] do_writepages+0x2c/0x34
  [<c0147fe1>] __filemap_fdatawrite_range+0x5b/0x67
  [<c01481ba>] filemap_fdatawrite+0x15/0x17
  [<c017ea3d>] do_fsync+0x2c/0x9a
  [<c017eacb>] __do_fsync+0x20/0x2f
  [<c017eaf9>] sys_fsync+0xd/0xf
  [<c0104992>] sysenter_past_esp+0x5f/0xa5
  =======================
 ---[ end trace 5ba60b430e0af601 ]---


-aneesh

  reply	other threads:[~2008-02-18  7:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15 18:16 [PATCH] ext4: When reading from fallocated blocks make sure we return zero Aneesh Kumar K.V
2008-02-15 19:43 ` Mingming Cao
2008-02-16  3:23   ` Aneesh Kumar K.V
2008-02-18  7:45     ` Aneesh Kumar K.V [this message]
2008-02-19  0:14     ` Mingming Cao
2008-02-19  3:19       ` Aneesh Kumar K.V
2008-02-19  5:24         ` Mingming Cao

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=20080218074512.GA16067@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --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