From patchwork Sun Jun 28 21:47:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Davide Italiano X-Patchwork-Id: 6686781 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DABB79F1C1 for ; Sun, 28 Jun 2015 21:50:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B1532060F for ; Sun, 28 Jun 2015 21:50:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 211BE2060C for ; Sun, 28 Jun 2015 21:50:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752743AbbF1Vrb (ORCPT ); Sun, 28 Jun 2015 17:47:31 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:36056 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752098AbbF1Vr3 (ORCPT ); Sun, 28 Jun 2015 17:47:29 -0400 Received: by pdcu2 with SMTP id u2so104772457pdc.3 for ; Sun, 28 Jun 2015 14:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jBdEWp15ihY/lZdnpbpMuY/Nnf5LeKNzX2pfmQURCPc=; b=gjnKSCZ0KFeFieEigS+ZvoT9HtX0FDBv63JcuB9p4A8m6mw+ZDZYmp2Vx5R8aMehGi HaYVZhs7usMhyOFDtoRi+VtXXKHUnxKmQ2oEv68kMegh1LY/Xq0rtvDdUp0Uv0luLtLs gz9FsmTpSYEdZ02C7vChUOo9nHJD0+1dNF5fqT/xPvaWi10BLGX4hlWfbG71iA7Or1cu kh95HRKg/+eR7cnyItT32m+1lc+cEvaQyy+Lb+gGzXeIQlYC+vcBxKGcNmO5r+HZLk4L FbkFgN9Erb5CFhqFklZe8pBy4hJvVmI2lj8kYrY9Q57vfpRqgLXupkmKEJd/WIjdyiCF ynqw== X-Received: by 10.66.253.40 with SMTP id zx8mr15499394pac.56.1435528049363; Sun, 28 Jun 2015 14:47:29 -0700 (PDT) Received: from localhost.localdomain.localdomain (c-24-7-63-120.hsd1.ca.comcast.net. [24.7.63.120]) by mx.google.com with ESMTPSA id s1sm40010745pda.54.2015.06.28.14.47.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Jun 2015 14:47:28 -0700 (PDT) From: "Davide C. C. Italiano" To: linux-btrfs@vger.kernel.org Cc: Davide Italiano Subject: [PATCH 1/2] [btrfs] btrfs_rename: abort transaction in case of error. Date: Sun, 28 Jun 2015 17:47:20 -0400 Message-Id: <1435528041-20878-2-git-send-email-dccitaliano@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1435528041-20878-1-git-send-email-dccitaliano@gmail.com> References: <1435528041-20878-1-git-send-email-dccitaliano@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Davide Italiano 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 --- 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