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=-7.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 50C92C4708F for ; Wed, 2 Jun 2021 15:17:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BB8E761246 for ; Wed, 2 Jun 2021 15:17:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB8E761246 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1CF716B0083; Wed, 2 Jun 2021 11:17:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 180B76B0085; Wed, 2 Jun 2021 11:17:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01FFC6B0087; Wed, 2 Jun 2021 11:17:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id C73156B0083 for ; Wed, 2 Jun 2021 11:17:51 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 57C518249980 for ; Wed, 2 Jun 2021 15:17:51 +0000 (UTC) X-FDA: 78209138742.04.7AAF892 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf14.hostedemail.com (Postfix) with ESMTP id F16C1C00CBFD for ; Wed, 2 Jun 2021 15:17:36 +0000 (UTC) Received: from relay2.suse.de (unknown [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 48E461FD89; Wed, 2 Jun 2021 15:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1622647069; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iqJ6ZU1Fg7hct0fRYvmiTWw8Y+3JAogrAeK3zWvbsDo=; b=ClMfueLgOwK2fs6Ct/duprwdzSe0RN7EMpCpWn7BeNdwSP1MLFC3Hv0PWtrKZF3bdoLZA0 Lv32Ucaktj/s56yFmEFl6tQ+9hGeW5nMN3j4fi95lS/GL9bdzyzpFBGzca8b5kFD+fztoK jrt6BFKj0tZh5eUA5h0eLrQ+fEErKUk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1622647069; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iqJ6ZU1Fg7hct0fRYvmiTWw8Y+3JAogrAeK3zWvbsDo=; b=dEFZe+LOmFqNdAYwVTa3T61wLN0GaIzXgV5IDTINiGB7yjXdvr964o83jrRqENEYFnqn8f um3fE+Suvb//ePBA== Received: by relay2.suse.de (Postfix, from userid 51) id 4627BA3C50; Wed, 2 Jun 2021 15:34:32 +0000 (UTC) Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id 77EDFA8011; Wed, 2 Jun 2021 14:52:52 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 41D6D1F2CAC; Wed, 2 Jun 2021 16:52:52 +0200 (CEST) Date: Wed, 2 Jun 2021 16:52:52 +0200 From: Jan Kara To: Vincent Whitchurch Cc: jack@suse.cz, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: __buffer_migrate_page() vs ll_rw_block() Message-ID: <20210602145252.GA23647@quack2.suse.cz> References: <20210601132316.GA27976@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210601132316.GA27976@axis.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: F16C1C00CBFD Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=ClMfueLg; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=dEFZe+LO; dmarc=none; spf=pass (imf14.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz X-Rspamd-Server: rspam03 X-Stat-Signature: mribuwpwnwged5f8yoz4cazdzf3wb7z1 X-HE-Tag: 1622647056-747874 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 01-06-21 15:23:17, Vincent Whitchurch wrote: > I'm seeing occasional squashfs read failures ("squashfs_read_data failed > to read block") when compaction is run at the same time as reading from > squashfs, with something like the commands below. The kernel version is > the latest stable/v5.4 kernel, v5.4.123. > > while :; do echo 1 > /proc/sys/vm/compact_memory; done & > while :; do echo 3 > /proc/sys/vm/drop_caches; find fs/ > /dev/null; done & > > On this kernel, squashfs uses ll_rw_block(). The problem is that > ll_rw_block() ignores BHs which it can't get a lock on, but > __buffer_migrate_page() can take the lock on the BHs in order to check > if they can be migrated. If __buffer_migrate_page() holds the lock at > the same time that ll_rw_block() wants it, the BH is skipped and I/O is > not issued for these blocks, and squashfs ends up seeing > !buffer_uptodate() and erroring out. > > On newer kernels, squashfs doesn't use ll_rw_block() anymore, but I > still see other users of that function in other filesystems, and AFAICS > the underlying problem of the race with __buffer_migrate_page() has not > yet been fixed. > > I'd be happy to receive any suggestions about the right way to fix this. Well, if you care about squashfs, the best solution would IMO be to backport 93e72b3c612adc ("squashfs: migrate from ll_rw_block usage to BIO") and the followup fixes (there are several of them as far as I can see by Fixes tags) to your kernel - stable tree would be IMHO willing to take the series if you add your justification that it fixes read failures for you. Honza -- Jan Kara SUSE Labs, CR