From patchwork Tue Aug 20 23:20:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13770638 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 3DEB7C5320E for ; Tue, 20 Aug 2024 23:21:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C0C5A6B0095; Tue, 20 Aug 2024 19:21:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B6D5F6B0096; Tue, 20 Aug 2024 19:21:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0CF86B0098; Tue, 20 Aug 2024 19:21:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 78C3F6B0095 for ; Tue, 20 Aug 2024 19:21:46 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F0CB9805EE for ; Tue, 20 Aug 2024 23:21:45 +0000 (UTC) X-FDA: 82474198170.07.050EB4C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 46848140008 for ; Tue, 20 Aug 2024 23:21:44 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DWV0lOPf; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724196045; a=rsa-sha256; cv=none; b=01MQmeN/0DMPLY4m6vXRR/SlT3r1JREsijYZd1irSjZ6HUZkVBMrQOQGyJFkuJTwJSFOpr PW3nlk8Y2vjvNFMiCfjhzas1fzpaBg2GhSgv0o4xqrlWWMCjgC3Vm26v+FpSgUCsgcpvmP NMccJZ6BJABlpsv5tuM+KYSlEeIpdKs= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DWV0lOPf; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724196045; 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=B4tfOtZ3an7b1aGGuqLauY14dten5jR69+zwwl0cSBE=; b=dbiksVAa1SwlvgrEfa1zpiXDRsVLOtqjMxt8POe4wHl/ychn93/psd2oXlh0euR24+RmT1 JQXhVTCg5oaq+OgBuPvMr4H1Z8SaSk16uJxzChHVHSyO9FSZ85KtsRp7r/FtMPlvvQtRKu lrEQOSMN9fiJKfZ9OLX6ePTL+Kxmy1I= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724196103; 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=B4tfOtZ3an7b1aGGuqLauY14dten5jR69+zwwl0cSBE=; b=DWV0lOPfZ1bjgSMaLnr7dTDop0ZBRLJ0vTZ2rzhKAvX08mJfPXrSb4+C1hXDnwR+t+fNgs dNnPEMPHtmH4EVVA9DOJEyAc36zQk+tuQxIA2WN7JAsTa83u58SfkqQ988SRJGbMAjFEk6 qfhN7+/qwdSQQlu5QwOdvjMqA5EXnHU= Received: from mx-prod-mc-02.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-354-Mj8yoYdJNz-fatkw3PTnGQ-1; Tue, 20 Aug 2024 19:21:36 -0400 X-MC-Unique: Mj8yoYdJNz-fatkw3PTnGQ-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 29EA31955D52; Tue, 20 Aug 2024 23:21:31 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.30]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B0C261955F54; Tue, 20 Aug 2024 23:21:26 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Pankaj Raghav , Jeff Layton , Matthew Wilcox , 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, linux-kernel@vger.kernel.org, Marc Dionne Subject: [PATCH 3/4] netfs: Fix netfs_release_folio() to say no if folio dirty Date: Wed, 21 Aug 2024 00:20:57 +0100 Message-ID: <20240820232105.3792638-4-dhowells@redhat.com> In-Reply-To: <20240820232105.3792638-1-dhowells@redhat.com> References: <20240820232105.3792638-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Queue-Id: 46848140008 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: zqk8nkfso6g1xexgimi53wgujcpr9s7b X-HE-Tag: 1724196104-629308 X-HE-Meta: U2FsdGVkX1+s0cjAHPUs1JmSu1MSSDHOLP/y3eV6ANPv8C+C47urAnKcU+jzqYnMwVrk5QAmCdoZ5Guyn2BJDk0GR4D9Z2ePb+vrO4Sd2jv91+Stza4PT8IZRAkCl7+e+sRN4yyRVBvywbnettO2zqS/GYU8AzvjeR2DeQUidrt6FYi2fjmFDTJb4n+QPj8r2UrqywVQIQLKX+9QDZAbE7kob7I650NJJFBh881E47CYyNZupa9f0+gag2AbO+/fY3Sroib5pNdFINslE8zQfqndUfm/DzWK+AOup6F9NwLEi8UtK4QhrKnhCHJstRa2aQXLze0DL2Rv/2hY64sVGA9PL7mBGGfT/RNAWvcfECh/i8OGKKcJ6X/sYCbaSQLiKhad/bHG6QrHWLOWZdvv6KSBK4bori0TaBEdBgVoWdtgpzOVaXmlESf2MWDhROlkeLNGXlKOZFs/k8D23PUg4rXrDxCuNQlFbP6gcAZlVtxZUxe8oi92bC3rA7L2QY56MnhOqjw81q8RiGHZb+CSIWCp637Ql2WdxdndwRb1zHaMmtm89bNPcnHCOPysHd6BkOTg/3a9swZT1+0Hq8yrvdx9bdcr7BfCvCMQQuvIxjrzf+jbCNUPSXSQKdmnzW9zJH3wSufgAx1Q3EeG1GhRFkTr3Ei62ESjUMZNLS87bPtOsCR0+JtGsQOW/RNhVkwC6Rix3Q1EZoS7c56s4cF2Hv9kwK+ahHL+vN7inhpW+hBF4SFo+tnW7n+HhK+AJpa+Eu7GamDUKBk5hisX3/wtqX6FwjZU7G0xbGZXnIo9+db6ALbbVTy395h9n05lRodKC8J4UgGulJhP/JVLRKUba6j87yeykWQrcrrKYlTrYUFzuGEhiM2ajAewrs90YIlz6cNa4ZUFADC1UlWUJQohayAnJHY+i2rObRwoPZVuw2trcIvh7I4dMtA4m9bZXrob5r314ajzXXtb/GdEjZ2 s9YQKOYo 6edEChyqmyO8SEQhTQxFWdttzGvHtwbFDnZhhNcVQ8LjzyCuetR9rb2lG7xcvy7hVZWHhV/X8zFrDzeG6ynvGcDd4lcH8+6IO/qdlda6GvXhwH0LtOdLZlkso2Sascyqo1FPiV8PcH9uPcef97MW7J34X3gspixeZ+HjChjXw7QL4MovhwDumyto+jTlCfn2Zn/YfNm88QIL+h49jsbIzCaf7N6fOp/kqi/7OPfbTYYZRnQ43NI5Pt+nOEHhpunIMO/gXWGcFw25/ZfsVF/W9iGU5PjzJUzz73zVuDfn68q3bkUbjvE+nHJr+t6hs/vE/Uy7V2eXNn17McQ2aBv/5bXmufQlpq3+w31wcUOPIC0HFcvDRVUFEm5env2YL8TjrPyLzVxXxcz2MBAnUdD1Z0v5v5+piBQUHSogEWpqeuK3P8kKTrP3uYni75s+ziGu1/4bIpT+NGJQG3kDejgjS+dsHj+nQSSu88oGS5YdewXuR+tF0hM0NsPf+UbPTHvvMldbjGeUVRJ3aRw//MGkYaJOOGF7lrGZ2erRHC5tC3ismivpiTu9hQByyo3Q8yDDZSNJls2hngkSnzZGlikDMd7D9vcFqpXDTR4KmbUAmN5jEBwe3kYPKGmvDGxu9HcQR8hka3RCxQRG/zugKOb92e3Z/MkrRuxeOxuBO 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: Fix netfs_release_folio() to say no (ie. return false) if the folio is dirty (analogous with iomap's behaviour). Without this, it will say yes to the release of a dirty page by split_huge_page_to_list_to_order(), which will result in the loss of untruncated data in the folio. Without this, the generic/075 and generic/112 xfstests (both fsx-based tests) fail with minimum folio size patches applied[1]. Fixes: c1ec4d7c2e13 ("netfs: Provide invalidate_folio and release_folio calls") Signed-off-by: David Howells cc: Matthew Wilcox (Oracle) cc: Pankaj Raghav cc: Jeff Layton cc: Marc Dionne cc: linux-afs@lists.infradead.org cc: netfs@lists.linux.dev cc: linux-mm@kvack.org cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/20240815090849.972355-1-kernel@pankajraghav.com/ [1] --- fs/netfs/misc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/netfs/misc.c b/fs/netfs/misc.c index 554a1a4615ad..69324761fcf7 100644 --- a/fs/netfs/misc.c +++ b/fs/netfs/misc.c @@ -161,6 +161,9 @@ bool netfs_release_folio(struct folio *folio, gfp_t gfp) struct netfs_inode *ctx = netfs_inode(folio_inode(folio)); unsigned long long end; + if (folio_test_dirty(folio)) + return false; + end = folio_pos(folio) + folio_size(folio); if (end > ctx->zero_point) ctx->zero_point = end;