{"id":2229588,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2229588/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260428131756.922303-15-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":"<20260428131756.922303-15-dhowells@redhat.com>","date":"2026-04-28T13:17:44","name":"[v5,14/24] netfs: Fix potential deadlock in write-through mode","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2273dc360369685b8f585c4f432306c9adf0d5a0","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/20260428131756.922303-15-dhowells@redhat.com/mbox/","series":[{"id":501852,"url":"http://patchwork.ozlabs.org/api/1.1/series/501852/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=501852","date":"2026-04-28T13:17:35","name":"netfs: Miscellaneous fixes","version":5,"mbox":"http://patchwork.ozlabs.org/series/501852/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2229588/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2229588/checks/","tags":{},"headers":{"Return-Path":"\n <linux-cifs+bounces-11204-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=RZmOQk9t;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-cifs+bounces-11204-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=\"RZmOQk9t\"","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 sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\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 4g4hmX6yzPz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 23:56:12 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 3ABEE31766EE\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 13:28:11 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E6F5947DFB0;\n\tTue, 28 Apr 2026 13:19:33 +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 DDF7047DD78\n\tfor <linux-cifs@vger.kernel.org>; Tue, 28 Apr 2026 13:19:30 +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-222-Rm4Xk0pOPTi4hjsMKKIbFw-1; Tue,\n 28 Apr 2026 09:19:26 -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 17465195DE6C;\n\tTue, 28 Apr 2026 13:19:11 +0000 (UTC)","from warthog.procyon.org.com (unknown [10.44.32.126])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 60A92180047F;\n\tTue, 28 Apr 2026 13:19:08 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777382373; cv=none;\n b=J3Od3Gp97LkIeAzJgvwZ6tJ2KTSSLrzy33n7tBMSYeWitJvyyCWqskZQsOBoCtfhaO18M/ZVEUC2SkB/VG6z/VPPE1TkQqZ+aDBvf2P3bEC6Wn1vI9GaTZP0X7laNUASYLW1m8NM7TUVr/XalhxzCELsBi+4IFvFFQcZIY1DgYs=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777382373; c=relaxed/simple;\n\tbh=PhAVIry4RH7jejSdAGIhxh3RBLwcrsEnhZBSvVNQ6sU=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=Y0mVEayw/OAhYEpx3JtBJcbxVUa4b8dSa87EncoS5BYfwwFWGJUigmQLOopflXLXOb1cHDnhcPAxKiy8h4mp48PlpdZW0qNrFNtsIUWpOz6iSHCy3LgPcw3oPBMHxLlSACoFNqlT69o+tpxVMUE0fnqbT6/DE+c5N3o86PaKRpE=","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=RZmOQk9t; 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=1777382369;\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=YHPf6hGUWYEe9rJRq40F95gNcQEzsSyVW38x9qecVoo=;\n\tb=RZmOQk9tyByspPW9EXkzT+M/WnXeldzRPq+c9Kj3IgKxYv6okAvvizfNVJgQ+U/ZyD5xKw\n\tWTjIZcWhOEXJXGDj3jy7dc+ZU3hn8u4wQvvGD2u6rcZu7c2kSOi4ZKYQq7x7ENtPoZxsNR\n\tr9N8PZ7Sxm99jUZ20dOLOZ5c0pGU99w=","X-MC-Unique":"Rm4Xk0pOPTi4hjsMKKIbFw-1","X-Mimecast-MFC-AGG-ID":"Rm4Xk0pOPTi4hjsMKKIbFw_1777382363","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","Subject":"[PATCH v5 14/24] netfs: Fix potential deadlock in write-through mode","Date":"Tue, 28 Apr 2026 14:17:44 +0100","Message-ID":"<20260428131756.922303-15-dhowells@redhat.com>","In-Reply-To":"<20260428131756.922303-1-dhowells@redhat.com>","References":"<20260428131756.922303-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":"Fix netfs_advance_writethrough() to always unlock the supplied folio.  It's\nbeen marked for writeback and the caller is holding both inode->i_rwsem and\nictx->wb_lock, so there shouldn't be any danger of truncation, migration,\nfallocation, flushing or other I/O interfering whilst the folio is\nunlocked.\n\nNote that this may be easier to deal with once the queuing of folios is split\nfrom the generation of subrequests.\n\nFixes: 288ace2f57c9 (\"netfs: New writeback implementation\")\nCloses: https://sashiko.dev/#/patchset/20260427154639.180684-1-dhowells%40redhat.com\nSigned-off-by: David Howells <dhowells@redhat.com>\ncc: Paulo Alcantara <pc@manguebit.org>\ncc: netfs@lists.linux.dev\ncc: linux-fsdevel@vger.kernel.org\n---\n fs/netfs/write_issue.c | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)","diff":"diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c\nindex b0e9690bb90c..0b07ebecb157 100644\n--- a/fs/netfs/write_issue.c\n+++ b/fs/netfs/write_issue.c\n@@ -665,8 +665,10 @@ int netfs_advance_writethrough(struct netfs_io_request *wreq, struct writeback_c\n \t}\n \n \twreq->len += copied;\n-\tif (!to_page_end)\n+\tif (!to_page_end) {\n+\t\tfolio_unlock(folio);\n \t\treturn 0;\n+\t}\n \n \t*writethrough_cache = NULL;\n \treturn netfs_write_folio(wreq, wbc, folio);\n@@ -683,8 +685,10 @@ ssize_t netfs_end_writethrough(struct netfs_io_request *wreq, struct writeback_c\n \n \t_enter(\"R=%x\", wreq->debug_id);\n \n-\tif (writethrough_cache)\n+\tif (writethrough_cache) {\n+\t\tfolio_lock(writethrough_cache);\n \t\tnetfs_write_folio(wreq, wbc, writethrough_cache);\n+\t}\n \n \tnetfs_end_issue_write(wreq);\n \n","prefixes":["v5","14/24"]}