2009-01-31 05:25:42

by Theodore Ts'o

[permalink] [raw]
Subject: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

I've updated the ext4 backport branches on the ext4 git tree:

git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
http://git.kernel.org/?p=linux/kernel/git/tytso/ext4.git

The for-stable branch is branched off of 2.6.28.2, and has a candidate
set of patches to be included in the next stable release. The
for-stable-2.6.27 branch is branched off of 2.6.27.13.

I'm more confident with the 2.6.28 stable candidate than the 2.6.27
stable candidates at the moment, but given that we just missed the
2.6.27.14 and 2.6.28.3 release cycles, that should give us plenty of
time to test the patches.

- Ted


mainline 2.6.28 2.6.27
commit-description
-------------------------------------------------------------------------
f99b2589 99186e9 50137b9b
ext4: Add support for non-native signed/unsigned htree hash algorithms

2a21e37e a24d2c3 c6ee3785
ext4: tone down ext4_da_writepages warnings

791b7f08 09dd336 20a5992c
ext4: Fix the delalloc writepages to allocate blocks at the right offset.

565a9617 98da3f7 8fac34d1
ext4: avoid ext4_error when mounting a fs with a single bg

ff7ef329 d77464d a3d3507c
ext4: Widen type of ext4_sb_info.s_mb_maxs[]

fd98496f 956559e d0c7cd8e
jbd2: Add barrier not supported test to journal_wait_on_commit_record

032115fc faa39cf 672ccd67
ext4: Don't overwrite allocation_context ac_status

e21675d4 f45872d 44e83b40
ext4: Add blocks added during resize to bitmap

920313a7 36a926a de7c44e7
ext4: Use EXT4_GROUP_INFO_NEED_INIT_BIT during resize

c3a326a6 34bb72b d0bbe797
ext4: cleanup mballoc header files

c894058d ----- 71ae3e25
ext4: Use an rbtree for tracking blocks freed during transaction.

7a2fcbf7 cbf340c c71f2a67
ext4: don't use blocks freed but not yet committed in buddy cache init

e8134b27 8e5ffb2 0d047b2d
ext4: Fix race between read_block_bitmap() and mark_diskspace_used()

39341867 2298c89 78114d26
ext4: Fix the race between read_inode_bitmap() and ext4_new_inode()

e97fcd95 469496b b04246c8
jbd2: Add BH_JBDPrivateStart

2ccb5fb9 bfb49c0 bf79ca1d
ext4: Use new buffer_head flag to check uninit group bitmaps initialization

648f5879 08d0947 ba08e9a6
ext4: mark the blocks/inode bitmap beyond end of group as used

8556e8f3 18d5cb0 fd3bd090
ext4: Don't allow new groups to be added during block allocation

29eaf024 a38467c fb8c1296
ext4: Init the complete page while building buddy cache

0087d9fb 462dbdb -----
ext4: Fix s_dirty_blocks_counter if block allocation failed with nodelalloc

4ec11028 c457db2 850eb20e
ext4: Add sanity checks for the superblock before mounting the filesystem

06a279d6 cd676b5 713e7106
ext4: only use i_size_high for regular files

e6b8bc09 4a81724 312eaf17
ext4: Add sanity check to make_indexed_dir

a21102b5 1b1872b 0f30c439
ext3: Add sanity check to make_indexed_dir

08ec8c38 a062e44 2ea34131
jbd2: On a __journal_expect() assertion failure printk "JBD2", not "EXT3-fs"

fdff73f0 e041093 b86f4c8d
ext4: Initialize the new group descriptor when resizing the filesystem



2009-02-10 23:38:56

by Chuck Ebbert

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

On Sat, 31 Jan 2009 00:25:39 -0500
"Theodore Ts'o" <[email protected]> wrote:

> I've updated the ext4 backport branches on the ext4 git tree:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
> http://git.kernel.org/?p=linux/kernel/git/tytso/ext4.git
>
> The for-stable branch is branched off of 2.6.28.2, and has a candidate
> set of patches to be included in the next stable release. The
> for-stable-2.6.27 branch is branched off of 2.6.27.13.
>
> I'm more confident with the 2.6.28 stable candidate than the 2.6.27
> stable candidates at the moment, but given that we just missed the
> 2.6.27.14 and 2.6.28.3 release cycles, that should give us plenty of
> time to test the patches.
>

