summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2012-09-19 22:14:29 -0600
committerChris Mason <chris.mason@fusionio.com>2012-10-09 09:15:38 -0400
commite8830e606ffee383f073e32313f11fc5692813fe (patch)
tree1d11a33e8d59736ad35018da316383eb64c63527 /fs/btrfs/transaction.c
parentd24bec3ae528a47149b838aad76c006d40fe8a39 (diff)
downloadop-kernel-dev-e8830e606ffee383f073e32313f11fc5692813fe.zip
op-kernel-dev-e8830e606ffee383f073e32313f11fc5692813fe.tar.gz
Btrfs: fix memory leak in start_transaction()
This patch fixes memory leak of the transaction handle which happened when starting transaction failed on a freezed fs. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 910ff80..3548964 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -351,8 +351,10 @@ again:
*/
if (type != TRANS_JOIN_NOLOCK &&
!__sb_start_write(root->fs_info->sb, SB_FREEZE_FS, false)) {
- if (type == TRANS_JOIN_FREEZE)
+ if (type == TRANS_JOIN_FREEZE) {
+ kmem_cache_free(btrfs_trans_handle_cachep, h);
return ERR_PTR(-EPERM);
+ }
sb_start_intwrite(root->fs_info->sb);
}
OpenPOWER on IntegriCloud