public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Davide C. C. Italiano" <dccitaliano@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Davide Italiano <dccitaliano@gmail.com>
Subject: [PATCH 1/2] [btrfs] btrfs_rename: abort transaction in case of error.
Date: Sun, 28 Jun 2015 17:47:20 -0400	[thread overview]
Message-ID: <1435528041-20878-2-git-send-email-dccitaliano@gmail.com> (raw)
In-Reply-To: <1435528041-20878-1-git-send-email-dccitaliano@gmail.com>

From: Davide Italiano <dccitaliano@gmail.com>

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 <dccitaliano@gmail.com>
---
 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


  reply	other threads:[~2015-06-28 21:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-28 21:47 [PATCH 0/2] btrfs_rename bugfixes Davide C. C. Italiano
2015-06-28 21:47 ` Davide C. C. Italiano [this message]
2015-06-29  8:59   ` [PATCH 1/2] [btrfs] btrfs_rename: abort transaction in case of error Filipe David Manana
2015-06-30  4:17     ` Davide Italiano
2015-06-30  8:26       ` Filipe David Manana
2015-06-28 21:47 ` [PATCH 2/2] [btrfs] btrfs_rename(): don't ignore btrfs_end_transaction() return Davide C. C. Italiano
2015-06-29  9:03   ` Filipe David Manana
2015-06-30  4:15   ` Davide C. C. Italiano
2015-06-30  8:24     ` Filipe David Manana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435528041-20878-2-git-send-email-dccitaliano@gmail.com \
    --to=dccitaliano@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox