]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ocfs2: fix BUG when calculate new backup super
authorJoseph Qi <joseph.qi@huawei.com>
Tue, 29 Dec 2015 22:54:06 +0000 (14:54 -0800)
committerZefan Li <lizefan@huawei.com>
Wed, 26 Oct 2016 15:15:41 +0000 (23:15 +0800)
commitc173fefcd46726e3a1f0d0623c1f9008eaa00a4b
tree74a7ee042fec1b7b9b365c09bb1bbd36abaab055
parent2c165804da934f079f43f3e6731b9c018b3cf583
ocfs2: fix BUG when calculate new backup super

commit 5c9ee4cbf2a945271f25b89b137f2c03bbc3be33 upstream.

When resizing, it firstly extends the last gd.  Once it should backup
super in the gd, it calculates new backup super and update the
corresponding value.

But it currently doesn't consider the situation that the backup super is
already done.  And in this case, it still sets the bit in gd bitmap and
then decrease from bg_free_bits_count, which leads to a corrupted gd and
trigger the BUG in ocfs2_block_group_set_bits:

    BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits);

So check whether the backup super is done and then do the updates.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Reviewed-by: Jiufei Xue <xuejiufei@huawei.com>
Reviewed-by: Yiwen Jiang <jiangyiwen@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
fs/ocfs2/resize.c