summaryrefslogtreecommitdiff
path: root/fs/ocfs2/move_extents.c
diff options
context:
space:
mode:
authorYounger Liu <younger.liucn@gmail.com>2014-04-04 01:47:10 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-04 03:20:56 +0400
commitdb66c71577d525c0cd65e66ff675747565783ba4 (patch)
tree94744927610c329533bad994055a37d2e2a3b5d1 /fs/ocfs2/move_extents.c
parente228f6439862359f9b26f9d62634e4fce180b54a (diff)
downloadlinux-db66c71577d525c0cd65e66ff675747565783ba4.tar.xz
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>
Diffstat (limited to 'fs/ocfs2/move_extents.c')
-rw-r--r--fs/ocfs2/move_extents.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index 3ca939552d9c..599eb4c4c8be 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -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