ocfs2: rollback alloc_dinode counts when ocfs2_block_group_set_bits() failed
After updating alloc_dinode counts in ocfs2_alloc_dinode_update_counts(), if ocfs2_alloc_dinode_update_bitmap() failed, there is a rare case that some space may be lost. So, roll back alloc_dinode counts when ocfs2_block_group_set_bits() failed. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Younger Liu <younger.liucn@gmail.com> Reviewed-by: 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>
This commit is contained in:

committed by
Linus Torvalds

parent
e228f64398
commit
db66c71577
@@ -691,8 +691,11 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context,
|
||||
|
||||
ret = ocfs2_block_group_set_bits(handle, gb_inode, gd, gd_bh,
|
||||
goal_bit, len);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
ocfs2_rollback_alloc_dinode_counts(gb_inode, gb_bh, len,
|
||||
le16_to_cpu(gd->bg_chain));
|
||||
mlog_errno(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Here we should write the new page out first if we are
|
||||
|
Reference in New Issue
Block a user