Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3849798pxb; Tue, 17 Nov 2020 05:21:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPxRD7HlbY12/xdsn35/n+FL5WzKz4Zf/MgJ9k35BJvx1lIt1mrdoX029bmCoPbNTmaH/T X-Received: by 2002:a50:a45c:: with SMTP id v28mr3779102edb.329.1605619273803; Tue, 17 Nov 2020 05:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619273; cv=none; d=google.com; s=arc-20160816; b=sM4RHkLg64B+JQAwIktWtfj8i6NxAh3v/IIM1yOCU1WjzCpuVM1RXYELe/KrzruOXX oXginE9SXQqWPB32mRVVbirOSVnk5LFNlQRq4cdvSZT/mXrPIogRSklbMq/xmbrQQviO W3H78ieDtI7ARB20fXHuleiRrINwA08N1deS/OCJEhP8Fe9ok0pQ68kOmzSrFEWfKAZW 5DeVdcwagJjP57EqOcAOAjDwE9XSeNLmxErfooXanKCOedRwHVRLeCH03OS2ji4AFCzD j4aT1qzBMY5D3Hxr+6L4uaf9HX3el/Lw8SHQBVi/CpqEh7LK1LYG9ofb9Y7cAtDErn8G bayg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xhwN9w7RzDrjWtuCtboWVM8oMTMYD2M/D1VcBnnRqE4=; b=acAbZtPkzyMFWHaW535Rq/3DzxboVY0V/y23XXhVBDvqOl8l2bNKxwafjZa+uVIUDf 4Q2TpDG3OxhnECl4bsUryX1mFUXOVBgsu9FpZ1WuMl2uNUt/v1CnOvwU5osIh8y9B+z/ JA93bZJxeujSbqV62U8Di/zFJBG6OPsUSbd18bKb8cOwBX0FnuaSxFFk6/PqNXn4dS8p 8HrnCfnn/27r5pZxJqnr/Yi/v8AOIQULtfo/5egee5Va0GLZET9qYeeiZWuqM4Rh1NGZ o75RPutfy6Kfn5zXtZMXEmMX+/Ah7sXkqZzngpINEYRI+TO9PIEsfELQLIAgmyEc19Zi kRjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QmpYeoAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si10451629eja.279.2020.11.17.05.20.48; Tue, 17 Nov 2020 05:21:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QmpYeoAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729991AbgKQNSS (ORCPT + 99 others); Tue, 17 Nov 2020 08:18:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:50658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730653AbgKQNSO (ORCPT ); Tue, 17 Nov 2020 08:18:14 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 9982B21734; Tue, 17 Nov 2020 13:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619094; bh=poXG0TMt0rDRzcwVgWBKKbtwmrEd1LEv34LIXkT19gM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QmpYeoAKPuNX0OE/5+vu0NFOMtLWTaHJjjbQVy5oD4jgJ53mxKA3uqrd/pXQYBPQJ vAWbzAPsdp0EpVo1ZXrqkJueHJyweCDxCnS/ojP/uvhpFPvPA9pg3+qxUNt0NDqJWH 3OELgXs5k2+YE1ssozRKJ2yBFAhlEMvazq+LShXs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , Filipe Manana , David Sterba , Sasha Levin Subject: [PATCH 4.19 026/101] Btrfs: fix missing error return if writeback for extent buffer never started Date: Tue, 17 Nov 2020 14:04:53 +0100 Message-Id: <20201117122114.364566422@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Filipe Manana [ Upstream commit 0607eb1d452d45c5ac4c745a9e9e0d95152ea9d0 ] If lock_extent_buffer_for_io() fails, it returns a negative value, but its caller btree_write_cache_pages() ignores such error. This means that a call to flush_write_bio(), from lock_extent_buffer_for_io(), might have failed. We should make btree_write_cache_pages() notice such error values and stop immediatelly, making sure filemap_fdatawrite_range() returns an error to the transaction commit path. A failure from flush_write_bio() should also result in the endio callback end_bio_extent_buffer_writepage() being invoked, which sets the BTRFS_FS_*_ERR bits appropriately, so that there's no risk a transaction or log commit doesn't catch a writeback failure. Reviewed-by: Josef Bacik Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/extent_io.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 301111922a1a2..dabf153843e90 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3913,6 +3913,10 @@ int btree_write_cache_pages(struct address_space *mapping, if (!ret) { free_extent_buffer(eb); continue; + } else if (ret < 0) { + done = 1; + free_extent_buffer(eb); + break; } ret = write_one_eb(eb, fs_info, wbc, &epd); -- 2.27.0