Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp451186pxt; Fri, 6 Aug 2021 06:05:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXRSC0lktZ9xkiKjOB8GTOEhs75AuTV1J4ebatGmvPdPdqjc7uWiKlet75CtYFg6WFwv25 X-Received: by 2002:a02:a390:: with SMTP id y16mr10011680jak.120.1628255155598; Fri, 06 Aug 2021 06:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628255155; cv=none; d=google.com; s=arc-20160816; b=Ir228ca5TtXALLvLvkOkhlW8sVi9kERzVgO3nKc63HCLKBTZFsupicdGpkWWoTslBM yCTwRohfaRRGZtobbCLH/zZvwi5+yYjTpeauHErub3IkK0ClK1ECBsrTkMlL397kekR7 kIGH9E3e9aH6eJk8rxAcgVWHWp63J0btXgY49QzGKeXHpdf0wvlRyMv+yWstDiyuLEdX esH2CfrWt1CVmLikqT3yTvKZNGoxxhCnCol3MQrofKjf7rj0hPdvnJPkBa5YqgT/7haL gOb1w31rI0uuMvOWzVvf6LlYAAtj9slT0+YIavva0GCfYDkIEhlge87P73N8RmOa6uU8 wf9w== 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=1KQJaNOX/UdCfgG6ACdt0Eml/vYWeMmRAo0WPy22eKs=; b=0DsaugnByem592YIuoGA7g9tab5l4uK2MjUd99NrLk48E6eVgpnMAva5R2QknCN7hr 4lr4qbhcJ4lfleV9ivIwwMZRzVwYgMyFTUnwN3bHcTxOVszETOksUXBVpBhdK97vNIIy /vBInpqCCspNbaf7FI9y7SEP9AVdm3R64r/pLbucu1/CpnkG8FTiY278+b3oGUq8xaYg 56yubbAvX6eujil8Ioh4fYknUFMo7RnUbANBsrshP8HDgjT1FSjQ+JgDATgnG3egoPHp PUg4L83opTI6JE6n6ze++naev9sl6L2kR9Z9/j+Q0j8/ktsk/wqG7SIrrHhBee9R4NkU A/aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BNfpIBdb; 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=pass (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 v14si8344269ilj.0.2021.08.06.06.05.39; Fri, 06 Aug 2021 06:05:55 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=BNfpIBdb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241186AbhHFISO (ORCPT + 99 others); Fri, 6 Aug 2021 04:18:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:45704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243928AbhHFIQO (ORCPT ); Fri, 6 Aug 2021 04:16:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E507561163; Fri, 6 Aug 2021 08:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628237758; bh=KxhQ2Lk/yyDZbj6EJ6D+FpbwFeQW/dOuACsTvOBpKnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BNfpIBdbqwz5WbsNllkiMTYTW0gGJjAmvYDCLLvEl8xcCVSVCyYVzsJckbzict30J ijSDdx8smYrwvs3rSnN4v7B7+cTpCVtKBr4vtibcWmaQv2vipon2brTgWfuEvMxxnu sHnmr+hcPsdj0rqw+hEwFM1HLrKxtYRy9IqtyIrM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Goldwyn Rodrigues , David Sterba , Sasha Levin Subject: [PATCH 4.19 01/16] btrfs: mark compressed range uptodate only if all bio succeed Date: Fri, 6 Aug 2021 10:14:52 +0200 Message-Id: <20210806081111.193594472@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806081111.144943357@linuxfoundation.org> References: <20210806081111.144943357@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore 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: Goldwyn Rodrigues [ Upstream commit 240246f6b913b0c23733cfd2def1d283f8cc9bbe ] In compression write endio sequence, the range which the compressed_bio writes is marked as uptodate if the last bio of the compressed (sub)bios is completed successfully. There could be previous bio which may have failed which is recorded in cb->errors. Set the writeback range as uptodate only if cb->errors is zero, as opposed to checking only the last bio's status. Backporting notes: in all versions up to 4.4 the last argument is always replaced by "!cb->errors". CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Goldwyn Rodrigues Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/compression.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index c71e534ca7ef..919c033b9e31 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -270,8 +270,7 @@ static void end_compressed_bio_write(struct bio *bio) cb->start, cb->start + cb->len - 1, NULL, - bio->bi_status ? - BLK_STS_OK : BLK_STS_NOTSUPP); + !cb->errors); cb->compressed_pages[0]->mapping = NULL; end_compressed_writeback(inode, cb); -- 2.30.2