[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    Btrfs: fix ordered extent leak when failing to start a transaction
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2012-08-29 18:41:08
Message-ID: 20120829184108.C2F693404FA () ra ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/;a=commit;h=d280e5be940931c84bb2e9831ead9d02bc785484
Commit:     d280e5be940931c84bb2e9831ead9d02bc785484
Parent:     24c03fa5cf3d02c327cf9f2fc39f72664b1bd7e1
Author:     Liu Bo <bo.li.liu@oracle.com>
AuthorDate: Tue Aug 21 21:13:25 2012 -0600
Committer:  Chris Mason <chris.mason@oracle.com>
CommitDate: Tue Aug 28 16:53:42 2012 -0400

    Btrfs: fix ordered extent leak when failing to start a transaction
    
    We cannot just return error before freeing ordered extent and releasing reserved
    space when we fail to start a transacion.
    
    Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
    Signed-off-by: Chris Mason <chris.mason@oracle.com>
---
 fs/btrfs/inode.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 38cda78..6ba80b9 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1882,8 +1882,11 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
 				trans = btrfs_join_transaction_nolock(root);
 			else
 				trans = btrfs_join_transaction(root);
-			if (IS_ERR(trans))
-				return PTR_ERR(trans);
+			if (IS_ERR(trans)) {
+				ret = PTR_ERR(trans);
+				trans = NULL;
+				goto out;
+			}
 			trans->block_rsv = &root->fs_info->delalloc_block_rsv;
 			ret = btrfs_update_inode_fallback(trans, root, inode);
 			if (ret) /* -ENOMEM or corruption */
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic