]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Btrfs: fix unclosed transaction handle in btrfs_cont_expand
authorMiao Xie <miaox@cn.fujitsu.com>
Sun, 11 Sep 2011 14:52:24 +0000 (10:52 -0400)
committerChris Mason <chris.mason@oracle.com>
Sun, 11 Sep 2011 14:52:24 +0000 (10:52 -0400)
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>
fs/btrfs/inode.c

index edd45f70998906c172b3127974dd9f9c24ba770f..c257af2ce9cb16fdd630cc3834e5640fdf72c748 100644 (file)
@@ -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);