Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp456762pxb; Thu, 9 Sep 2021 05:02:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKHxDjGkotsVcadf//St5HC+Ub9cDFs77ALBjtcDkfdN+tOADKyh53FK/GlyEWTIEf/gMH X-Received: by 2002:a17:906:a018:: with SMTP id p24mr2965931ejy.349.1631188954400; Thu, 09 Sep 2021 05:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188954; cv=none; d=google.com; s=arc-20160816; b=GAkTc8Ey2e+L2Q1Ol8gP/CXNPnWfLmzruIBYaq2bxNqDvhZC7b9AnD/8L+mYAD8l5b R/c3VIoGOpluTtEvNpGXTLw7Ng6DF8682eBC++uDc0jjLtGdJtJ8e95nY+zEu9EVWsfW ai248ds4zKVDC4JMnwH89gtovWn4+O+pFnOtv7ME+ptDTmufcMN5AXihFcjICr9KZDVa jtZaoqUL+4Nnvba14Tk/LDT8IcdxMmVVRpfXkhOSmbp95l6SiNoUVUD1mHJwfycY50OG uOMCHq1KZG138Y2m/gm42gcdqAQSyuKaNzFLGcFJAlD5uTYero3KYEEnExNHXy8t5wng 7WZw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ShzEVHuqcDfYptAgsl+c5QWW/wyMzYxTsRePl1SQvDQ=; b=D6y/tl+adTx+Bhi/FCzCeSiAUQsx1Mwz8BIhxPnd62sYVrahXzQNrIPL2xAYP3rw4+ YxvBKGyNfdZJraivUEeuiOwKCiov6Drc9ehyaWgSKsVNOKwXTYvqESOKSMTSenVGHLY0 nmfJEqiqytyOAy7Che1vlt+EvxXPPNAl4pAdc1G+NkulEnrkZkm+apWck+n2DwVo0jEl H15yuG6SN1s2M5hFI+tG86+QZsiNqe1Qy+DotihCvcYXQqIwoPsjgalm3HEkjIlMLvir ib7GeAVNcoeICFBs1CYKYpvGja3tvbb2b06+ZzTG20+ZBfUIEqjbrb9w1dhO5MS9LiXN 9fkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MXLDFRto; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si1581059edr.545.2021.09.09.05.01.53; Thu, 09 Sep 2021 05:02:34 -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=@kernel.org header.s=k20201202 header.b=MXLDFRto; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241492AbhIIMAg (ORCPT + 99 others); Thu, 9 Sep 2021 08:00:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243567AbhIIL4b (ORCPT ); Thu, 9 Sep 2021 07:56:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2BD61613BD; Thu, 9 Sep 2021 11:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187915; bh=oFbCu/3eod+iO96miKqTRD02KMMKf++LKX7oyMo4u3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MXLDFRtoU7f3+Ab0uMcWf83zOY4fidKpNcdz4gSKYAVGFl6eIaGIUuKmf36c8l7Aj /vshe7kWkOc0DcOEBJCFCE9/Ixx0HAX0UjsRE9hpSuLhkAdmNjVBcOFwnXU1iV+598 PA5IGuw56cPb10cszMwdF/PKTA7LzkwLDvOmPWluQEBM4rYk1hFMH+Yxt7zGQvB4ZM U97++g5FDu+uOR48IsAosD3H2iDQ3TqBUKMFxOaC2vscpE63UPXGE+2GZQpO2pD0p+ nZ+LTvRrdKnzgrJB0Pg8CC3XT9BjdtAnfZHwAUOHZ3ZqvSdM8VBI3Z3WhFE9i3MKJE x6F0OS0lhmBjA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Qu Wenruo , Anand Jain , David Sterba , Sasha Levin , linux-btrfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 191/252] btrfs: reset this_bio_flag to avoid inheriting old flags Date: Thu, 9 Sep 2021 07:40:05 -0400 Message-Id: <20210909114106.141462-191-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qu Wenruo [ Upstream commit 4c37a7938496756649096a7ec26320eb8b0d90fb ] In btrfs_do_readpage(), we never reset @this_bio_flag after we hit a compressed extent. This is fine, as for PAGE_SIZE == sectorsize case, we can only have one sector for one page, thus @this_bio_flag will only be set at most once. But for subpage case, after hitting a compressed extent, @this_bio_flag will always have EXTENT_BIO_COMPRESSED bit, even we're reading a regular extent. This will lead to various read errors, and causing new ASSERT() in incoming subpage patches, which adds more strict check in btrfs_submit_compressed_read(). Fix it by declaring @this_bio_flag inside the main loop and reset its value for each iteration. Reviewed-by: Anand Jain Signed-off-by: Qu Wenruo Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/extent_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 9e81d25dea70..907cb88fb30b 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3488,7 +3488,6 @@ int btrfs_do_readpage(struct page *page, struct extent_map **em_cached, size_t pg_offset = 0; size_t iosize; size_t blocksize = inode->i_sb->s_blocksize; - unsigned long this_bio_flag = 0; struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; ret = set_page_extent_mapped(page); @@ -3519,6 +3518,7 @@ int btrfs_do_readpage(struct page *page, struct extent_map **em_cached, } begin_page_read(fs_info, page); while (cur <= end) { + unsigned long this_bio_flag = 0; bool force_bio_submit = false; u64 disk_bytenr; -- 2.30.2