From patchwork Wed Aug 14 19:50:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13763880 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 2668AC52D7F for ; Wed, 14 Aug 2024 19:50:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A35596B0083; Wed, 14 Aug 2024 15:50:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E4A46B0085; Wed, 14 Aug 2024 15:50:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8ADB46B0088; Wed, 14 Aug 2024 15:50:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6FB6E6B0083 for ; Wed, 14 Aug 2024 15:50:16 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7FE1A41212 for ; Wed, 14 Aug 2024 19:50:15 +0000 (UTC) X-FDA: 82451892390.08.447BDA4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id BCB2E160028 for ; Wed, 14 Aug 2024 19:50:12 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=T48a5vXG; spf=pass (imf08.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=1723664917; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=/f2tGiDB/aYV2fKGojac/R/nY51VPmqymykpR+kaL+k=; b=vP6ubtE8JIDmtaR+wm70GStu3QQncpxIOIxqGENAkU83wwM6LAPq5Ak9ZqPbFehY9E3LcD PMcmC2YgNQceGJgda24ByOglLppA01CeVoWb+sjuEI2tNavES13biVraxLuErSaSl3K+C3 MmR3ryQjg2gtOSptisQMUUDZAYZL5vc= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=T48a5vXG; spf=pass (imf08.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723664917; a=rsa-sha256; cv=none; b=qzBML5KDrsvLgo7ocfaB9U/Bbfjqz3XEJtBD+J8z6VBm2x59H4P1Mk3Fu3YgxtkQnYQbil ckuKQjAc2pbRjSEM2zLsITIYuRpM8UMXf+8dm11kFOTii3obonN4u1v2YhK+dqfO9EBXGT JcaXBWQpvbaVYDRumZjYVcJ3AKCRIoQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723665012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/f2tGiDB/aYV2fKGojac/R/nY51VPmqymykpR+kaL+k=; b=T48a5vXGATlIbi+hCRArBShByAWqrDbH+AAmweB0I3tXz+7S/M1kKFC6Lj1SSmrlG0+0I2 FcMGnqNnJEA35oQScu/yZ2J4mRN5WqxZ0l/6PxxdQzWRAP1drlGHLosi/hSIa6nK4QQ/L8 gMWyx/Q6Z5S0FJgXbLmx901VK6MxdUM= Received: from mx-prod-mc-01.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-411-GYkvsiM6PluIyAv1x30gAA-1; Wed, 14 Aug 2024 15:50:09 -0400 X-MC-Unique: GYkvsiM6PluIyAv1x30gAA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C148E1953942; Wed, 14 Aug 2024 19:50:07 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.30]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 37E9E19560AA; Wed, 14 Aug 2024 19:50:04 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: Christian Brauner cc: dhowells@redhat.com, Max Kellermann , Ilya Dryomov , Xiubo Li , Jeff Layton , Matthew Wilcox , ceph-devel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] netfs, ceph: Partially revert "netfs: Replace PG_fscache by setting folio->private and marking dirty" MIME-Version: 1.0 Content-ID: <2181766.1723665003.1@warthog.procyon.org.uk> Date: Wed, 14 Aug 2024 20:50:03 +0100 Message-ID: <2181767.1723665003@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: BCB2E160028 X-Stat-Signature: 8fe1kfa5bom6wxg1do1jnuiryp5z3qkm X-Rspam-User: X-HE-Tag: 1723665012-543542 X-HE-Meta: U2FsdGVkX1+jSGxSg6AoFRpxU11rS8fgDLlvavqUPmf3a8N3XgQwcRJOLsAcyCv2XHjFLaZxUotx8TDLdS/EcrW1Ia00If/qI5io7FYCBFStq4So50ZJfpBDWN/pwpEZP0A1QX7+U/t5NvNJ8ZSb7PGfI+6DDvRn3hZJbAO3YbxKQOxO9+94J3T53/MlMHO7LsUFNax722Ry3XhZynlMAYUSi6YsFqDvMgxkNZ6pognMemhkdb9uQRPo37yYf5U7WRwpcyaOLDb744wIBJPzkjsf3ABnepdW4gmGRwUwcJO/O7zZ7X18DLjgBZBENeWkWyJerz2O5yI/qOHWZHLSKSkjJce7rseGwuFdFyAGbWrEym5icJ2bRvKVFGTUkEvsiq2u4uCowYqJJRXzjVznFfuX7TveYkO/WrLqaDqqY26J2BtBWqQwgZFQqSOMbRXZCRiMa0IgQwV1hYUJ52MRGbxJ44MjCOXrcdAGgxbrb8KwuIQ5WwLYw/1VXUB7aKfhbSiyrQr4N4yHkxMWsru6UgG/XSCaBqL9QGzp2+YFC6lU1nXQorMUsCGIcJGECsnZIcevfJFXDBmOECQvbhb5kF4nMAFcsKoDaPGh2UX7oi4dO+WaPzgTqsTJqLa8TgCKBwoJH3f2PFR3eEiPh+uPqio0lzQfsBxeXVFb8bxoswNuHd7E4HBM58JXfg3SFQ8IChNTnvjcMrHWJq994OyDbDKkZGLCxxY5QHbO0I1cs54JtK9wjJPSxN/1knO98Zvm0si4YT7KlmQzxsS2Yzau3nFRlvL8kNc4B8Jrjf1OczGUogQlt+pUEXdmXDAwqIIqcaZc0wvPx8x3TI9sj7wpXTKc03aXgo3+rf0GozApREGN6o1hq/YAGXeRKueKAcnkxqc9jXK+9nDncAFunTe6JuPx8oFsQpTLmXYa5bjmZiqiysVEogdyCEtzIXIlCHpf8Qvs65DEpKJRUggA91D A/ZrzQwv DLwgIaXMpojOoX83Y2xzmOaAgIfdzW0+Yn1MdujXuYMu8gW04PvOlH1qlDgQfrNIWIJkaRGd4cTb+BF3v/UIxr/qXhPkPRWnTuGvccE4tQq8w7qBsJlZmlgfSvU7tk316njqrvl0poaYZDjev9YfePTXN1gAghcCRn0SRPK8+PyueGZ/ahfKDBFG86QQiD49Tkb+pBZwzusfM1GKpzc/y2xm7dhBJVyWWLg5NC+PQdanJHIeI9cad+gk2lP52NtI1Y8VJsiCO+uvWYWEHWoOV5PbgTEwbBROGzA05Fh7dApU6Qy4KyAgM6TzyYPkocgIofHp81adTJuydg0SEY+JC+R9rQrNZANuE8rdwR/Io2h1FqLpPy5XCx+duxr2aLz+gIEEYSw7BVtmlS32M4A7XN0ijE/mk+LmA53APzahx8NEfKtASguGVCC3caMPW2rEYN6008Yl+eoHTP6B6gqLnKQfpLbNFsBttg+IAe2xBUtKepm5+qQ+37LSz4nTsL2gieZRJHFt1CJRm+EePSRMT/z/BVzIj+SEqwkKpUD3fowsAJ/j930ID8T9iueS1jyFHU818PVg/egaAgzK8LCyQLMGNjbiLoInoCniZz0xxBd5BhoPJgMiK+GCfjFUaD6kINcXHmP0BfPGH7zBWMsaH/ouOeMt0/hQTqwXi22jDo6cd1x0= 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] Reviewed-by: Xiubo Li Tested-by: Xiubo Li --- 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; }