All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: bugzilla-daemon@bugzilla.kernel.org
Cc: linux-ext4@vger.kernel.org, Lukas Czerner <lczerner@redhat.com>
Subject: Re: [Bug 25352] New: resizing ext4 will corrupt filesystem
Date: Mon, 20 Dec 2010 22:32:09 -0500	[thread overview]
Message-ID: <20101221033209.GA6924@thunk.org> (raw)
In-Reply-To: <bug-25352-13602@https.bugzilla.kernel.org/>

[-- Attachment #1: Type: text/plain, Size: 708 bytes --]

On Mon, Dec 20, 2010 at 08:56:46PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> 
> Using resize2fs on an ext4 will result in a corrupted filesystem. This is a
> regression (obviously).

Yes, this is a regression new to 2.6.37-rc1, which was introduced by
commit a31437b85: ext4: use sb_issue_zeroout in setup_new_group_blocks.

When we replaced the loop zero'ing the inode table blocks with
sb_issue_zeroout, we accidentally also removed this little tidbit:

-               ext4_set_bit(bit, bh->b_data);

... which was responsible for setting the block allocation bitmap to
reserve the block descriptor blocks and inode table blocks.  Oops...

I believe this patch should fix things.

						- Ted



[-- Attachment #2: 0001-ext4-fix-on-line-resizing-regression.patch --]
[-- Type: text/x-diff, Size: 1447 bytes --]

>From 2bd0b6de26c463f15ad6b72a6679ca60ce45a827 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Mon, 20 Dec 2010 22:30:36 -0500
Subject: [PATCH] ext4: fix on-line resizing regression

https://bugzilla.kernel.org/show_bug.cgi?id=25352

This regression was caused by commit a31437b85: "ext4: use
sb_issue_zeroout in setup_new_group_blocks", by accidentally dropping
the code which reserved the block group descriptor and inode table
blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 fs/ext4/resize.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index dc96392..981c847 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -232,6 +232,8 @@ static int setup_new_group_blocks(struct super_block *sb,
 			       GFP_NOFS);
 	if (err)
 		goto exit_bh;
+	for (i = 0, bit = gdblocks + 1; i < reserved_gdb; i++, bit++)
+		ext4_set_bit(bit, bh->b_data);
 
 	ext4_debug("mark block bitmap %#04llx (+%llu)\n", input->block_bitmap,
 		   input->block_bitmap - start);
@@ -247,6 +249,9 @@ static int setup_new_group_blocks(struct super_block *sb,
 	err = sb_issue_zeroout(sb, block, sbi->s_itb_per_group, GFP_NOFS);
 	if (err)
 		goto exit_bh;
+	for (i = 0, bit = input->inode_table - start;
+	     i < sbi->s_itb_per_group; i++, bit++)
+		ext4_set_bit(bit, bh->b_data);
 
 	if ((err = extend_or_restart_transaction(handle, 2, bh)))
 		goto exit_bh;
-- 
1.7.3.1


  parent reply	other threads:[~2010-12-21  3:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20 20:56 [Bug 25352] New: resizing ext4 will corrupt filesystem bugzilla-daemon
2010-12-20 20:57 ` [Bug 25352] " bugzilla-daemon
2010-12-21  3:32 ` Ted Ts'o [this message]
2010-12-21 12:28   ` [Bug 25352] New: " Lukas Czerner
2010-12-21  3:33 ` [Bug 25352] " bugzilla-daemon
2010-12-21  4:05 ` bugzilla-daemon
2010-12-21  4:26 ` bugzilla-daemon
2010-12-21 12:31 ` bugzilla-daemon
2010-12-21 13:10 ` bugzilla-daemon
2010-12-21 14:19 ` bugzilla-daemon
2010-12-21 18:03 ` bugzilla-daemon
2010-12-21 19:19 ` bugzilla-daemon
2010-12-21 22:32 ` bugzilla-daemon
2010-12-24 13:38 ` bugzilla-daemon
2010-12-24 13:40 ` bugzilla-daemon
2010-12-30 13:47 ` bugzilla-daemon
2010-12-30 14:12 ` bugzilla-daemon
2011-03-30 21:59 ` bugzilla-daemon
2011-03-31 16:26 ` bugzilla-daemon
2011-03-31 16:43 ` bugzilla-daemon
2011-03-31 19:24 ` bugzilla-daemon

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=20101221033209.GA6924@thunk.org \
    --to=tytso@mit.edu \
    --cc=bugzilla-daemon@bugzilla.kernel.org \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.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 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.