.27 has a bug and one patch got merged in .27.14...

>
> mainline 2.6.28 2.6.27
> commit-description
> -------------------------------------------------------------------------
> c894058d ----- 71ae3e25
> ext4: Use an rbtree for tracking blocks freed during transaction.
>

The chunk that creates the ext4_free_block_extents cache is misapplied: it
ended up at the end of ext4_mb_use_preallocated() instead of
init_ext4_mballoc(). The null cache pointer then causes oopses when trying
to delete files.

> a21102b5 1b1872b 0f30c439
> ext3: Add sanity check to make_indexed_dir
>

This went into 2.6.27.14.

2009-02-11 07:59:26

by Aneesh Kumar K.V

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

On Sat, Jan 31, 2009 at 12:25:39AM -0500, Theodore Ts'o wrote:
> I've updated the ext4 backport branches on the ext4 git tree:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
> http://git.kernel.org/?p=linux/kernel/git/tytso/ext4.git
>
> The for-stable branch is branched off of 2.6.28.2, and has a candidate
> set of patches to be included in the next stable release. The
> for-stable-2.6.27 branch is branched off of 2.6.27.13.
>
> I'm more confident with the 2.6.28 stable candidate than the 2.6.27
> stable candidates at the moment, but given that we just missed the
> 2.6.27.14 and 2.6.28.3 release cycles, that should give us plenty of
> time to test the patches.
>
> - Ted
>
>
> 8556e8f3 18d5cb0 fd3bd090
> ext4: Don't allow new groups to be added during block allocation
>

This commit on for-stable-2.6.27 is not complete.
ac->alloc_semp is not assigned in the code.

-aneesh

2009-02-11 20:36:02

by Chuck Ebbert

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

On Wed, 11 Feb 2009 13:29:14 +0530
"Aneesh Kumar K.V" <[email protected]> wrote:

> On Sat, Jan 31, 2009 at 12:25:39AM -0500, Theodore Ts'o wrote:
> > I've updated the ext4 backport branches on the ext4 git tree:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
> > http://git.kernel.org/?p=linux/kernel/git/tytso/ext4.git
> >
> > The for-stable branch is branched off of 2.6.28.2, and has a candidate
> > set of patches to be included in the next stable release. The
> > for-stable-2.6.27 branch is branched off of 2.6.27.13.
> >
> > I'm more confident with the 2.6.28 stable candidate than the 2.6.27
> > stable candidates at the moment, but given that we just missed the
> > 2.6.27.14 and 2.6.28.3 release cycles, that should give us plenty of
> > time to test the patches.
> >
> > - Ted
> >
> >
> > 8556e8f3 18d5cb0 fd3bd090
> > ext4: Don't allow new groups to be added during block allocation
> >
>
> This commit on for-stable-2.6.27 is not complete.
> ac->alloc_semp is not assigned in the code.
>

I think this fixes that one:


Add missing pieces to the below patch in the 2.6.27 ext4 patchset.
http://git.kernel.org/?p=linux/kernel/git/tytso/ext4.git;a=commitdiff;h=fd3bd090d7cc93292d3fa361b9c323752417bd7b
"ext4: Don't allow new groups to be added during block allocation"

Signed-off-by: Chuck Ebbert <[email protected]>

Index: linux-2.6.27.noarch/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.27.noarch.orig/fs/ext4/mballoc.c
+++ linux-2.6.27.noarch/fs/ext4/mballoc.c
@@ -1055,7 +1055,8 @@ static void ext4_mb_release_desc(struct
if (e4b->bd_buddy_page)
page_cache_release(e4b->bd_buddy_page);
/* Done with the buddy cache */
- up_read(e4b->alloc_semp);
+ if (e4b->alloc_semp)
+ up_read(e4b->alloc_semp);
}


