Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1150562imm; Wed, 1 Aug 2018 11:01:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeWBtIsrQ4VBX4gK9YSkeNMyZe2iOCyIX6Ybc9BDbpmVr8/OXEMpNzL/mtUT+5BeUnskfXN X-Received: by 2002:a62:6cc7:: with SMTP id h190-v6mr28181355pfc.113.1533146511769; Wed, 01 Aug 2018 11:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533146511; cv=none; d=google.com; s=arc-20160816; b=yq2LXxOmkEl8b/GUzG5XSnV/1ukIu+o5wBiC98zgwYaJlwbwN3B2f2SWoGgex6Xw1Q kIJFDxdikT63EfKgy4TkodnhM8DfSsbnFQzL3TqZKiDTVXha2UqOaGbI8fEB3r4esRh6 z7wq3UQXqPrZBuRF1G/V7N5AVN2LwB9mS01890PFAj5HySClcRofJ0TjSI3fSK0foBrW /3K2RPKyBUSrkRmZ43MxMPs8mueftkGVYSN+enixM4MDk3pxlRPJQzFuNQ5xvTl29ALP IAjEsC184Ir7vWh202TxFPZaf5QA5joowzPlD5rgrcxtloD1Lp1Yi5BNHPY2QIpDt4qC R5Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=65zX3vun7/Ya7hAt8leEXkfIjlJ6KXWmRuRgxSSD5DI=; b=Cblh6LoF3Ftfnvqg4HBxEbPtLFcG+0R8Glu85ElFdRgVZ3tcNFCOyUXQtyHq+nl2hA pxswoUSTuDStCnaquVdCaGx3L93vtdy8dkh7UGReg1zg98W6vGqBAPNhKDcmG68LF4Fh 4wRSCZQ7b8jUNPw9ehYaUpBIviTlU/+MH7MJUVfsDIMc29kr+deRIC09ELjjSnFsoQ/b 507GgNi8mN22ocveM5cuKwizg8of35y3mWqpc9Egq0aSbLziRFni4CHAXT8M022mIUuH AeLZGrQwpv/jHk7gI+qko/WzEAiM2cZaW/fD5vxrl07/5hyWhYcpICYbXMaVDe34xty7 AtdA== ARC-Authentication-Results: i=1; mx.google.com; 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 m32-v6si15683587pgl.622.2018.08.01.11.01.37; Wed, 01 Aug 2018 11:01:51 -0700 (PDT) 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; 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 S1732536AbeHATrG (ORCPT + 99 others); Wed, 1 Aug 2018 15:47:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50226 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405913AbeHATIi (ORCPT ); Wed, 1 Aug 2018 15:08:38 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0410613CD; Wed, 1 Aug 2018 17:15:58 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Omar Sandoval , David Sterba , Sasha Levin Subject: [PATCH 4.14 083/246] Btrfs: dont BUG_ON() in btrfs_truncate_inode_items() Date: Wed, 1 Aug 2018 18:49:53 +0200 Message-Id: <20180801165015.700783630@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Omar Sandoval [ Upstream commit 0552210997badb6a60740a26ff9d976a416510f0 ] btrfs_free_extent() can fail because of ENOMEM. There's no reason to panic here, we can just abort the transaction. Fixes: f4b9aa8d3b87 ("btrfs_truncate") Reviewed-by: Nikolay Borisov Signed-off-by: Omar Sandoval Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4740,7 +4740,10 @@ delete: extent_num_bytes, 0, btrfs_header_owner(leaf), ino, extent_offset); - BUG_ON(ret); + if (ret) { + btrfs_abort_transaction(trans, ret); + break; + } if (btrfs_should_throttle_delayed_refs(trans, fs_info)) btrfs_async_run_delayed_refs(fs_info, trans->delayed_ref_updates * 2,