Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13471649ybl; Sun, 29 Dec 2019 12:42:37 -0800 (PST) X-Google-Smtp-Source: APXvYqxqOV/xze1sx6CQoIeEgxsQIcodKosryRe1+VVVHbXje3ZjQbpWqpujwtTOG8bAdHlzOEBH X-Received: by 2002:a9d:6acd:: with SMTP id m13mr65467079otq.313.1577652157644; Sun, 29 Dec 2019 12:42:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652157; cv=none; d=google.com; s=arc-20160816; b=BWxwYp+wucTjTow69doBHe2N11piq9++Fykw9QqKO+O8G9TYf4mL32XV7SJUQbizSe IzWd0MOf5tVc4/fTj/41lNesLEguXJyIipt1q9hNHgA4Ihw4sweib840bZSE+fZqnZ8k u3p672AWmB0EA67U6jrLlgBDWF/ma47PzmMu/j76JGjv0DEV6LaMbKnAcT1D9+STzMFJ rJVFUdURAhAdIUe1lyjXlfR0MKcN7T8laFrO1Pt2Hlf1G13wjFiqRD1l3WEinXiJProt dTFBEu72a7IqvIfFgIAJNChmhyB/63YKx0cq2ziuSIb+qT5N/2YsUYrPzoD4hsVz3a1W TR9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bo52h+i3bmO5RpVG74vMMPCaVY0l5MzeH4uZvVcgh+o=; b=QcJBMySBqFpeBEMzSrIv/oaBOva9ci/QnbCGOfuIVFzqbaO6kYlqQjqfBQakuCWrpJ i3F3zOFrfuZcb+wWBE+Mu+ccykWZnNRS2xEzPJmuFqOMbTU4sOIJNRC6bfxv+KVYPyVK //yfnq21uMJvoJLPg1olAuB85YCXnGJP1nG+aCJroG2K/BNy1OXjSZyxhhXzage8aX9j 3krks66oXSWfaU0Ldi38sDHk57Lctbvd0dJZYt8FAqfMAvy4KVuFsb3SBg3RixDIyHqj ddZtanIx4qEO5iTcTWjvdTxa7NozlBdcZvphRQpyMilZvDLTZCGmQ7EfetvuuOkJJD7u 9k/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="jL/9efnj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20si20229380otk.73.2019.12.29.12.42.25; Sun, 29 Dec 2019 12:42:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="jL/9efnj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730354AbfL2Rmq (ORCPT + 99 others); Sun, 29 Dec 2019 12:42:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:49128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730340AbfL2Rml (ORCPT ); Sun, 29 Dec 2019 12:42:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 23552207FF; Sun, 29 Dec 2019 17:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641360; bh=tDD6UcQO//fPfKO1LLIweRfUJgq9pUxd+d+2vc02hPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jL/9efnjOciwcysmVgi4NaPszmB5nbnoW/9A8xjJWMD1vaEmFuxJ6Tuq0I4j9loOP OBPQEOQJMYv7LabGWEPbPeHCxNVqfPdjRaX9jDSOfEgOIGWVXu7v2YZT+WuGkjMpab Gm1ZtH1e6WPTEUf07IFmq5OxPHM0ZabgtjvCaino= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Johannes Thumshirn , Josef Bacik , David Sterba Subject: [PATCH 5.4 034/434] btrfs: abort transaction after failed inode updates in create_subvol Date: Sun, 29 Dec 2019 18:21:27 +0100 Message-Id: <20191229172704.299990660@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik commit c7e54b5102bf3614cadb9ca32d7be73bad6cecf0 upstream. We can just abort the transaction here, and in fact do that for every other failure in this function except these two cases. CC: stable@vger.kernel.org # 4.4+ Reviewed-by: Filipe Manana Reviewed-by: Johannes Thumshirn Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/ioctl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -705,11 +705,17 @@ static noinline int create_subvol(struct btrfs_i_size_write(BTRFS_I(dir), dir->i_size + namelen * 2); ret = btrfs_update_inode(trans, root, dir); - BUG_ON(ret); + if (ret) { + btrfs_abort_transaction(trans, ret); + goto fail; + } ret = btrfs_add_root_ref(trans, objectid, root->root_key.objectid, btrfs_ino(BTRFS_I(dir)), index, name, namelen); - BUG_ON(ret); + if (ret) { + btrfs_abort_transaction(trans, ret); + goto fail; + } ret = btrfs_uuid_tree_add(trans, root_item->uuid, BTRFS_UUID_KEY_SUBVOL, objectid);