@@ -1375,6 +1376,9 @@ static void ext4_mb_use_best_found(struc
get_page(ac->ac_bitmap_page);
ac->ac_buddy_page = e4b->bd_buddy_page;
get_page(ac->ac_buddy_page);
+ /* on allocation we use ac to track the held semaphore */
+ ac->alloc_semp = e4b->alloc_semp;
+ e4b->alloc_semp = NULL;
/* store last allocated for subsequent stream allocation */
if ((ac->ac_flags & EXT4_MB_HINT_DATA)) {
spin_lock(&sbi->s_md_lock);

2009-02-11 20:40:17

by Chuck Ebbert

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

On Tue, 10 Feb 2009 18:36:02 -0500
Chuck Ebbert <[email protected]> wrote:

> On Sat, 31 Jan 2009 00:25:39 -0500
> "Theodore Ts'o" <[email protected]> wrote:
>
> > I've updated the ext4 backport branches on the ext4 git tree:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
> > http://git.kernel.org/?p=linux/kernel/git/tytso/ext4.git
> >
> > The for-stable branch is branched off of 2.6.28.2, and has a candidate
> > set of patches to be included in the next stable release. The
> > for-stable-2.6.27 branch is branched off of 2.6.27.13.
> >
> > I'm more confident with the 2.6.28 stable candidate than the 2.6.27
> > stable candidates at the moment, but given that we just missed the
> > 2.6.27.14 and 2.6.28.3 release cycles, that should give us plenty of
> > time to test the patches.
> >
>
> .27 has a bug and one patch got merged in .27.14...
>
> >
> > mainline 2.6.28 2.6.27
> > commit-description
> > -------------------------------------------------------------------------
> > c894058d ----- 71ae3e25
> > ext4: Use an rbtree for tracking blocks freed during transaction.
> >
>
> The chunk that creates the ext4_free_block_extents cache is misapplied: it
> ended up at the end of ext4_mb_use_preallocated() instead of
> init_ext4_mballoc(). The null cache pointer then causes oopses when trying
> to delete files.
>

Here's the fix for that:


Move init of the ext4_free_block_extents cache to the right place.
Original patch that misapplies this is at:
http://git.kernel.org/?p=linux/kernel/git/tytso/ext4.git;a=commitdiff;h=71ae3e256af82b77100bd2e7392fd510aca0b8b9
"ext4: Use an rbtree for tracking blocks freed during transaction."

Signed-off-by: Chuck Ebbert <[email protected]>

Index: linux-2.6.27.noarch/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.27.noarch.orig/fs/ext4/mballoc.c
+++ linux-2.6.27.noarch/fs/ext4/mballoc.c
@@ -3060,6 +3060,16 @@ int __init init_ext4_mballoc(void)
kmem_cache_destroy(ext4_pspace_cachep);
return -ENOMEM;
}
+
+ ext4_free_ext_cachep =
+ kmem_cache_create("ext4_free_block_extents",
+ sizeof(struct ext4_free_data),
+ 0, SLAB_RECLAIM_ACCOUNT, NULL);
+ if (ext4_free_ext_cachep == NULL) {
+ kmem_cache_destroy(ext4_pspace_cachep);
+ kmem_cache_destroy(ext4_ac_cachep);
+ return -ENOMEM;
+ }
#ifdef CONFIG_PROC_FS
proc_root_ext4 = proc_mkdir("fs/ext4", NULL);
if (proc_root_ext4 == NULL)
@@ -3597,15 +3607,6 @@ ext4_mb_use_preallocated(struct ext4_all
return 1;
}

- ext4_free_ext_cachep =
- kmem_cache_create("ext4_free_block_extents",
- sizeof(struct ext4_free_data),
- 0, SLAB_RECLAIM_ACCOUNT, NULL);
- if (ext4_free_ext_cachep == NULL) {
- kmem_cache_destroy(ext4_pspace_cachep);
- kmem_cache_destroy(ext4_ac_cachep);
- return -ENOMEM;
- }
return 0;
}


2009-02-12 23:42:40

by Theodore Ts'o

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

Chuck, Anesh,

Thanks for testing out the for-stable-2.6.27 branch!

