Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2222369/?format=api
{ "id": 2222369, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222369/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260411085643.3221565-5-dhowells@redhat.com/", "project": { "id": 12, "url": "http://patchwork.ozlabs.org/api/1.2/projects/12/?format=api", "name": "Linux CIFS Client", "link_name": "linux-cifs-client", "list_id": "linux-cifs.vger.kernel.org", "list_email": "linux-cifs@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260411085643.3221565-5-dhowells@redhat.com>", "list_archive_url": null, "date": "2026-04-11T08:56:42", "name": "[4/4] netfs: Fix netfs_invalidate_folio() to clear dirty bit if all changes gone", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8d9905fa0b9347188fa0bf3b48962021e3c0cb57", "submitter": { "id": 59, "url": "http://patchwork.ozlabs.org/api/1.2/people/59/?format=api", "name": "David Howells", "email": "dhowells@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260411085643.3221565-5-dhowells@redhat.com/mbox/", "series": [ { "id": 499541, "url": "http://patchwork.ozlabs.org/api/1.2/series/499541/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=499541", "date": "2026-04-11T08:56:38", "name": "netfs: Miscellaneous fixes", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499541/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2222369/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2222369/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-cifs+bounces-10763-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-cifs@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=MSjDG0IT;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10763-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.b=\"MSjDG0IT\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=170.10.133.124", "smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=redhat.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=redhat.com" ], "Received": [ "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4ft6yM4lx0z1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 18:58:03 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 9BC1C3014859\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 08:57:23 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id DCAE82F4A15;\n\tSat, 11 Apr 2026 08:57:22 +0000 (UTC)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 7276F2C15A5\n\tfor <linux-cifs@vger.kernel.org>; Sat, 11 Apr 2026 08:57:21 +0000 (UTC)", "from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-204-s7j74AqoM9e1zZ8ujLleew-1; Sat,\n 11 Apr 2026 04:57:17 -0400", "from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id CD696195608B;\n\tSat, 11 Apr 2026 08:57:14 +0000 (UTC)", "from warthog.procyon.org.com (unknown [10.44.48.47])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 98E4C180049F;\n\tSat, 11 Apr 2026 08:57:10 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775897842; cv=none;\n b=Ads67dDc3oJvNZNJit7MQm5zAseTYNICuFpnkCOiYeylLXoWpu8h+J6YvDuxbMA8PoHbDUM8S80BPaAbCIs8FUmG5w5FT67TN16vHzCliN//1oHCxt1AW/UyZV5ktzQ0cccbdrYUivgzUoN2yj1ibwj8pSAE4RVL6472E1Dpmnk=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775897842; c=relaxed/simple;\n\tbh=Ysw+0v2QMxySbx347DtfHjbHKop4ioYtzWactI42FLU=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=qjkIZhPGOjxNfXRFNuWwjyz0mcpMz+T2xzsduaZCy2n1xfxdhIX+JutPBD35J0yKH1LpKE2C9yLJ4RgaRz7hVEMc7E5shFuX0PkbMUlZhn4BNcp8ZxI5AR4I9t9P8Y7X7OT2pLsDlgEd89FxPxHxGvobDm8GAqMFZFziDCc4aFw=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=redhat.com;\n spf=pass smtp.mailfrom=redhat.com;\n dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.b=MSjDG0IT; arc=none smtp.client-ip=170.10.133.124", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1775897840;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\t to:to:cc:cc:mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=X397l0CU5nIL2ooMDVBSVen1USL5XU13r/GdYHGDVL8=;\n\tb=MSjDG0IT/8LJxU9Ji5xzGPfKzvhhX8z1BFqpCTtzGUjpI2MwD4jg7ZhPlGhZYYgMHKScNK\n\tsWlkGHFFmstAA/JtLy7zVc3of1h6RswRQpbU/lQxDhC8kVu3xALsxfku3aejQ3fAWrTNwo\n\tUnh0SxglCWeYHBsyytToka0bprNlVnc=", "X-MC-Unique": "s7j74AqoM9e1zZ8ujLleew-1", "X-Mimecast-MFC-AGG-ID": "s7j74AqoM9e1zZ8ujLleew_1775897835", "From": "David Howells <dhowells@redhat.com>", "To": "Christian Brauner <christian@brauner.io>", "Cc": "David Howells <dhowells@redhat.com>,\n\tPaulo Alcantara <pc@manguebit.com>,\n\tnetfs@lists.linux.dev,\n\tlinux-afs@lists.infradead.org,\n\tlinux-cifs@vger.kernel.org,\n\tceph-devel@vger.kernel.org,\n\tlinux-fsdevel@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tMarc Dionne <marc.dionne@auristor.com>,\n\tPaulo Alcantara <pc@manguebit.org>,\n\tMatthew Wilcox <willy@infradead.org>", "Subject": "[PATCH 4/4] netfs: Fix netfs_invalidate_folio() to clear dirty bit if\n all changes gone", "Date": "Sat, 11 Apr 2026 09:56:42 +0100", "Message-ID": "<20260411085643.3221565-5-dhowells@redhat.com>", "In-Reply-To": "<20260411085643.3221565-1-dhowells@redhat.com>", "References": "<20260411085643.3221565-1-dhowells@redhat.com>", "Precedence": "bulk", "X-Mailing-List": "linux-cifs@vger.kernel.org", "List-Id": "<linux-cifs.vger.kernel.org>", "List-Subscribe": "<mailto:linux-cifs+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-cifs+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.93" }, "content": "If a streaming write is made, this will leave the relevant modified folio\nin a not-uptodate, but dirty state with a netfs_folio struct hung off of\nfolio->private indicating the dirty range. Subsequently truncating the\nfile such that the dirty data in the folio is removed, but the first part\nof the folio theoretically remains will cause the netfs_folio struct to be\ndiscarded... but will leave the dirty flag set.\n\nIf the folio is then read via mmap(), netfs_read_folio() will see that the\npage is dirty and jump to netfs_read_gaps() to fill in the missing bits.\nnetfs_read_gaps(), however, expects there to be a netfs_folio struct\npresent and can oops because truncate removed it.\n\nFix this by calling folio_cancel_dirty() in netfs_invalidate_folio() in the\nevent that all the dirty data in the folio is erased (as nfs does).\n\nAlso add some tracepoints to log modifications to a dirty page.\n\nThis can be reproduced with something like:\n\n dd if=/dev/zero of=/xfstest.test/foo bs=1M count=1\n umount /xfstest.test\n mount /xfstest.test\n xfs_io -c \"w 0xbbbf 0xf96c\" \\\n -c \"truncate 0xbbbf\" \\\n -c \"mmap -r 0xb000 0x11000\" \\\n -c \"mr 0xb000 0x11000\" \\\n /xfstest.test/foo\n\nwith fscaching disabled (otherwise streaming writes are suppressed) and a\nchange to netfs_perform_write() to disallow streaming writes if the fd is\nopen O_RDWR:\n\n\tif (//(file->f_mode & FMODE_READ) || <--- comment this out\n\t netfs_is_cache_enabled(ctx)) {\n\nIt should be reproducible even without this change, but if prevents the\nabove trivial xfs_io command from reproducing it.\n\nNote that the initial dd is important: the file must start out sufficiently\nlarge that the zero-point logic doesn't just clear the gaps because it knows\nthere's nothing in the file to read yet. Unmounting and mounting is needed to\nclear the pagecache (there are other ways to do that that may also work).\n\nThis was initially reproduced with the generic/522 xfstest on some patches\nthat remove the FMODE_READ restriction.\n\nReported-by: Marc Dionne <marc.dionne@auristor.com>\nSigned-off-by: David Howells <dhowells@redhat.com>\ncc: Paulo Alcantara <pc@manguebit.org>\ncc: Matthew Wilcox <willy@infradead.org>\ncc: netfs@lists.linux.dev\ncc: linux-fsdevel@vger.kernel.org\n---\n fs/netfs/misc.c | 6 +++++-\n include/trace/events/netfs.h | 4 ++++\n 2 files changed, 9 insertions(+), 1 deletion(-)", "diff": "diff --git a/fs/netfs/misc.c b/fs/netfs/misc.c\nindex 6df89c92b10b..d8e8a4b59768 100644\n--- a/fs/netfs/misc.c\n+++ b/fs/netfs/misc.c\n@@ -256,6 +256,7 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length)\n \t\t\t/* Move the start of the data. */\n \t\t\tfinfo->dirty_len = fend - iend;\n \t\t\tfinfo->dirty_offset = offset;\n+\t\t\ttrace_netfs_folio(folio, netfs_folio_trace_invalidate_front);\n \t\t\treturn;\n \t\t}\n \n@@ -264,12 +265,14 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length)\n \t\t */\n \t\tif (iend >= fend) {\n \t\t\tfinfo->dirty_len = offset - fstart;\n+\t\t\ttrace_netfs_folio(folio, netfs_folio_trace_invalidate_tail);\n \t\t\treturn;\n \t\t}\n \n \t\t/* A partial write was split. The caller has already zeroed\n \t\t * it, so just absorb the hole.\n \t\t */\n+\t\ttrace_netfs_folio(folio, netfs_folio_trace_invalidate_middle);\n \t}\n \treturn;\n \n@@ -277,8 +280,9 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length)\n \tnetfs_put_group(netfs_folio_group(folio));\n \tfolio_detach_private(folio);\n \tfolio_clear_uptodate(folio);\n+\tfolio_cancel_dirty(folio);\n \tkfree(finfo);\n-\treturn;\n+\ttrace_netfs_folio(folio, netfs_folio_trace_invalidate_all);\n }\n EXPORT_SYMBOL(netfs_invalidate_folio);\n \ndiff --git a/include/trace/events/netfs.h b/include/trace/events/netfs.h\nindex cbe28211106c..88d814ba1e69 100644\n--- a/include/trace/events/netfs.h\n+++ b/include/trace/events/netfs.h\n@@ -194,6 +194,10 @@\n \tEM(netfs_folio_trace_copy_to_cache,\t\"mark-copy\")\t\\\n \tEM(netfs_folio_trace_end_copy,\t\t\"end-copy\")\t\\\n \tEM(netfs_folio_trace_filled_gaps,\t\"filled-gaps\")\t\\\n+\tEM(netfs_folio_trace_invalidate_all,\t\"inval-all\")\t\\\n+\tEM(netfs_folio_trace_invalidate_front,\t\"inval-front\")\t\\\n+\tEM(netfs_folio_trace_invalidate_middle,\t\"inval-mid\")\t\\\n+\tEM(netfs_folio_trace_invalidate_tail,\t\"inval-tail\")\t\\\n \tEM(netfs_folio_trace_kill,\t\t\"kill\")\t\t\\\n \tEM(netfs_folio_trace_kill_cc,\t\t\"kill-cc\")\t\\\n \tEM(netfs_folio_trace_kill_g,\t\t\"kill-g\")\t\\\n", "prefixes": [ "4/4" ] }