summary refs log tree commit diff
path: root/fs/btrfs/delayed-inode.c
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@gmail.com>2013-10-12 20:32:59 +0100
committerChris Mason <chris.mason@fusionio.com>2013-11-11 22:01:27 -0500
commit3c77bd94ecb4ad2653d1e3eb22295018533a1e21 (patch)
treed915ce71692d350dfee6203f9152ae01ed853bee /fs/btrfs/delayed-inode.c
parent361c093d7f99c3f6cbb07d5c580ce778ab418c42 (diff)
downloadlinux-3c77bd94ecb4ad2653d1e3eb22295018533a1e21.tar.gz
Btrfs: don't leak delayed node on path allocation failure
If the path allocation failed, we would return without decrementing
the reference count in the delayed node we got before, resulting
in a leak.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/delayed-inode.c')
-rw-r--r--fs/btrfs/delayed-inode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index cbd9523ad09c..df1a496bc8d4 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1174,8 +1174,10 @@ int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
 	mutex_unlock(&delayed_node->mutex);
 
 	path = btrfs_alloc_path();
-	if (!path)
+	if (!path) {
+		btrfs_release_delayed_node(delayed_node);
 		return -ENOMEM;
+	}
 	path->leave_spinning = 1;
 
 	block_rsv = trans->block_rsv;