All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: Tao Ma <tm@tao.ma>
Cc: linux-ext4@vger.kernel.org, Greg Kroah-Hartman <greg@kroah.com>,
	Xiaoyun Mao <xiaoyun.maoxy@aliyun-inc.com>,
	Yingbin Wang <yingbin.wangyb@aliyun-inc.com>,
	Jia Wan <jia.wanj@aliyun-inc.com>
Subject: Re: [PATCH] ext4: fix BUG_ON() in ext4_ext_insert_extent()
Date: Thu, 27 Oct 2011 05:43:29 -0400	[thread overview]
Message-ID: <20111027094329.GB31921@thunk.org> (raw)
In-Reply-To: <1317206703-5604-1-git-send-email-tm@tao.ma>

On Wed, Sep 28, 2011 at 06:45:03PM +0800, Tao Ma wrote:
> actually this bug does show up in 2.6.39 and I think stable tree still
> needs this fix. After some careful test, my colleague has generated
> the patch. Please considering ack it so that Greg can add it into the
> stable tree.

Sorry for the delay, but yes.  This patch would be good for the stable
tree for 2.6.39 (if Greg is still accepting patches for
2.6.39-stable).  It doesn't apply for upstream ext4 since the code has
been changed/refactored since then, but it's a good fix.

     			      	    	- Ted

> From 600d493b14ebd776cf8ea0e9dcdccc0d54200403 Mon Sep 17 00:00:00 2001
> From: Zheng Liu <wenqing.lz@taobao.com>
> Date: Wed, 28 Sep 2011 16:26:05 +0800
> Subject: [PATCH] ext4: fix BUG_ON() in ext4_ext_insert_extent()
> 
> We will meet with a BUG_ON() if following script is run.
> 
> mkfs.ext4 -b 4096 /dev/sdb1 1000000
> mount -t ext4 /dev/sdb1 /mnt/sdb1
> fallocate -l 100M /mnt/sdb1/test
> sync
> for((i=0;i<170;i++))
> do
>         dd if=/dev/zero of=/mnt/sdb1/test conv=notrunc bs=256k count=1 seek=`expr $i \* 2`
> done
> umount /mnt/sdb1
> mount -t ext4 /dev/sdb1 /mnt/sdb1
> dd if=/dev/zero of=/mnt/sdb1/test conv=notrunc bs=256k count=1 seek=341
> umount /mnt/sdb1
> mount /dev/sdb1 /mnt/sdb1
> dd if=/dev/zero of=/mnt/sdb1/test conv=notrunc bs=256k count=1 seek=340
> sync
> 
> The reason is that it forgot to mark dirty when splitting two extents in
> ext4_ext_convert_to_initialized(). Althrough ex has been updated in memory,
> it is not dirtied both in ext4_ext_convert_to_initialized() and
> ext4_ext_insert_extent(). The disk layout is corrupted. Then it will meet with
> a BUG_ON() when writting at the start of that extent again.
> 
> Cc: stable@kernel.org #for 2.6.39
> Cc: Greg Kroah-Hartman <greg@kroah.com>
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> Cc: Xiaoyun Mao <xiaoyun.maoxy@aliyun-inc.com>
> Cc: Yingbin Wang <yingbin.wangyb@aliyun-inc.com>
> Cc: Jia Wan <jia.wanj@aliyun-inc.com>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> ---
>  fs/ext4/extents.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 4890d6f..cd20425 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -2607,6 +2607,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
>  		ex1 = ex;
>  		ex1->ee_len = cpu_to_le16(map->m_lblk - ee_block);
>  		ext4_ext_mark_uninitialized(ex1);
> +		ext4_ext_dirty(handle, inode, path + depth);
>  		ex2 = &newex;
>  	}
>  	/*
> -- 
> 1.7.4.1
> 

  reply	other threads:[~2011-10-27  9:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-06  7:24 ext4 BUG in dom0 Kernel 2.6.32.36 MaoXiaoyun
2011-09-06  7:24 ` MaoXiaoyun
2011-09-06 11:33 ` MaoXiaoyun
2011-09-06 11:33   ` MaoXiaoyun
2011-09-06 14:53 ` Konrad Rzeszutek Wilk
2011-09-06 15:11   ` MaoXiaoyun
2011-09-06 15:11     ` MaoXiaoyun
2011-09-06 18:55     ` [Xen-devel] " Jeremy Fitzhardinge
2011-09-07  2:35       ` MaoXiaoyun
2011-09-07  2:35         ` MaoXiaoyun
2011-09-16  6:08         ` MaoXiaoyun
2011-09-16  6:08           ` MaoXiaoyun
2011-09-25  8:45           ` [patch 1/1] ext4-fix-dirty-extent-when-origin-leaf-extent-reac.patch MaoXiaoyun
2011-09-25  8:45             ` MaoXiaoyun
2011-09-26 14:28             ` Konrad Rzeszutek Wilk
2011-09-27  2:22               ` MaoXiaoyun
2011-09-27  2:22                 ` MaoXiaoyun
2011-09-27  9:09                 ` [Xen-devel] " Jan Beulich
2011-09-27  9:09                   ` Jan Beulich
2011-09-27  9:54                   ` Tao Ma
2011-09-27 19:35               ` Ted Ts'o
2011-09-27 23:41                 ` Olivier B.
2011-09-28 12:47                   ` Konrad Rzeszutek Wilk
2011-09-28  4:09                 ` MaoXiaoyun
2011-09-28  4:09                   ` MaoXiaoyun
2011-09-28 10:45                 ` [PATCH] ext4: fix BUG_ON() in ext4_ext_insert_extent() Tao Ma
2011-10-27  9:43                   ` Ted Ts'o [this message]
2011-10-27 11:53                     ` Greg KH
2011-10-28  2:36                       ` Zheng Liu
2011-10-28  5:24                         ` Greg KH
2011-10-28  8:46                           ` Zheng Liu
2011-10-28  9:07                             ` Greg KH
2011-10-28 12:34                               ` [PATCH] ext4: fix BUG_ON() in ext4_ext_insert_extent() for .32 longterm Zheng Liu
2011-11-02 21:00                                 ` Greg KH
2011-11-03  3:06                                   ` Zheng Liu
2011-11-03 17:42                                     ` Greg KH
2011-10-28 12:36                               ` [PATCH] ext4: fix BUG_ON() in ext4_ext_insert_extent() for .33 longterm Zheng Liu
2011-09-28 18:41                 ` [Xen-devel] Re: [patch 1/1] ext4-fix-dirty-extent-when-origin-leaf-extent-reac.patch Jeremy Fitzhardinge
2011-09-28 19:46                   ` Ted Ts'o

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=20111027094329.GB31921@thunk.org \
    --to=tytso@mit.edu \
    --cc=greg@kroah.com \
    --cc=jia.wanj@aliyun-inc.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tm@tao.ma \
    --cc=xiaoyun.maoxy@aliyun-inc.com \
    --cc=yingbin.wangyb@aliyun-inc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.