{"id":2229591,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2229591/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260428131756.922303-3-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-3-dhowells@redhat.com>","date":"2026-04-28T13:17:32","name":"[v5,02/24] netfs: Fix missing locking around retry adding new subreqs","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8244280cf2e38642db08fb82f6c18c4686defa48","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-3-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/2229591/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2229591/checks/","tags":{},"headers":{"Return-Path":"\n <linux-cifs+bounces-11194-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=T/imkzqk;\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-11194-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=\"T/imkzqk\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=170.10.129.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)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4htm6xqlz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 00:01:36 +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 8D2D23251DD3\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 13:26:24 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 85B7D46AF2F;\n\tTue, 28 Apr 2026 13:19:09 +0000 (UTC)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.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 E6A7047276B\n\tfor <linux-cifs@vger.kernel.org>; Tue, 28 Apr 2026 13:19:07 +0000 (UTC)","from mx-prod-mc-08.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-341-53Ejn19wPNSPVfWSlsUvmQ-1; Tue,\n 28 Apr 2026 09:19:03 -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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id AC63E18B7CE3;\n\tTue, 28 Apr 2026 13:18:12 +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 6E3771800348;\n\tTue, 28 Apr 2026 13:18:08 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777382349; cv=none;\n b=MODo80ySVl6bNFjFCzyLhgB+cGtIb5oHHTes9jNLRQoNO/wWyIcMozD4/c+mrf17VuxRVWbvIGwuXIR0W1uVQtfa4SLSEHn0qQDBGgo7lGWbJAIwRU1adw0JgBWx4+EzaZjJfbj9W+Hu1wmVmx50Udc30yZgmS75oCmnuaFbDYs=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777382349; c=relaxed/simple;\n\tbh=xKMwK6XyTR2S1NYi1ll51KBolxqfDxdt7e/1pyWESn8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=TkLSejFN2a16ynq4r2JidZuv0sBr1cidRPTlZL1KQySgeUcYL6TzoMK90E1TEt5xsQDXFPHFP0o4sfshkMiGc1BQ5mMUUm6lqaLpsnozLkm6EL2aVI7X62TLrEVcM7Ib7LPJTqRN5jgpzsBPlba0HXvnypbTQhg9FBmoiWii3yk=","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=T/imkzqk; arc=none smtp.client-ip=170.10.129.124","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1777382347;\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=I9C1Tq0bWPjxQKHy18dUxRo+Gdg144k5WV4DnkH5buY=;\n\tb=T/imkzqkyy5zP/GYl/WuNWpp4oPh2V2jGH5of0WcCQ9uC4KiHSAwxbtMiOwUs1i+nbsDCv\n\t0XAz3MICcp+Lb/bdY4R44ImTyYUFYDuMfrO70LG720IUDpRO9CNFEY2ucp77qqy/u0ypq3\n\tqiwqBQBao8Za9sxraQVbCTYhNyoFBF8=","X-MC-Unique":"53Ejn19wPNSPVfWSlsUvmQ-1","X-Mimecast-MFC-AGG-ID":"53Ejn19wPNSPVfWSlsUvmQ_1777382341","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 02/24] netfs: Fix missing locking around retry adding new\n subreqs","Date":"Tue, 28 Apr 2026 14:17:32 +0100","Message-ID":"<20260428131756.922303-3-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_retry_read_subrequests() and netfs_retry_write_stream() to take\nthe appropriate lock when adding extra subrequests into\nstream->subrequests.\n\nFixes: e2d46f2ec332 (\"netfs: Change the read result collector to only use one work item\")\nFixes: 288ace2f57c9 (\"netfs: New writeback implementation\")\nCloses: https://sashiko.dev/#/patchset/20260425125426.3855807-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/read_retry.c  | 6 +++++-\n fs/netfs/write_retry.c | 6 +++++-\n 2 files changed, 10 insertions(+), 2 deletions(-)","diff":"diff --git a/fs/netfs/read_retry.c b/fs/netfs/read_retry.c\nindex cca9ac43c077..5ec548b996d6 100644\n--- a/fs/netfs/read_retry.c\n+++ b/fs/netfs/read_retry.c\n@@ -175,7 +175,9 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq)\n \t\t\tlist_for_each_entry_safe_from(subreq, tmp,\n \t\t\t\t\t\t      &stream->subrequests, rreq_link) {\n \t\t\t\ttrace_netfs_sreq(subreq, netfs_sreq_trace_superfluous);\n+\t\t\t\tspin_lock(&rreq->lock);\n \t\t\t\tlist_del(&subreq->rreq_link);\n+\t\t\t\tspin_unlock(&rreq->lock);\n \t\t\t\tnetfs_put_subrequest(subreq, netfs_sreq_trace_put_done);\n \t\t\t\tif (subreq == to)\n \t\t\t\t\tbreak;\n@@ -203,8 +205,10 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq)\n \t\t\t\t\t     refcount_read(&subreq->ref),\n \t\t\t\t\t     netfs_sreq_trace_new);\n \n+\t\t\tspin_lock(&rreq->lock);\n \t\t\tlist_add(&subreq->rreq_link, &to->rreq_link);\n-\t\t\tto = list_next_entry(to, rreq_link);\n+\t\t\tspin_unlock(&rreq->lock);\n+\t\t\tto = subreq;\n \t\t\ttrace_netfs_sreq(subreq, netfs_sreq_trace_retry);\n \n \t\t\tstream->sreq_max_len\t= umin(len, rreq->rsize);\ndiff --git a/fs/netfs/write_retry.c b/fs/netfs/write_retry.c\nindex 29489a23a220..32735abfa03f 100644\n--- a/fs/netfs/write_retry.c\n+++ b/fs/netfs/write_retry.c\n@@ -130,7 +130,9 @@ static void netfs_retry_write_stream(struct netfs_io_request *wreq,\n \t\t\tlist_for_each_entry_safe_from(subreq, tmp,\n \t\t\t\t\t\t      &stream->subrequests, rreq_link) {\n \t\t\t\ttrace_netfs_sreq(subreq, netfs_sreq_trace_discard);\n+\t\t\t\tspin_lock(&wreq->lock);\n \t\t\t\tlist_del(&subreq->rreq_link);\n+\t\t\t\tspin_unlock(&wreq->lock);\n \t\t\t\tnetfs_put_subrequest(subreq, netfs_sreq_trace_put_done);\n \t\t\t\tif (subreq == to)\n \t\t\t\t\tbreak;\n@@ -153,8 +155,10 @@ static void netfs_retry_write_stream(struct netfs_io_request *wreq,\n \t\t\t\t\t     netfs_sreq_trace_new);\n \t\t\ttrace_netfs_sreq(subreq, netfs_sreq_trace_split);\n \n+\t\t\tspin_lock(&wreq->lock);\n \t\t\tlist_add(&subreq->rreq_link, &to->rreq_link);\n-\t\t\tto = list_next_entry(to, rreq_link);\n+\t\t\tspin_unlock(&wreq->lock);\n+\t\t\tto = subreq;\n \t\t\ttrace_netfs_sreq(subreq, netfs_sreq_trace_retry);\n \n \t\t\tstream->sreq_max_len\t= len;\n","prefixes":["v5","02/24"]}