Linux kernel -stable discussions
 help / color / mirror / Atom feed
* Patch "Btrfs: fix transaction handle leak on failure to create hard link" has been added to the 4.4-stable tree
@ 2016-03-01 18:32 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-03-01 18:32 UTC (permalink / raw)
  To: fdmanana, bo.li.liu, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    Btrfs: fix transaction handle leak on failure to create hard link

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     btrfs-fix-transaction-handle-leak-on-failure-to-create-hard-link.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 271dba4521aed0c37c063548f876b49f5cd64b2e Mon Sep 17 00:00:00 2001
From: Filipe Manana <fdmanana@suse.com>
Date: Tue, 5 Jan 2016 16:24:05 +0000
Subject: Btrfs: fix transaction handle leak on failure to create hard link

From: Filipe Manana <fdmanana@suse.com>

commit 271dba4521aed0c37c063548f876b49f5cd64b2e upstream.

If we failed to create a hard link we were not always releasing the
the transaction handle we got before, resulting in a memory leak and
preventing any other tasks from being able to commit the current
transaction.
Fix this by always releasing our transaction handle.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/btrfs/inode.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6493,7 +6493,7 @@ out_unlock_inode:
 static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
 		      struct dentry *dentry)
 {
-	struct btrfs_trans_handle *trans;
+	struct btrfs_trans_handle *trans = NULL;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct inode *inode = d_inode(old_dentry);
 	u64 index;
@@ -6519,6 +6519,7 @@ static int btrfs_link(struct dentry *old
 	trans = btrfs_start_transaction(root, 5);
 	if (IS_ERR(trans)) {
 		err = PTR_ERR(trans);
+		trans = NULL;
 		goto fail;
 	}
 
@@ -6552,9 +6553,10 @@ static int btrfs_link(struct dentry *old
 		btrfs_log_new_name(trans, inode, NULL, parent);
 	}
 
-	btrfs_end_transaction(trans, root);
 	btrfs_balance_delayed_items(root);
 fail:
+	if (trans)
+		btrfs_end_transaction(trans, root);
 	if (drop_inode) {
 		inode_dec_link_count(inode);
 		iput(inode);


Patches currently in stable-queue which might be from fdmanana@suse.com are

queue-4.4/btrfs-fix-transaction-handle-leak-on-failure-to-create-hard-link.patch
queue-4.4/btrfs-fix-number-of-transaction-units-required-to-create-symlink.patch
queue-4.4/btrfs-send-don-t-bug_on-when-an-empty-symlink-is-found.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-01 18:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01 18:32 Patch "Btrfs: fix transaction handle leak on failure to create hard link" has been added to the 4.4-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox