Re: [PATCH 3.12 40/56] ext4: fix ext4_discard_allocated_blocks() if we can't allocate the pa struct

From: Ben Hutchings
Date: Sun Sep 14 2014 - 22:47:04 EST


On Wed, 2014-09-03 at 11:26 +0200, Jiri Slaby wrote:
> From: Theodore Ts'o <tytso@xxxxxxx>
>
> 3.12-stable review patch. If anyone has any objections, please let me know.
>
> ===============
>
> commit 86f0afd463215fc3e58020493482faa4ac3a4d69 upstream.
>
> If there is a failure while allocating the preallocation structure, a
> number of blocks can end up getting marked in the in-memory buddy
> bitmap, and then not getting released. This can result in the
> following corruption getting reported by the kernel:
>
> EXT4-fs error (device sda3): ext4_mb_generate_buddy:758: group 1126,
> 12793 clusters in bitmap, 12729 in gd
>
> In that case, we need to release the blocks using mb_free_blocks().
>
> Tested: fs smoke test; also demonstrated that with injected errors,
> the file system is no longer getting corrupted
>
> Google-Bug-Id: 16657874
>
> Signed-off-by: "Theodore Ts'o" <tytso@xxxxxxx>
> Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
[...]

It's a bit late now, but Ted said this introduced a regression that's
fixed by commit c99d1e6e83b0 ("ext4: fix BUG_ON in mb_free_blocks()").

(I just made the same mistake in 3.2.63.)

Ben.

--
Ben Hutchings
Make three consecutive correct guesses and you will be considered an expert.

Attachment: signature.asc
Description: This is a digitally signed message part