{"id":2229005,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2229005/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260427154639.180684-13-dhowells@redhat.com/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/1.1/projects/12/?format=json","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":""},"msgid":"<20260427154639.180684-13-dhowells@redhat.com>","date":"2026-04-27T15:46:27","name":"[v4,12/22] netfs: Fix read-gaps to remove netfs_folio from filled folio","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1c97a4fd5b86fc9661288d2da6cca5f44dbdc64c","submitter":{"id":59,"url":"http://patchwork.ozlabs.org/api/1.1/people/59/?format=json","name":"David Howells","email":"dhowells@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260427154639.180684-13-dhowells@redhat.com/mbox/","series":[{"id":501682,"url":"http://patchwork.ozlabs.org/api/1.1/series/501682/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=501682","date":"2026-04-27T15:46:15","name":"netfs: Miscellaneous fixes","version":4,"mbox":"http://patchwork.ozlabs.org/series/501682/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2229005/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2229005/checks/","tags":{},"headers":{"Return-Path":"\n <linux-cifs+bounces-11168-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=e6028zr4;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=104.64.211.4; helo=sin.lore.kernel.org;\n envelope-from=linux-cifs+bounces-11168-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=\"e6028zr4\"","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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g47bk3pj3z1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 02:01:38 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 0FE1A302084D\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 15:49:33 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id EFD193CCFC9;\n\tMon, 27 Apr 2026 15:47:47 +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 48A3F3BE145\n\tfor <linux-cifs@vger.kernel.org>; Mon, 27 Apr 2026 15:47:46 +0000 (UTC)","from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-b9j1WSlZO7OME4jzDoPg8Q-1; Mon,\n 27 Apr 2026 11:47:42 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id CF5431800648;\n\tMon, 27 Apr 2026 15:47:40 +0000 (UTC)","from warthog.procyon.org.com (unknown [10.44.32.126])\n\tby mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id DF3CD19560AB;\n\tMon, 27 Apr 2026 15:47:37 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777304867; cv=none;\n b=MSA/ZwTm41ISdEHHR8f3InW9gLTgmJGSOYAee+t8JvZgcTWyGhxVeLSIMs2tALyNuh3bksRkllm4Ae5BIkJZ+sIbUTZu+v/mXf7c7H+bxSghBpvqwVqZh/lzCMEhcivByX9LH3RugzoCwco3hsErSz5A7y3d6lIFG1a06gCL3LY=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777304867; c=relaxed/simple;\n\tbh=Us2Q19DvcJquz3a09IEqW6WuYt1jFkjLNcIkoFQc8s0=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=UYe+X9q8XSgfr7DDOdeKLNA3NCVdJuS+Tft2bTIyi+NaJ33gAkiCNAqK5ZypEQHUsi3soEM0Vkh/60Rxn8tte75qKofZSpdseRuQbtabJThrhGZDYdyzZz6RSUcTh7/iSBAqvo81yXJX2Pm4e/gvtw3LHsbddx/sGNFG3MyX1oc=","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=e6028zr4; 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=1777304865;\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=YMJCGQjgBF59xwSVUpUZlzOMstVEkqoAU/oKa2PZXqk=;\n\tb=e6028zr4S7qfOxwxT4Nugl+IaOjwZlwqkeaxOHv+L/o+wWZBdREU/guSl6IuNz5Gp+z4Tx\n\tcHAWhbJOoV5AD9oVsD84TCv59AfBfMUpIsDadTLiY7jjMOrfWGX9YLrW0JcAeYesK/oAv/\n\tD3ojC6kbvepOa4N56Z1CNuWzYDCLHNs=","X-MC-Unique":"b9j1WSlZO7OME4jzDoPg8Q-1","X-Mimecast-MFC-AGG-ID":"b9j1WSlZO7OME4jzDoPg8Q_1777304860","From":"David Howells <dhowells@redhat.com>","To":"Christian Brauner <christian@brauner.io>","Cc":"David Howells <dhowells@redhat.com>,\n\tPaulo Alcantara <pc@manguebit.org>,\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\tMatthew Wilcox <willy@infradead.org>","Subject":"[PATCH v4 12/22] netfs: Fix read-gaps to remove netfs_folio from\n filled folio","Date":"Mon, 27 Apr 2026 16:46:27 +0100","Message-ID":"<20260427154639.180684-13-dhowells@redhat.com>","In-Reply-To":"<20260427154639.180684-1-dhowells@redhat.com>","References":"<20260427154639.180684-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.0 on 10.30.177.12"},"content":"Fix netfs_read_gaps() to remove the netfs_folio record from the folio\nrecord before marking the folio uptodate if it successfully fills the gaps\naround the dirty data in a streaming write folio (dirty, but not uptodate).\n\nFound with:\n\n    fsx -q -N 1000000 -p 10000 -o 128000 -l 600000 \\\n        /xfstest.test/junk --replay-ops=junk.fsxops\n\nusing the following as junk.fsxops:\n\n    truncate 0x0 0x138b1 0x8b15d *\n    write 0x507ee 0x10df7 0x927c0\n    write 0x19993 0x10e04 0x927c0 *\n    mapwrite 0x66214 0x1a253 0x927c0\n    copy_range 0xb704 0x89b9 0x24429 0x79380\n    write 0x2402b 0x144a2 0x90660 *\n    mapwrite 0x204d5 0x140a0 0x927c0 *\n    copy_range 0x1f72c 0x137d0 0x7a906 0x927c0 *\n    read 0 0x9157c 0x9157c\n\non cifs with the default cache option.\n\nIt shows folio 0x24 misbehaving if the FMODE_READ check is commented out in\nnetfs_perform_write():\n\n                if (//(file->f_mode & FMODE_READ) ||\n                    netfs_is_cache_enabled(ctx)) {\n\nand no fscache.  This was initially found with the generic/522 xfstest.\n\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\nFixes: ee4cdf7ba857 (\"netfs: Speed up buffered reading\")\n---\n fs/netfs/buffered_read.c | 11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)","diff":"diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c\nindex 3b26b8113401..600816914b46 100644\n--- a/fs/netfs/buffered_read.c\n+++ b/fs/netfs/buffered_read.c\n@@ -400,6 +400,7 @@ static int netfs_read_gaps(struct file *file, struct folio *folio)\n {\n \tstruct netfs_io_request *rreq;\n \tstruct address_space *mapping = folio->mapping;\n+\tstruct netfs_group *group = netfs_folio_group(folio);\n \tstruct netfs_folio *finfo = netfs_folio_info(folio);\n \tstruct netfs_inode *ctx = netfs_inode(mapping->host);\n \tstruct folio *sink = NULL;\n@@ -466,6 +467,12 @@ static int netfs_read_gaps(struct file *file, struct folio *folio)\n \n \tret = netfs_wait_for_read(rreq);\n \tif (ret >= 0) {\n+\t\tif (group)\n+\t\t\tfolio_change_private(folio, group);\n+\t\telse\n+\t\t\tfolio_detach_private(folio);\n+\t\tkfree(finfo);\n+\t\ttrace_netfs_folio(folio, netfs_folio_trace_filled_gaps);\n \t\tflush_dcache_folio(folio);\n \t\tfolio_mark_uptodate(folio);\n \t}\n@@ -501,10 +508,8 @@ int netfs_read_folio(struct file *file, struct folio *folio)\n \tstruct netfs_inode *ctx = netfs_inode(mapping->host);\n \tint ret;\n \n-\tif (folio_test_dirty(folio)) {\n-\t\ttrace_netfs_folio(folio, netfs_folio_trace_read_gaps);\n+\tif (folio_test_dirty(folio))\n \t\treturn netfs_read_gaps(file, folio);\n-\t}\n \n \t_enter(\"%lx\", folio->index);\n \n","prefixes":["v4","12/22"]}