From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] e2fsprogs: allocate inode table wholly within group
Date: Mon, 08 Jul 2013 16:27:21 -0500 [thread overview]
Message-ID: <51DB2EB9.4010903@redhat.com> (raw)
In-Reply-To: <51D3269B.5080608@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]
Ok, resetting a little on this one.
The actual problem seems to be that the test does successive "-M" minimal resizes, and eventually we resize into the middle of an inode table, leaving the end of the table beyond the fs.
Point "resize2fs -M" at the attached image once or twice w/ fscks in between and you should see it.
It seems like the obvious fix would be to move the inode table if necessary, as with the following patch.
But then of course we find that we've run out of room to move the table, and the resize fails; so we've let resize2fs choose its own minimum size - which which it cannot handle. Presumably something's gone wrong in calculate_minimum_resize_size(), though I can't tell what.
Truth be told, I'm not enjoying resize2fs right now!
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 204b10a..27dc5e6 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -891,18 +891,25 @@ static errcode_t blocks_to_move(ext2_resize_t rfs)
new_size = ext2fs_blocks_count(fs->super);
if (new_size < ext2fs_blocks_count(old_fs->super)) {
for (g = 0; g < fs->group_desc_count; g++) {
+ int realloc = 0;
/*
* ext2fs_allocate_group_table re-allocates bitmaps
* which are set to block 0.
*/
if (ext2fs_block_bitmap_loc(fs, g) >= new_size) {
ext2fs_block_bitmap_loc_set(fs, g, 0);
- retval = ext2fs_allocate_group_table(fs, g, 0);
- if (retval)
- return retval;
+ realloc = 1;
}
if (ext2fs_inode_bitmap_loc(fs, g) >= new_size) {
ext2fs_inode_bitmap_loc_set(fs, g, 0);
+ realloc = 1;
+ }
+ if (ext2fs_inode_table_loc(fs, g) + fs->inode_blocks_per_group > new_size) {
+ ext2fs_inode_table_loc_set(fs, g, 0);
+ realloc = 1;
+ }
+
+ if (realloc) {
retval = ext2fs_allocate_group_table(fs, g, 0);
if (retval)
return retval;
[-- Attachment #2: test.img.bz2 --]
[-- Type: application/x-bzip, Size: 1553 bytes --]
next prev parent reply other threads:[~2013-07-08 21:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-02 19:14 [PATCH] e2fsprogs: allocate inode table wholly within group Eric Sandeen
2013-07-04 14:19 ` [PATCH] e2fsprogs FTBFS: " Eric Sandeen
2013-07-07 15:53 ` [PATCH] e2fsprogs: " Theodore Ts'o
2013-07-07 23:34 ` Theodore Ts'o
2013-07-08 1:59 ` Eric Sandeen
2013-07-08 18:34 ` Eric Sandeen
2013-07-08 21:27 ` Eric Sandeen [this message]
2013-10-01 1:57 ` Theodore Ts'o
2013-10-01 3:59 ` [PATCH 1/4] resize2fs: add debugging support for resize2fs -M calcuations Theodore Ts'o
2013-10-01 3:59 ` [PATCH 2/4] resize2fs: fix -M size calculations to avoid cutting off the inode table Theodore Ts'o
2013-10-01 3:59 ` [PATCH 3/4] resize2fs: relocate inode table blocks if necessary when shrinking Theodore Ts'o
2013-10-01 3:59 ` [PATCH 4/4] tests: add test for resize2fs -M with inode table in middle of block group Theodore Ts'o
2013-10-01 15:26 ` [PATCH] e2fsprogs: allocate inode table wholly within group Eric Sandeen
2013-10-01 15:35 ` Eric Sandeen
2013-10-01 16:29 ` 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=51DB2EB9.4010903@redhat.com \
--to=sandeen@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 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).