Skip to content

Commit

Permalink
Btrfs: fix unclosed transaction handle in btrfs_cont_expand
Browse files Browse the repository at this point in the history
The function - btrfs_cont_expand() forgot to close the transaction handle before
it jump out the while loop. Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Miao Xie authored and chrismason-xx committed Sep 11, 2011
1 parent 98c9942 commit 5b39737
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/btrfs/inode.c
Expand Up @@ -3510,15 +3510,19 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
err = btrfs_drop_extents(trans, inode, cur_offset,
cur_offset + hole_size,
&hint_byte, 1);
if (err)
if (err) {
btrfs_end_transaction(trans, root);
break;
}

err = btrfs_insert_file_extent(trans, root,
btrfs_ino(inode), cur_offset, 0,
0, hole_size, 0, hole_size,
0, 0, 0);
if (err)
if (err) {
btrfs_end_transaction(trans, root);
break;
}

btrfs_drop_extent_cache(inode, hole_start,
last_byte - 1, 0);
Expand Down

0 comments on commit 5b39737

Please sign in to comment.