get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2229576/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2229576,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229576/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260428131756.922303-4-dhowells@redhat.com/",
    "project": {
        "id": 12,
        "url": "http://patchwork.ozlabs.org/api/1.1/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": ""
    },
    "msgid": "<20260428131756.922303-4-dhowells@redhat.com>",
    "date": "2026-04-28T13:17:33",
    "name": "[v5,03/24] netfs: Fix missing barriers when accessing stream->subrequests locklessly",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "35144f5c0099e007d4045647d58636e252c2c8ec",
    "submitter": {
        "id": 59,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/59/?format=api",
        "name": "David Howells",
        "email": "dhowells@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260428131756.922303-4-dhowells@redhat.com/mbox/",
    "series": [
        {
            "id": 501852,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/501852/?format=api",
            "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/2229576/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2229576/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <linux-cifs+bounces-11196-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=YzVF/04o;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-cifs+bounces-11196-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=\"YzVF/04o\"",
            "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 [172.234.253.10])\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 4g4hRK6ffcz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 23:41:17 +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 2B40B30EAE2A\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 13:26:35 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 66011472796;\n\tTue, 28 Apr 2026 13:19:11 +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 BC91347276B\n\tfor <linux-cifs@vger.kernel.org>; Tue, 28 Apr 2026 13:19:09 +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-138-S5GolzNdN86Oer4dIiRNcw-1; Tue,\n 28 Apr 2026 09:19:05 -0400",
            "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\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 3732C1805A01;\n\tTue, 28 Apr 2026 13:18:17 +0000 (UTC)",
            "from warthog.procyon.org.com (unknown [10.44.32.126])\n\tby mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 4B33C196B8FC;\n\tTue, 28 Apr 2026 13:18:14 +0000 (UTC)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777382351; cv=none;\n b=CWteT6rBe3okmWsrFtUDn8BHIYcqQFSzH+/EvZcnSbLTwLmQvYheBFg4rxxK07kHWj5WD08eIU30jNco3TSfA0/3vXcwvXRVFSHCP//tUcMnfI4A6+Y/nXQX5t0vpW3RzzBeWegHbnGBc9/W2gaQ0UCoS6De4xaXeNhKQaihkC8=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777382351; c=relaxed/simple;\n\tbh=eC23EDiq5qIGKq4ga5PcDMq7oBfvyAuTD3k4pCVIMa8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=L2nLu+Im+9xFZNVolVy+Fy5U6hensM+aWpdRp+bRN402hrfJwYiWcdUQqkUIwjfhBu3O3HjVZJXTebNUqkl/tn6kmvVCo9VGMl1mCaWoRzBpbccwCLDzsPs3ftlzMNBuwcQqLtybPIdpqp7e8uEU701eqH1cQlhL8nEM4tgcpas=",
        "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=YzVF/04o; 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=1777382348;\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=i68buiFPTMRi+TuWqayB/dF5laOKYLtNXEY9ZJMxAJg=;\n\tb=YzVF/04oxR0+M7QyMEZCsDYKsUeyhcKmkoxrHZ+LxXGhQzDUOZPhRmtKEpNUBTqKcyvxtH\n\tS6OornuP5TylfCjP01dQkW3k/NG1MSd+lazAdvSKsKe5MIgTy+19xRpBUtXc/8K+eoo+w7\n\tLo3G+xfZePkfg2XSrKbeVVZFG5KMjKs=",
        "X-MC-Unique": "S5GolzNdN86Oer4dIiRNcw-1",
        "X-Mimecast-MFC-AGG-ID": "S5GolzNdN86Oer4dIiRNcw_1777382344",
        "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 03/24] netfs: Fix missing barriers when accessing\n stream->subrequests locklessly",
        "Date": "Tue, 28 Apr 2026 14:17:33 +0100",
        "Message-ID": "<20260428131756.922303-4-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.0 on 10.30.177.17"
    },
    "content": "The list of subrequests attached to stream->subrequests is accessed without\nlocks by netfs_collect_read_results() and netfs_collect_write_results(),\nand then they access subreq->flags without taking a barrier after getting\nthe subreq pointer from the list.  Relatedly, the functions that build the\nlist don't use any sort of write barrier when constructing the list to make\nsure that the NETFS_SREQ_IN_PROGRESS flag is perceived to be set first if\nno lock is taken.\n\nFix this by:\n\n (1) Add a new list_add_tail_release() function that uses a release barrier\n     to set the pointer to the new member of the list.\n\n (2) Add a new list_first_entry_or_null_acquire() function that uses an\n     acquire barrier to read the pointer to the first member in a list (or\n     return NULL).\n\n (3) Use list_add_tail_release() when adding a subreq to ->subrequests.\n\n (4) Use list_first_entry_or_null_acquire() when initially accessing the\n     front of the list (when an item is removed, the pointer to the new\n     front iterm is obtained under the same lock).\n\nFixes: e2d46f2ec332 (\"netfs: Change the read result collector to only use one work item\")\nFixes: 288ace2f57c9 (\"netfs: New writeback implementation\")\nLink: https://sashiko.dev/#/patchset/20260326104544.509518-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/buffered_read.c |  3 ++-\n fs/netfs/misc.c          |  1 +\n fs/netfs/read_collect.c  |  6 ++++--\n fs/netfs/write_collect.c |  6 ++++--\n fs/netfs/write_issue.c   |  3 ++-\n include/linux/list.h     | 37 +++++++++++++++++++++++++++++++++++++\n 6 files changed, 50 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c\nindex 286c93fc681e..7ec11893552d 100644\n--- a/fs/netfs/buffered_read.c\n+++ b/fs/netfs/buffered_read.c\n@@ -168,7 +168,8 @@ void netfs_queue_read(struct netfs_io_request *rreq,\n \t * remove entries off of the front.\n \t */\n \tspin_lock(&rreq->lock);\n-\tlist_add_tail(&subreq->rreq_link, &stream->subrequests);\n+\t/* Write IN_PROGRESS before pointer to new subreq */\n+\tlist_add_tail_release(&subreq->rreq_link, &stream->subrequests);\n \tif (list_is_first(&subreq->rreq_link, &stream->subrequests)) {\n \t\tif (!stream->active) {\n \t\t\tstream->collected_to = subreq->start;\ndiff --git a/fs/netfs/misc.c b/fs/netfs/misc.c\nindex 6df89c92b10b..21357907b7ee 100644\n--- a/fs/netfs/misc.c\n+++ b/fs/netfs/misc.c\n@@ -356,6 +356,7 @@ void netfs_wait_for_in_progress_stream(struct netfs_io_request *rreq,\n \tDEFINE_WAIT(myself);\n \n \tlist_for_each_entry(subreq, &stream->subrequests, rreq_link) {\n+\t\tsmp_rmb(); /* Read ->next before IN_PROGRESS. */\n \t\tif (!netfs_check_subreq_in_progress(subreq))\n \t\t\tcontinue;\n \ndiff --git a/fs/netfs/read_collect.c b/fs/netfs/read_collect.c\nindex d2d902f46627..3c9b847885c2 100644\n--- a/fs/netfs/read_collect.c\n+++ b/fs/netfs/read_collect.c\n@@ -205,8 +205,10 @@ static void netfs_collect_read_results(struct netfs_io_request *rreq)\n \t * in progress.  The issuer thread may be adding stuff to the tail\n \t * whilst we're doing this.\n \t */\n-\tfront = list_first_entry_or_null(&stream->subrequests,\n-\t\t\t\t\t struct netfs_io_subrequest, rreq_link);\n+\tfront = list_first_entry_or_null_acquire(&stream->subrequests,\n+\t\t\t\t\t\t struct netfs_io_subrequest, rreq_link);\n+\t/* Read first subreq pointer before IN_PROGRESS flag. */\n+\n \twhile (front) {\n \t\tsize_t transferred;\n \ndiff --git a/fs/netfs/write_collect.c b/fs/netfs/write_collect.c\nindex b194447f4b11..7fbf50907a7f 100644\n--- a/fs/netfs/write_collect.c\n+++ b/fs/netfs/write_collect.c\n@@ -228,8 +228,10 @@ static void netfs_collect_write_results(struct netfs_io_request *wreq)\n \t\tif (!smp_load_acquire(&stream->active))\n \t\t\tcontinue;\n \n-\t\tfront = list_first_entry_or_null(&stream->subrequests,\n-\t\t\t\t\t\t struct netfs_io_subrequest, rreq_link);\n+\t\tfront = list_first_entry_or_null_acquire(&stream->subrequests,\n+\t\t\t\t\t\t\t struct netfs_io_subrequest, rreq_link);\n+\t\t/* Read first subreq pointer before IN_PROGRESS flag. */\n+\n \t\twhile (front) {\n \t\t\ttrace_netfs_collect_sreq(wreq, front);\n \t\t\t//_debug(\"sreq [%x] %llx %zx/%zx\",\ndiff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c\nindex 2db688f94125..b0e9690bb90c 100644\n--- a/fs/netfs/write_issue.c\n+++ b/fs/netfs/write_issue.c\n@@ -204,7 +204,8 @@ void netfs_prepare_write(struct netfs_io_request *wreq,\n \t * remove entries off of the front.\n \t */\n \tspin_lock(&wreq->lock);\n-\tlist_add_tail(&subreq->rreq_link, &stream->subrequests);\n+\t/* Write IN_PROGRESS before pointer to new subreq */\n+\tlist_add_tail_release(&subreq->rreq_link, &stream->subrequests);\n \tif (list_is_first(&subreq->rreq_link, &stream->subrequests)) {\n \t\tif (!stream->active) {\n \t\t\tstream->collected_to = subreq->start;\ndiff --git a/include/linux/list.h b/include/linux/list.h\nindex 00ea8e5fb88b..09d979976b3b 100644\n--- a/include/linux/list.h\n+++ b/include/linux/list.h\n@@ -191,6 +191,29 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)\n \t__list_add(new, head->prev, head);\n }\n \n+/**\n+ * list_add_tail_release - add a new entry with release barrier\n+ * @new: new entry to be added\n+ * @head: list head to add it before\n+ *\n+ * Insert a new entry before the specified head, using a release barrier to set\n+ * the ->next pointer that points to it.  This is useful for implementing\n+ * queues, in particular one that the elements will be walked through forwards\n+ * locklessly.\n+ */\n+static inline void list_add_tail_release(struct list_head *new,\n+\t\t\t\t\t struct list_head *head)\n+{\n+\tstruct list_head *prev = head->prev;\n+\n+\tif (__list_add_valid(new, prev, head)) {\n+\t\tnew->next = head;\n+\t\tnew->prev = prev;\n+\t\thead->prev = new;\n+\t\tsmp_store_release(&prev->next, new);\n+\t}\n+}\n+\n /*\n  * Delete a list entry by making the prev/next entries\n  * point to each other.\n@@ -644,6 +667,20 @@ static inline void list_splice_tail_init(struct list_head *list,\n \tpos__ != head__ ? list_entry(pos__, type, member) : NULL; \\\n })\n \n+/**\n+ * list_first_entry_or_null_acquire - get the first element from a list with barrier\n+ * @ptr:\tthe list head to take the element from.\n+ * @type:\tthe type of the struct this is embedded in.\n+ * @member:\tthe name of the list_head within the struct.\n+ *\n+ * Note that if the list is empty, it returns NULL.\n+ */\n+#define list_first_entry_or_null_acquire(ptr, type, member) ({ \\\n+\tstruct list_head *head__ = (ptr); \\\n+\tstruct list_head *pos__ = smp_load_acquire(&head__->next); \\\n+\tpos__ != head__ ? list_entry(pos__, type, member) : NULL; \\\n+})\n+\n /**\n  * list_last_entry_or_null - get the last element from a list\n  * @ptr:\tthe list head to take the element from.\n",
    "prefixes": [
        "v5",
        "03/24"
    ]
}