Btrfs: don't leak delayed node on path allocation failure
authorFilipe David Borba Manana <fdmanana@gmail.com>
Sat, 12 Oct 2013 19:32:59 +0000 (20:32 +0100)
committerChris Mason <chris.mason@fusionio.com>
Tue, 12 Nov 2013 03:01:27 +0000 (22:01 -0500)
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>
fs/btrfs/delayed-inode.c

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