From: Davide Italiano <[email protected]>

btrfs_insert_inode_ref() may fail and we want to make sure
the transaction is aborted before calling btrfs_end_transaction(),
as it already happens everywhere else in this function in case
of error.

Signed-off-by: Davide Italiano <[email protected]>
---
 fs/btrfs/inode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8bb0136..59c475c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9114,8 +9114,11 @@ static int btrfs_rename(struct inode *old_dir, struct 
dentry *old_dentry,
                                             new_dentry->d_name.len,
                                             old_ino,
                                             btrfs_ino(new_dir), index);
-               if (ret)
+               if (ret) {
+                       btrfs_abort_transaction(trans, root, ret);
                        goto out_fail;
+               }
+
                /*
                 * this is an ugly little race, but the rename is required
                 * to make sure that if we crash, the inode is either at the
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to