Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3848183pxb; Tue, 17 Nov 2020 05:19:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzv8WUVGYrVrdWOeS8RmgqAc5IKpjhm3bqfuM76MptN9UJnw2YH5jN4TPsLDRk3SrHh5gzm X-Received: by 2002:a05:6402:716:: with SMTP id w22mr21116168edx.214.1605619141973; Tue, 17 Nov 2020 05:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619141; cv=none; d=google.com; s=arc-20160816; b=l/jMOtVTN4fGWYJwcJqqSYE5QWVHOK0YTcDD3VZD9MaLAyqzCnXROYdKpQvnQHZAqm IcD9p64ewpvNklOpWlE1D3/9wiJQk3plzD9l52UJoT+ZXXlXv0aLMVhRgKjao7Pb+BeW F0uulU3ADnfPrfcu8j6Wx5FKMOElAVVy5qsvd2YJhMEFOJqpr+oHhy22yIV7RCBlRUsf HDSIFuwh/Zv4Ai865ReSmUK0tnXrL8LDuJY7fWU29a1akl4uQda3WQo5l4+JKqzQ8Qvy tBuogDWtqLasyqes0dmy3nkN2l3CcpnEEGWSaEuegwO0pA3ZUyoAH/yVta4aHhbZBKHt L2fA== 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=2Y877DlDmfSd7dzuAVqS8zDim6O39FXJy8lC81oBZVs=; b=GzHaqABWTPPd29/6vM8JFUBN9lTocMAy1+m1H+loW5gGrdyvV8u9RZTwvQv9FnC0Yp 49uAh33Y0YRCSE5UsmkZmOXQfOwSxGplQLWIpa3kxJpKIYDxNHiIeQgMoWwDm1DcRlKA RIuSc3cJtgqmXphKwPGLcJ3kcJPxPo0LD7IrM0ocL6rgshQCybqGS/8ChEj7+i1MDgBi AvKBrPWFfTASoWJHyrEIl9KDcbBT0X+AxP/zBSXqNhv2PelXBbcwZBYlG5O+2wxH2PjY IO9V1VZJjmQ5YNJNh9pGeqyJhyRQ1YJPzfbCb/HTvBroq8U3fprFP0sFABMlXuMOp9jQ AY9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GaRj5W5d; 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 ca2si13897474edb.502.2020.11.17.05.18.39; Tue, 17 Nov 2020 05:19:01 -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=GaRj5W5d; 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 S1729980AbgKQNN6 (ORCPT + 99 others); Tue, 17 Nov 2020 08:13:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:44414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729962AbgKQNNt (ORCPT ); Tue, 17 Nov 2020 08:13:49 -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 C78832225B; Tue, 17 Nov 2020 13:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618829; bh=BTSApQo3SNWjKQl4tn8W2cC+bsJWwvcTyjxBNa6bOUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GaRj5W5dHRdxCVdWBflQN1nFAwHYba51ZY6y6kO7vVpSVRyl8Be4wjkE1Hh0MsTuV MRC+zRkQ+L+bdCaT5Es+MjDd4YrzX1zgA2VwuB/CMp3VZJc613mQHmakJLO+FNFzhe 0DoRUA70yy0SnPoNtNXqhBQSRFp6hQCiMsOxzIFg= 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.14 21/85] Btrfs: fix missing error return if writeback for extent buffer never started Date: Tue, 17 Nov 2020 14:04:50 +0100 Message-Id: <20201117122112.070302590@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122111.018425544@linuxfoundation.org> References: <20201117122111.018425544@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 0ba338cffa937..fd56c22c12a0e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3869,6 +3869,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