From patchwork Wed Aug 14 20:38:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13763949 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2BA1C3DA4A for ; Wed, 14 Aug 2024 20:39:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 799B96B0088; Wed, 14 Aug 2024 16:39:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 771E86B0089; Wed, 14 Aug 2024 16:39:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6122A6B008A; Wed, 14 Aug 2024 16:39:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3E11B6B0088 for ; Wed, 14 Aug 2024 16:39:21 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E33851A11CE for ; Wed, 14 Aug 2024 20:39:20 +0000 (UTC) X-FDA: 82452016080.12.2B65680 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 33F1840012 for ; Wed, 14 Aug 2024 20:39:19 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dPzNxRGg; spf=pass (imf04.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723667887; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JSm2exThzk/ONkPYsLo5wk2mtv0Gd6Av4xPNxsPfqsw=; b=bbq/f13ajL93XAEV6ZjnNpYAYVc3d601NuWVizMzArkAObiN6cVKBZw/pD2qqhMwQf2ajy CRNWIrDAmDlEKeLU6zHLP/KM27bYUwLpjDVBsgel8yDOyL5U+n/W2G7DFHb6nMY2ZdQF0V 5ggN78QnIX+zIK8WOH6JpofYunGXOBI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723667887; a=rsa-sha256; cv=none; b=1XoYLanemiOrPQA1jBtOXaGtBal2J6zWRMDg6DMUpDZ2c3SanG0pwLenOFv50X0msh/f5e LqGCML7H67wqBtKnw2EKMvW0+cWtcOV1EaksUtLzJdTnUMMBsUK2oU3eim/g/FR+XRSUU0 8gap9kzmk4/ZPfnx5FtjoZ8GJiG+pxE= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dPzNxRGg; spf=pass (imf04.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723667958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JSm2exThzk/ONkPYsLo5wk2mtv0Gd6Av4xPNxsPfqsw=; b=dPzNxRGgLj0+Hj93JpzVSJeK21XEkDgXdPWBRoRa7EtrUcw+QP+cepDmBuOkhWQPnWeGze Kxr/ShVMu0L9jMHMF/KXLX/a2IXVMtz4M3brEqYBoId0v9kuucQMhm4vy/+OfJES2HyezH w5VVzD51PlI/5CZNE7EHbkowoir9Pys= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-637-9yDs-KHPO0qhfQhsIZ1yWQ-1; Wed, 14 Aug 2024 16:39:15 -0400 X-MC-Unique: 9yDs-KHPO0qhfQhsIZ1yWQ-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0C2591956095; Wed, 14 Aug 2024 20:39:10 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.30]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9959E3001FE1; Wed, 14 Aug 2024 20:39:02 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Matthew Wilcox Cc: David Howells , Jeff Layton , Gao Xiang , Dominique Martinet , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Max Kellermann , Xiubo Li Subject: [PATCH v2 01/25] netfs, ceph: Partially revert "netfs: Replace PG_fscache by setting folio->private and marking dirty" Date: Wed, 14 Aug 2024 21:38:21 +0100 Message-ID: <20240814203850.2240469-2-dhowells@redhat.com> In-Reply-To: <20240814203850.2240469-1-dhowells@redhat.com> References: <20240814203850.2240469-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 33F1840012 X-Stat-Signature: pq5ifmh69gp3na1g15pgf6b9ki4jc3yi X-HE-Tag: 1723667959-748707 X-HE-Meta: U2FsdGVkX181aUGGV6DmBLuGQBAdi537QkwAqxubo9UJ8x8CHVnU4OhnxifGcMt06deyC5P8qOmerpNsUZHfJMo/9oFl6cOQhLILoNYdgsfzeJZUT0EW4rEQcT5r0+F5wKfkO1mUvHN8zn7I9B/E0vsZBDZ3XOd/dtLah+3i4dOSuA1I+VMQlxfyxiUmLCN3eFiz9BvBoJbFmLLnxOn7+wQfzL7UH5C4fUFSa6n+hn4d/aKpJsvhG06l/gqqGMMmup5OXIdEP+u911Fu+E6ymF6KGW6awWoXuzIb9nNW+u7TRBiDqHxjXGLex/kNM+jVRXmxW8vDhsEkUmiS4hsmub0FiWsN7lfRBMMQbd5PnU53CT1G4/P/dNr++nih9ijauEB4C0jtS+5SeoBMtsijLFOPfG8faDs3vvAAIM2FmBHnGC+bCEL2lz/hKbORDEDCPCBJ40oxZem3DzxEPWRXYV4ZTzJAZfqPcnpEIXK/28z/UOwyrRHCBq86ungr/XEQVDtGpOXLezZdoadXdOq5jY574gjtzYnMdRiTOmTIRdqDzTvPZzA2Npz5yFR8e7af5ek2EdJI2cAlSfS7+9tLnKmlSH0QUIfNLoU5k849pqWRBxfZ7aXzCvSuPaqhysTAGcAcoMGj0ALgSn/K/JaKioVuX+7/R6yvS5SpD0wn72o7a6Xj6KCAst/EDWsvlLbD0CZM4Yx1DNzXIavGcbClD3E6kysmJi/JI9QFtQTp3kaMcBEEu+9sVWvC0xX0DkPNQ+QYifmfKN574djgPozHHScj9JMgWs638Ybg3ouCCy0o9GARdsCTseLq49OVqE4mq5G3k3We/9npgnC/KaGVUGo38W7R/0WtQdIeCnm1PehlcjsWZvDsqKf6pe81pdNI0G+fCmrD1/di6dC3/mKuSLpfXZqc7S7zXP8PGrhfHQSjjgrrWkllj0PSAGR3fqnkil9vKppq9ZmXpvBjg5M zEQ+g+a6 zmzqWzW/6Z4bJqMQsAq59ctzliqcItz6+yLeqykiUvbY1wvcW7v72X6pdWgxzO+cKfZ8gm0fpdr6xExVqJhNsS6cCbniA7QOPaBbm/JJxmNYrG1iUHJd+tVUD0WFHVNvqd9jCvAyMlGe193IwRbx+Ylx8yVl39TcK6m21Xdyqi4J0uTwFHSm8QqxNR0a0a6lS6Pw+N63HTkpSBO4rzt/sYX+w5H9ERzvYyvZGe6R9B+T1xZWwx56M7/1v4T83Eff6WSIOJrmfsv5UKtLjawHoENaFDIDmF+M5T0oddMelMns7GzQMkSLNErqoQX4u8B5f1WgojHcWKz5q2wZKB/hJB404ma6cjecQvvnGsrMe7DCuXZ3ATkNUH943EGrvF9rgZ0UFNlDfIxVijOW6dX1CqhEShyIvI1HywhxBeq+fZZXMYUE+Pk9Ve9BDtJeCSMRv8kWcJ0BKWhSa/ndwKmvDK1cEr0mM7EM7qBgTHhrphPq+Po/Q8VVP+ysSBjFaGSeOEUnyBS2fTsuY4OiUPZnqls/yJ/jnLpTD9aDGR6JISTia1KdorYsQQ/psZykn4gb+RPedsCUNpP1rqCVFR7cTXqjy409m1G1zIOv9icpkPTD4UIrjkqZ8aN1BUT682MbRt/7KiBhfgIARcXjwoQoiud7n/qpaxHcxO3Rr 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: List-Subscribe: List-Unsubscribe: This partially reverts commit 2ff1e97587f4d398686f52c07afde3faf3da4e5c. In addition to reverting the removal of PG_private_2 wrangling from the buffered read code[1][2], the removal of the waits for PG_private_2 from netfs_release_folio() and netfs_invalidate_folio() need reverting too. It also adds a wait into ceph_evict_inode() to wait for netfs read and copy-to-cache ops to complete. Fixes: 2ff1e97587f4 ("netfs: Replace PG_fscache by setting folio->private and marking dirty") Signed-off-by: David Howells cc: Max Kellermann cc: Ilya Dryomov cc: Xiubo Li cc: Jeff Layton cc: Matthew Wilcox cc: ceph-devel@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org Link: https://lore.kernel.org/r/3575457.1722355300@warthog.procyon.org.uk [1] Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e5ced7804cb9184c4a23f8054551240562a8eda [2] --- fs/ceph/inode.c | 1 + fs/netfs/misc.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 71cd70514efa..4a8eec46254b 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -695,6 +695,7 @@ void ceph_evict_inode(struct inode *inode) percpu_counter_dec(&mdsc->metric.total_inodes); + netfs_wait_for_outstanding_io(inode); truncate_inode_pages_final(&inode->i_data); if (inode->i_state & I_PINNING_NETFS_WB) ceph_fscache_unuse_cookie(inode, true); diff --git a/fs/netfs/misc.c b/fs/netfs/misc.c index 83e644bd518f..554a1a4615ad 100644 --- a/fs/netfs/misc.c +++ b/fs/netfs/misc.c @@ -101,6 +101,8 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length) _enter("{%lx},%zx,%zx", folio->index, offset, length); + folio_wait_private_2(folio); /* [DEPRECATED] */ + if (!folio_test_private(folio)) return; @@ -165,6 +167,11 @@ bool netfs_release_folio(struct folio *folio, gfp_t gfp) if (folio_test_private(folio)) return false; + if (unlikely(folio_test_private_2(folio))) { /* [DEPRECATED] */ + if (current_is_kswapd() || !(gfp & __GFP_FS)) + return false; + folio_wait_private_2(folio); + } fscache_note_page_release(netfs_i_cookie(ctx)); return true; }