Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3315708imu; Sun, 11 Nov 2018 12:12:15 -0800 (PST) X-Google-Smtp-Source: AJdET5flKBazErK+je6cPQSojyr8HP9PQmFNVK/vWPVMHP9/Y4yFFrs9ThmxiVfF/tgNkTCxc4DE X-Received: by 2002:a17:902:3e3:: with SMTP id d90-v6mr17184266pld.118.1541967135144; Sun, 11 Nov 2018 12:12:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541967135; cv=none; d=google.com; s=arc-20160816; b=HSUrQfhBNL9n0iCe3ElXGUBPvx8C86y8alLdEpKuWBxZA6FpVzsIpIPWoQgvA/TCkj fCSlnfXntUATvKATr1Zgz1mKkAXx6ilmnJzyYVmo0Ew8rtD024drbxW01CT/yQHXMF02 luryZQqoRkBwNFMeHjgb0d64t7uHVbbovCmb2FIUp+dL2a8k4eeT4MFX54A86d9h6Sq4 AC7pnR5g+6XNM1Ox1933j/OdvMfdA7mZAYQMH0yk79Oj6SN28ci3/6AEar2n87cxDXKj m2EP4W+7P9CR13NB8tWHolKFIQ6MWGMnDjkJZ4VLuRiFbzxOuerowgbphIKdHG9aSdwW xvmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=sJ4C3d1jxHOLdbIWQdsYsmza3xEHf1Dkl1Ahk1ru8k8=; b=i0kbBCOwHNX81CZNffqupGsM+jGvrLCUxdpAvcwSzB8KBILRO02eKfjj6I5LlIJuDN ClHyyPLhp3cy3JWDVm0g3PmspFrI6w0vOGLzcFESCHC/kIetvI6TTymVEPAEqCNPHoJ8 HnoTf4pHLxK169duVDtemD2Qldsqdmz2axRLenSccHFe/OuYacIQUy6DmhymOwcZhXIN 1jY6Od58tfpvz41Rw7rdQN711L5Kswnd8izMwUUufXApJwxQnTrlZfXksJS0n1JIa1f4 0bIay/0gLCyXNhFJJ5D/7IoFBViEiiT7QCRHrCYDaIGrbxqQhE/g2veh81LYRegaW8ld 4gyQ== 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 f3-v6si12937872pgq.536.2018.11.11.12.12.00; Sun, 11 Nov 2018 12:12:15 -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; 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 S1731659AbeKLGAj (ORCPT + 99 others); Mon, 12 Nov 2018 01:00:39 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52450 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731019AbeKLGAi (ORCPT ); Mon, 12 Nov 2018 01:00:38 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvt6-0000lM-Mi; Sun, 11 Nov 2018 19:59:16 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsQ-0001Tv-D7; Sun, 11 Nov 2018 19:58:34 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Omar Sandoval" , "David Sterba" , "Nikolay Borisov" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 089/366] Btrfs: don't BUG_ON() in btrfs_truncate_inode_items() In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Omar Sandoval commit 0552210997badb6a60740a26ff9d976a416510f0 upstream. 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 [bwh: Backported to 3.16: - Also pass root to btrfs_abort_transaction() - Adjust context] Signed-off-by: Ben Hutchings --- fs/btrfs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4313,7 +4313,10 @@ delete: extent_num_bytes, 0, btrfs_header_owner(leaf), ino, extent_offset, 0); - BUG_ON(ret); + if (ret) { + btrfs_abort_transaction(trans, root, ret); + break; + } } if (found_type == BTRFS_INODE_ITEM_KEY)