dect
/
linux-2.6
Archived
13
0
Fork 0

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>
This commit is contained in:
Miao Xie 2012-09-19 22:14:29 -06:00 committed by Chris Mason
parent d24bec3ae5
commit e8830e606f
1 changed files with 3 additions and 1 deletions

View File

@ -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);
}