Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1647926pxy; Mon, 2 Aug 2021 07:03:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKGehDSLRnEYU2hz9RiqmpDtFFS6C9IbsG576FbFQl1fH57BpptnxGGegRMZR991FuvhlE X-Received: by 2002:a05:6602:1203:: with SMTP id y3mr2220250iot.192.1627912986726; Mon, 02 Aug 2021 07:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627912986; cv=none; d=google.com; s=arc-20160816; b=dg8brj5zu9EtTlEKYxn0n8xe1HMftxc4coR764P8PQ+DmAEq09rgKrsVMK+6TQdkqH NDJ3rlbPDldLx5qP4PL18HgL5So0oyoyfa/XfSAQwVGIPhc1DbFShPeZTBcUv0jHQn7l GrjichTRbacXTaxA3AlRasxAZi0xqD0haQIC2++EgRkDNuu2O2F3dcmcSBwDA3vQZsn+ 7GJ9ehygYw0Xz876jZ5ULbWQDPZMK9lPeOE2pciMr5g91QcNcGAorDF9/HzQ1HY9hgc8 rHEIK1V8HHFY55T/mJDMgqxZHWMSqsCPTPOaIhPzNvmPLsWFIU0ahL70WY5c0Tmz4n1H Nr9A== 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=xSKWVYCwk1VQFhZsY7X5OQMp85I1wBkLISe9a7RWJl8=; b=RbHN+gSk3z9CEO71sM5kL2nR7skwXx12gLV7PVK12jZZFf1/xKh6+FkoTLqglzL95X h/C7YHAm+WYnYCSML0Zc3l+wFIZcU1kYIlg0t+NpLf+VNSE858moQDwSYRvlGMrpofs2 GGp7VSMc9BycGxZL/ElVaFcHEmJzpP8HH2x1cdD23mgJRaplYhGsRXug5vXmNL2ovbQY pQmRUwoj7SacSZRJkvAihWSN5JJuoSMgDmLOEo6taD9oxMznHXZn+ImCGq5yItvd/SGY oGiVrord9wkGfa8b6dqqNC2nN2GhCHTN3rFGAHd/8+fJLDq+Ekln6y3tppCNbMfZzpdH q4xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WVBGAROF; 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 a6si15665695ilv.81.2021.08.02.07.02.54; Mon, 02 Aug 2021 07:03:06 -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=WVBGAROF; 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 S234485AbhHBOCQ (ORCPT + 99 others); Mon, 2 Aug 2021 10:02:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:60706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235732AbhHBNyT (ORCPT ); Mon, 2 Aug 2021 09:54:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0AD9761155; Mon, 2 Aug 2021 13:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627912356; bh=LLRrbjJ+8SIjP/v9qwB8N5PbdPl0TOslBFqsycMSAdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WVBGAROF+4jWd1FtxoRAGXtdUloa68v5IM4PDdcJWSvD4b1VFogpGpciGRmhtpwfz Wyd+e9TwOgCFcRIVfLdUHrrQCHfnlZ2rpJC0e5SXcDfli+bF2eJK1mlpm+Zo61/I8u o4AACRUNxIVLrMFisyMenuX6UKsRrBx6wOKYRmaM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Goldwyn Rodrigues , David Sterba Subject: [PATCH 5.10 05/67] btrfs: mark compressed range uptodate only if all bio succeed Date: Mon, 2 Aug 2021 15:44:28 +0200 Message-Id: <20210802134339.206023793@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802134339.023067817@linuxfoundation.org> References: <20210802134339.023067817@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: Goldwyn Rodrigues commit 240246f6b913b0c23733cfd2def1d283f8cc9bbe upstream. 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: Greg Kroah-Hartman --- fs/btrfs/compression.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -340,7 +340,7 @@ static void end_compressed_bio_write(str cb->compressed_pages[0]->mapping = cb->inode->i_mapping; btrfs_writepage_endio_finish_ordered(cb->compressed_pages[0], cb->start, cb->start + cb->len - 1, - bio->bi_status == BLK_STS_OK); + !cb->errors); cb->compressed_pages[0]->mapping = NULL; end_compressed_writeback(inode, cb);