I've updated the for-stable and for-stable-2.6.27 branches against the
latest stable releases, and I've updated the two flawed backports in
the for-stable-2.6.27 branch. Could you do a quick double-check and
make sure the fixes are as you expect, before I send a pull request to
[email protected]?

- Ted

2009-02-16 21:37:42

by Chuck Ebbert

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

On Thu, 12 Feb 2009 16:19:35 -0500
Theodore Tso <[email protected]> wrote:

>
> I've updated the for-stable and for-stable-2.6.27 branches against the
> latest stable releases, and I've updated the two flawed backports in
> the for-stable-2.6.27 branch. Could you do a quick double-check and
> make sure the fixes are as you expect, before I send a pull request to
> [email protected]?

The 2.6.27 branch looks good to me.

2009-03-31 12:02:29

by Fabio Comolli

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

Is there a patch for 2.6.27.X for people not using git?


On Mon, Feb 16, 2009 at 11:35 PM, Chuck Ebbert <[email protected]> wrote:
> On Thu, 12 Feb 2009 16:19:35 -0500
> Theodore Tso <[email protected]> wrote:
>
>>
>> I've updated the for-stable and for-stable-2.6.27 branches against the
>> latest stable releases, and I've updated the two flawed backports in
>> the for-stable-2.6.27 branch.  Could you do a quick double-check and
>> make sure the fixes are as you expect, before I send a pull request to
>> [email protected]?
>
> The 2.6.27 branch looks good to me.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

2009-03-31 12:33:20

by Theodore Ts'o

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

On Tue, Mar 31, 2009 at 02:02:26PM +0200, Fabio Comolli wrote:
> Is there a patch for 2.6.27.X for people not using git?

These patches that were referenced in the mail thread which you
replied against have already been integrated into the latest 2.6.27.X
series.

There is another batch of patches which is being queued for the stable
series, which I sent out last week. The for-stable branch and
for-stable-2.6.27 branches are for people to do a final round of
testing before I submit them to the stable series. At the moment,
they are only available via git, but usually after a week or so, I'll
send them out to [email protected], and then usually within a week or
so (unless Greg and Chris are travelling), a new stable series shows
up with the latest ext4 bug fixes.

If you really are interested in testing the latest pre-release stable
patches for 2.6.27 --- these are versus 2.6.27.20, they're small
enough that I'll include them here.

- Ted

Eric Sandeen (4):
ext4: fix ext4_free_inode() vs. ext4_claim_inode() race
ext4: fix header check in ext4_ext_search_right() for deep extent trees.
ext4: fix bogus BUG_ONs in in mballoc code
ext4: fix bb_prealloc_list corruption due to wrong group locking

Theodore Ts'o (1):
ext4: Print the find_group_flex() warning only once

