From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5887C4338F for ; Fri, 6 Aug 2021 08:16:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6E3061209 for ; Fri, 6 Aug 2021 08:16:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244005AbhHFIQk (ORCPT ); Fri, 6 Aug 2021 04:16:40 -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 S243675AbhHFIPq (ORCPT ); Fri, 6 Aug 2021 04:15:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C3B9611F0; Fri, 6 Aug 2021 08:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628237726; bh=UB9FSzuLu6oUUchX3FiJuVuwfavG4iH+VsVWHUrpWN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OvsnIXd44xRu1TSfindSuUiJBItD+XsvyDRrYB6PXL5EjJymwOVr0qUr1lh7mIcll GrC5Ux7pJAhgutk/f6bvnXhACj1OpLS4e9bXOgHSAWclnPo2EvdB0dfPfikISpggvw rSRyBPUKiZTnojONCuhYKAr1UlQGB3niqr16wZ1U= 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.14 01/11] btrfs: mark compressed range uptodate only if all bio succeed Date: Fri, 6 Aug 2021 10:14:44 +0200 Message-Id: <20210806081110.562910408@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806081110.511221879@linuxfoundation.org> References: <20210806081110.511221879@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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index ccd9c709375e..24341c97c13f 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -286,7 +286,7 @@ static void end_compressed_bio_write(struct bio *bio) cb->start, cb->start + cb->len - 1, NULL, - bio->bi_status ? 0 : 1); + !cb->errors); cb->compressed_pages[0]->mapping = NULL; end_compressed_writeback(inode, cb); -- 2.30.2