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.3 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,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 9E04EC47080 for ; Tue, 1 Jun 2021 13:23:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2FC83610A1 for ; Tue, 1 Jun 2021 13:23:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FC83610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=axis.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A047A6B006C; Tue, 1 Jun 2021 09:23:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9B51C6B0070; Tue, 1 Jun 2021 09:23:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 855216B0073; Tue, 1 Jun 2021 09:23:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0026.hostedemail.com [216.40.44.26]) by kanga.kvack.org (Postfix) with ESMTP id 51F6F6B006C for ; Tue, 1 Jun 2021 09:23:21 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D1AF4A76E for ; Tue, 1 Jun 2021 13:23:20 +0000 (UTC) X-FDA: 78205221360.32.847D877 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by imf20.hostedemail.com (Postfix) with ESMTP id ADD5437B for ; Tue, 1 Jun 2021 13:23:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1622553800; x=1654089800; h=date:from:to:cc:subject:message-id:mime-version; bh=4+P5vP/IMM0ahXtkgFF2oW6amPennmZbptYSDq3P2S0=; b=U3H87OlqkgtiL5Gf68k7NJbXgz+mbmo7IrmUDduaJaTFm2V4Vr8fTEm5 lCjjcD7S0ywuypi2Gw/hknzdf32P+yG1dM7ygn0cF1P+uFYRUjFozwZxj q93120PK5lrXZQ6IdjPW3gvbiTcIcahQ7elbi6NhtxlWqHvUdkyg/fhx2 PNlWznZ6edArKXqAqH1ilLTc2H7khkX0G3w/RTdELyRZtRjlPg0aWhGrx Q0zhb899JR4c3ra688CCd/LdjH+fMfNchekV3pmf20B/8GlFxOHzWK3Gc FyBqtgTsOA+zA/s+aILK0WWtr0fsHIXsE95dei6rbQh15T7FjaqoL63wR A==; Date: Tue, 1 Jun 2021 15:23:17 +0200 From: Vincent Whitchurch To: CC: , Subject: __buffer_migrate_page() vs ll_rw_block() Message-ID: <20210601132316.GA27976@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: ADD5437B Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=axis.com header.s=axis-central1 header.b=U3H87Olq; spf=pass (imf20.hostedemail.com: domain of Vincent.Whitchurch@axis.com designates 195.60.68.18 as permitted sender) smtp.mailfrom=Vincent.Whitchurch@axis.com; dmarc=pass (policy=none) header.from=axis.com X-Rspamd-Server: rspam04 X-Stat-Signature: jq9eqxqza7pr7tqgirg4ptorgc1e6f67 X-HE-Tag: 1622553783-873031 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000766, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Thank you.