fs/ext4/extents.c | 6 ++++--
fs/ext4/ialloc.c | 16 ++++++++++------
fs/ext4/mballoc.c | 13 +++++++++----
3 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index b24d3c5..acb98c9 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -1118,7 +1118,8 @@ ext4_ext_search_right(struct inode *inode, struct ext4_ext_path *path,
struct ext4_extent_idx *ix;
struct ext4_extent *ex;
ext4_fsblk_t block;
- int depth, ee_len;
+ int depth; /* Note, NOT eh_depth; depth from top of tree */
+ int ee_len;

BUG_ON(path == NULL);
depth = path->p_depth;
@@ -1177,7 +1178,8 @@ ext4_ext_search_right(struct inode *inode, struct ext4_ext_path *path,
if (bh == NULL)
return -EIO;
eh = ext_block_hdr(bh);
- if (ext4_ext_check_header(inode, eh, depth)) {
+ /* subtract from p_depth to get proper eh_depth */
+ if (ext4_ext_check_header(inode, eh, path->p_depth - depth)) {
put_bh(bh);
return -EIO;
}
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index cce841f..b9457e1 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -188,7 +188,7 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
struct ext4_group_desc * gdp;
struct ext4_super_block * es;
struct ext4_sb_info *sbi;
- int fatal = 0, err;
+ int fatal = 0, err, cleared;
ext4_group_t flex_group;

if (atomic_read(&inode->i_count) > 1) {
@@ -242,10 +242,12 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
goto error_return;

/* Ok, now we can actually update the inode bitmaps.. */
- if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group),
- bit, bitmap_bh->b_data))
- ext4_error (sb, "ext4_free_inode",
- "bit already cleared for inode %lu", ino);
+ spin_lock(sb_bgl_lock(sbi, block_group));
+ cleared = ext4_clear_bit(bit, bitmap_bh->b_data);
+ spin_unlock(sb_bgl_lock(sbi, block_group));
+ if (!cleared)
+ ext4_error(sb, "ext4_free_inode",
+ "bit already cleared for inode %lu", ino);
else {
gdp = ext4_get_group_desc (sb, block_group, &bh2);

@@ -685,6 +687,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode)
struct inode *ret;
ext4_group_t i;
int free = 0;
+ static int once = 1;
ext4_group_t flex_group;

/* Cannot create files in a deleted directory */
@@ -704,7 +707,8 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode)
ret2 = find_group_flex(sb, dir, &group);
if (ret2 == -1) {
ret2 = find_group_other(sb, dir, &group);
- if (ret2 == 0 && printk_ratelimit())
+ if (ret2 == 0 && once)
+ once = 0;
printk(KERN_NOTICE "ext4: find_group_flex "
"failed, fallback succeeded dir %lu\n",
dir->i_ino);
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 39d7cc1..f34dada 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1450,7 +1450,7 @@ static void ext4_mb_measure_extent(struct ext4_allocation_context *ac,
struct ext4_free_extent *gex = &ac->ac_g_ex;

BUG_ON(ex->fe_len <= 0);
- BUG_ON(ex->fe_len >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
+ BUG_ON(ex->fe_len > EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
BUG_ON(ex->fe_start >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
BUG_ON(ac->ac_status != AC_STATUS_CONTINUE);

@@ -3400,7 +3400,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
}
BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
start > ac->ac_o_ex.fe_logical);
- BUG_ON(size <= 0 || size >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
+ BUG_ON(size <= 0 || size > EXT4_BLOCKS_PER_GROUP(ac->ac_sb));

/* now prepare goal request */

@@ -3698,6 +3698,7 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac,
struct super_block *sb, struct ext4_prealloc_space *pa)
{
unsigned long grp;
+ ext4_fsblk_t grp_blk;

if (!atomic_dec_and_test(&pa->pa_count) || pa->pa_free != 0)
return;
@@ -3712,8 +3713,12 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac,
pa->pa_deleted = 1;
spin_unlock(&pa->pa_lock);

- /* -1 is to protect from crossing allocation group */
- ext4_get_group_no_and_offset(sb, pa->pa_pstart - 1, &grp, NULL);
+ grp_blk = pa->pa_pstart;
+ /* If linear, pa_pstart may be in the next group when pa is used up */
+ if (pa->pa_linear)
+ grp_blk--;
+
+ ext4_get_group_no_and_offset(sb, grp_blk, &grp, NULL);

/*
* possible race:

2009-03-31 12:40:26

by Fabio Comolli

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

OK. Now I have on my box the 2.6.27.19 kernel. Do you mean that I have
to apply 19->20, 20->21 and then this patch?

Then mount the fs as ext4dev?

Thanks,
Fabio

On Tue, Mar 31, 2009 at 2:33 PM, Theodore Tso <[email protected]> wrote:
> On Tue, Mar 31, 2009 at 02:02:26PM +0200, Fabio Comolli wrote:
>> Is there a patch for 2.6.27.X for people not using git?
>
> These patches that were referenced in the mail thread which you
> replied against have already been integrated into the latest 2.6.27.X
> series.
>
> There is another batch of patches which is being queued for the stable
> series, which I sent out last week.  The for-stable branch and
> for-stable-2.6.27 branches are for people to do a final round of
> testing before I submit them to the stable series.  At the moment,
> they are only available via git, but usually after a week or so, I'll
> send them out to [email protected], and then usually within a week or
> so (unless Greg and Chris are travelling), a new stable series shows
> up with the latest ext4 bug fixes.
>
> If you really are interested in testing the latest pre-release stable
> patches for 2.6.27 --- these are versus 2.6.27.20, they're small
> enough that I'll include them here.
>
>                                                - Ted
>
> Eric Sandeen (4):
>      ext4: fix ext4_free_inode() vs. ext4_claim_inode() race
>      ext4: fix header check in ext4_ext_search_right() for deep extent trees.
>      ext4: fix bogus BUG_ONs in in mballoc code
>      ext4: fix bb_prealloc_list corruption due to wrong group locking
>
> Theodore Ts'o (1):
>      ext4: Print the find_group_flex() warning only once
>
>  fs/ext4/extents.c |    6 ++++--
>  fs/ext4/ialloc.c  |   16 ++++++++++------
>  fs/ext4/mballoc.c |   13 +++++++++----
>  3 files changed, 23 insertions(+), 12 deletions(-)
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index b24d3c5..acb98c9 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -1118,7 +1118,8 @@ ext4_ext_search_right(struct inode *inode, struct ext4_ext_path *path,
>        struct ext4_extent_idx *ix;
>        struct ext4_extent *ex;
>        ext4_fsblk_t block;
> -       int depth, ee_len;
> +       int depth;      /* Note, NOT eh_depth; depth from top of tree */
> +       int ee_len;
>
>        BUG_ON(path == NULL);
>        depth = path->p_depth;
> @@ -1177,7 +1178,8 @@ ext4_ext_search_right(struct inode *inode, struct ext4_ext_path *path,
>                if (bh == NULL)
>                        return -EIO;
>                eh = ext_block_hdr(bh);
> -               if (ext4_ext_check_header(inode, eh, depth)) {
> +               /* subtract from p_depth to get proper eh_depth */
> +               if (ext4_ext_check_header(inode, eh, path->p_depth - depth)) {
>                        put_bh(bh);
>                        return -EIO;
>                }
> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index cce841f..b9457e1 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -188,7 +188,7 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
>        struct ext4_group_desc * gdp;
>        struct ext4_super_block * es;
>        struct ext4_sb_info *sbi;
> -       int fatal = 0, err;
> +       int fatal = 0, err, cleared;
>        ext4_group_t flex_group;
>
>        if (atomic_read(&inode->i_count) > 1) {
> @@ -242,10 +242,12 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
>                goto error_return;
>
>        /* Ok, now we can actually update the inode bitmaps.. */
> -       if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group),
> -                                       bit, bitmap_bh->b_data))
> -               ext4_error (sb, "ext4_free_inode",
> -                             "bit already cleared for inode %lu", ino);
> +       spin_lock(sb_bgl_lock(sbi, block_group));
> +       cleared = ext4_clear_bit(bit, bitmap_bh->b_data);
> +       spin_unlock(sb_bgl_lock(sbi, block_group));
> +       if (!cleared)
> +               ext4_error(sb, "ext4_free_inode",
> +                          "bit already cleared for inode %lu", ino);
>        else {
>                gdp = ext4_get_group_desc (sb, block_group, &bh2);
>
> @@ -685,6 +687,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode)
>        struct inode *ret;
>        ext4_group_t i;
>        int free = 0;
> +       static int once = 1;
>        ext4_group_t flex_group;
>
>        /* Cannot create files in a deleted directory */
> @@ -704,7 +707,8 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode)
>                ret2 = find_group_flex(sb, dir, &group);
>                if (ret2 == -1) {
>                        ret2 = find_group_other(sb, dir, &group);
> -                       if (ret2 == 0 && printk_ratelimit())
> +                       if (ret2 == 0 && once)
> +                               once = 0;
>                                printk(KERN_NOTICE "ext4: find_group_flex "
>                                       "failed, fallback succeeded dir %lu\n",
>                                       dir->i_ino);
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 39d7cc1..f34dada 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -1450,7 +1450,7 @@ static void ext4_mb_measure_extent(struct ext4_allocation_context *ac,
>        struct ext4_free_extent *gex = &ac->ac_g_ex;
>
>        BUG_ON(ex->fe_len <= 0);
> -       BUG_ON(ex->fe_len >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
> +       BUG_ON(ex->fe_len > EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
>        BUG_ON(ex->fe_start >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
>        BUG_ON(ac->ac_status != AC_STATUS_CONTINUE);
>
> @@ -3400,7 +3400,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
>        }
>        BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
>                        start > ac->ac_o_ex.fe_logical);
> -       BUG_ON(size <= 0 || size >= EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
> +       BUG_ON(size <= 0 || size > EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
>
>        /* now prepare goal request */
>
> @@ -3698,6 +3698,7 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac,
>                        struct super_block *sb, struct ext4_prealloc_space *pa)
>  {
>        unsigned long grp;
> +       ext4_fsblk_t grp_blk;
>
>        if (!atomic_dec_and_test(&pa->pa_count) || pa->pa_free != 0)
>                return;
> @@ -3712,8 +3713,12 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac,
>        pa->pa_deleted = 1;
>        spin_unlock(&pa->pa_lock);
>
> -       /* -1 is to protect from crossing allocation group */
> -       ext4_get_group_no_and_offset(sb, pa->pa_pstart - 1, &grp, NULL);
> +       grp_blk = pa->pa_pstart;
> +       /* If linear, pa_pstart may be in the next group when pa is used up */
> +       if (pa->pa_linear)
> +               grp_blk--;
> +
> +       ext4_get_group_no_and_offset(sb, grp_blk, &grp, NULL);
>
>        /*
>         * possible race:
>

2009-03-31 12:47:22

by Theodore Ts'o

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

On Tue, Mar 31, 2009 at 02:40:22PM +0200, Fabio Comolli wrote:
> OK. Now I have on my box the 2.6.27.19 kernel. Do you mean that I have
> to apply 19->20, 20->21 and then this patch?

There are ext4-related fixes in the 19->20 patches. There are no ext4
related patches in 20->21, so whether or not you do this is optional
(from the perspective of applying this patch).

> Then mount the fs as ext4dev?

Yes, same as before. I will note that there were some enhancements
and some lower-priority bug fixes that don't get backported to 2.6.27
series, since sometimes it is extremely difficult to backport things
as far as 2.6.27. So if your goal is to use this in production,
2.6.29 will almost certainly be a better bet. The number of people
who test the 2.6.27 backports of ext4 are also much smaller. We
provide it as a service those who for whatever reason refuse to update
to newer kernels, but it's hard for me to offer guarantees.

Best regards,

- Ted

2009-03-31 12:50:52

by Fabio Comolli

[permalink] [raw]
Subject: Re: Ext4 tree backports for 2.6.27.13 and 2.6.28.2

Hi Ted.

On Tue, Mar 31, 2009 at 2:47 PM, Theodore Tso <[email protected]> wrote:
> On Tue, Mar 31, 2009 at 02:40:22PM +0200, Fabio Comolli wrote:
>> OK. Now I have on my box the 2.6.27.19 kernel. Do you mean that I have
>> to apply 19->20, 20->21 and then this patch?
>
> There are ext4-related fixes in the 19->20 patches.  There are no ext4
> related patches in 20->21, so whether or not you do this is optional
> (from the perspective of applying this patch).
>

OK

>> Then mount the fs as ext4dev?
>
> Yes, same as before.  I will note that there were some enhancements
> and some lower-priority bug fixes that don't get backported to 2.6.27
> series, since sometimes it is extremely difficult to backport things
> as far as 2.6.27.  So if your goal is to use this in production,
> 2.6.29 will almost certainly be a better bet.  The number of people
> who test the 2.6.27 backports of ext4 are also much smaller.  We
> provide it as a service those who for whatever reason refuse to update
> to newer kernels, but it's hard for me to offer guarantees.
>

Many thanks. I normally use 2.6.29 with ext4 but I just discovered a
bug that prevents me to use video acceleration. It seems that this was
introduced in the 2.6.28 series and 2.6.27.X don't have it.

> Best regards,
>
>                                        - Ted
>

Regards,
Fabio