get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2226494,
    "url": "http://patchwork.ozlabs.org/api/patches/2226494/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260422135823.50489-3-ja@ssi.bg/",
    "project": {
        "id": 26,
        "url": "http://patchwork.ozlabs.org/api/projects/26/?format=api",
        "name": "Netfilter Development",
        "link_name": "netfilter-devel",
        "list_id": "netfilter-devel.vger.kernel.org",
        "list_email": "netfilter-devel@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260422135823.50489-3-ja@ssi.bg>",
    "list_archive_url": null,
    "date": "2026-04-22T13:58:22",
    "name": "[PATCHv3,net,2/3] ipvs: fix races around the conn_lfactor and svc_lfactor sysctl vars",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "6c6d3e1c2aa9f7ba3aef54368828b03d5bdac1fb",
    "submitter": {
        "id": 2825,
        "url": "http://patchwork.ozlabs.org/api/people/2825/?format=api",
        "name": "Julian Anastasov",
        "email": "ja@ssi.bg"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260422135823.50489-3-ja@ssi.bg/mbox/",
    "series": [
        {
            "id": 501015,
            "url": "http://patchwork.ozlabs.org/api/series/501015/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=501015",
            "date": "2026-04-22T13:58:20",
            "name": "IPVS: fixes after the new hash tables",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/501015/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2226494/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2226494/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <netfilter-devel+bounces-12134-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "netfilter-devel@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (4096-bit key;\n unprotected) header.d=ssi.bg header.i=@ssi.bg header.a=rsa-sha256\n header.s=ssi header.b=YQ0zh3Tf;\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=netfilter-devel+bounces-12134-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (4096-bit key) header.d=ssi.bg header.i=@ssi.bg header.b=\"YQ0zh3Tf\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=193.238.174.39",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=ssi.bg",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=ssi.bg"
        ],
        "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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g11HL6Jl9z1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 00:06:38 +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 024D830B5B9D\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 13:58:49 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 0CE3A235C01;\n\tWed, 22 Apr 2026 13:58:48 +0000 (UTC)",
            "from mx.ssi.bg (mx.ssi.bg [193.238.174.39])\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 234603EAC60;\n\tWed, 22 Apr 2026 13:58:44 +0000 (UTC)",
            "from mx.ssi.bg (localhost [127.0.0.1])\n\tby mx.ssi.bg (Potsfix) with ESMTP id 5961021267;\n\tWed, 22 Apr 2026 16:58:36 +0300 (EEST)",
            "from box.ssi.bg (box.ssi.bg [193.238.174.46])\n\tby mx.ssi.bg (Potsfix) with ESMTPS;\n\tWed, 22 Apr 2026 16:58:34 +0300 (EEST)",
            "from ja.ssi.bg (unknown [213.16.62.126])\n\tby box.ssi.bg (Potsfix) with ESMTPSA id 8ED3560EE6;\n\tWed, 22 Apr 2026 16:58:34 +0300 (EEST)",
            "from ja.home.ssi.bg (localhost.localdomain [127.0.0.1])\n\tby ja.ssi.bg (8.18.1/8.18.1) with ESMTP id 63MDwYS7050517;\n\tWed, 22 Apr 2026 16:58:34 +0300",
            "(from root@localhost)\n\tby ja.home.ssi.bg (8.18.1/8.18.1/Submit) id 63MDwYPr050516;\n\tWed, 22 Apr 2026 16:58:34 +0300"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776866326; cv=none;\n b=Lcjzbq5mzID/WO9Owkx4Ao/2A+jqNiK8uqx1jjNk34+hJwlk/kZzGhoGQCjwFJ/JFm6dQj+pUp3RcZq5QaU1ofC8Gc5XpqcJ5y7xK8cfi0uDj6jXxkahMI2TjNp9FQaerTX8Soy0iqB6q4i9q26Y9dVPbphQz3/qKlx9iOOHZPY=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776866326; c=relaxed/simple;\n\tbh=QqMJ8APZXAv/jThgzkl48ZDqf4rg3RNwu38GuypsDSw=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=MM1IQOz2dPVF8xRFgYzmg/D021NtpolM/kBQLrl6m5JATZZRvdJKpsb+XH6mHGUSrszVAoA53BOgQ92QxUTrV/TIiIgsqph5kiunddzUvbHaKhF1r+YpXSMBcTSah1HB0xzYC4GA0nY5FiWSadhuWeehHLZj2ra8epDNuI8gDrY=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=ssi.bg;\n spf=pass smtp.mailfrom=ssi.bg;\n dkim=pass (4096-bit key) header.d=ssi.bg header.i=@ssi.bg header.b=YQ0zh3Tf;\n arc=none smtp.client-ip=193.238.174.39",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ssi.bg; h=cc:cc\n\t:content-transfer-encoding:date:from:from:in-reply-to:message-id\n\t:mime-version:references:reply-to:subject:subject:to:to; s=ssi;\n\t bh=HWSPzETrY78Q6YnxMY7oGENlOhhIgC8vQ9vEXd3xBuI=; b=YQ0zh3TfLzLH\n\tj4Xf9adASkNRShzHUrGcT02kCSKodw9wm55zAyzjCDL9yrCjIuZUJ72Hv/bKrV8c\n\tOSAS8qAMPwjFdom8MIcLAh5pZJSEcxNGAeoMOiB2gViwuvRkPCj2S8n5PbqYq3tD\n\tYO5b89ICKfrOV37zCyEZWaqesgIommLFkaK96MrDp4cn/H1iHF3uIvr7SlC0dyID\n\tmSNTs4uI0CIvh601t0k8sOimyZeigVmfYOoJIzNJyMysqYAPVvfj1f32tNcQuG+U\n\tVibqGDm46Jsom4hIDSSiuzc6ihSu1U86ymoezhIBZl/llbfWhmXxl1eu64DsR/VD\n\tFitRhWflGxEMtlUyJUXGvriwOAAMYkmyZxL7poZjG16xeQSNupjyquS0ImnNMz/n\n\tAyQfPtHV9R7Uo+xFqjETJ2h+Kp2O5BYZyi8rd3345uoYZd5gs4SbLSx7+13uJtAc\n\t7TW0m18SiAfXoKSDMhmQbmwfIvIcjkoMqatCOW0FD8HdKA0ly2lLmzlcJVf+ajFP\n\th2RSuVHkknrOGVM5QrohPgjP3xi047wcryCcthWW/PtXhgZdZBf9ni20/ytFJRwz\n\tFxzxqnyzjs8GxfqPNC8e1yZUXXH21ta0hhdRcbGCEf5uTmVP+xVQJWFxH0/3DexB\n\tJ9Pt7fVOgGb/pyzVhSxfgDqq/FkCqx0=",
        "From": "Julian Anastasov <ja@ssi.bg>",
        "To": "Simon Horman <horms@verge.net.au>",
        "Cc": "Pablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>,\n        lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org",
        "Subject": "[PATCHv3 net 2/3] ipvs: fix races around the conn_lfactor and\n svc_lfactor sysctl vars",
        "Date": "Wed, 22 Apr 2026 16:58:22 +0300",
        "Message-ID": "<20260422135823.50489-3-ja@ssi.bg>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260422135823.50489-1-ja@ssi.bg>",
        "References": "<20260422135823.50489-1-ja@ssi.bg>",
        "Precedence": "bulk",
        "X-Mailing-List": "netfilter-devel@vger.kernel.org",
        "List-Id": "<netfilter-devel.vger.kernel.org>",
        "List-Subscribe": "<mailto:netfilter-devel+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:netfilter-devel+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit"
    },
    "content": "Sashiko warns that the new sysctls vars can be changed\nafter the hash tables are destroyed and their respective\nresizing works canceled, leading to mod_delayed_work()\nbeing called for canceled works.\n\nSolve this in different ways. conn_tab can be present even\nwithout services and is destroyed only on netns exit, so use\ndisable_delayed_work_sync() to disable the work instead of\nadding more synchronization mechanisms.\n\nAs for the svc_table, it is destroyed when the services\nare deleted, so we must be sure that netns exit is not\ncalled yet (the check for 'enable') and the work is\nnot canceled by checking all under same mutex lock.\n\nAlso, use WRITE_ONCE when updating the sysctl vars as we\nalready read them with READ_ONCE.\n\nLink: https://sashiko.dev/#/patchset/20260410112352.23599-1-fw%40strlen.de\nSigned-off-by: Julian Anastasov <ja@ssi.bg>\n---\n net/netfilter/ipvs/ip_vs_conn.c |  2 +-\n net/netfilter/ipvs/ip_vs_ctl.c  | 12 +++++++++---\n 2 files changed, 10 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c\nindex 2082bfb2d93c..84a4921a7865 100644\n--- a/net/netfilter/ipvs/ip_vs_conn.c\n+++ b/net/netfilter/ipvs/ip_vs_conn.c\n@@ -1835,7 +1835,7 @@ static void ip_vs_conn_flush(struct netns_ipvs *ipvs)\n \n \tif (!rcu_dereference_protected(ipvs->conn_tab, 1))\n \t\treturn;\n-\tcancel_delayed_work_sync(&ipvs->conn_resize_work);\n+\tdisable_delayed_work_sync(&ipvs->conn_resize_work);\n \tif (!atomic_read(&ipvs->conn_count))\n \t\tgoto unreg;\n \ndiff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c\nindex 27e50afe9a54..caec516856e9 100644\n--- a/net/netfilter/ipvs/ip_vs_ctl.c\n+++ b/net/netfilter/ipvs/ip_vs_ctl.c\n@@ -2469,7 +2469,7 @@ static int ipvs_proc_conn_lfactor(const struct ctl_table *table, int write,\n \t\tif (val < -8 || val > 8) {\n \t\t\tret = -EINVAL;\n \t\t} else {\n-\t\t\t*valp = val;\n+\t\t\tWRITE_ONCE(*valp, val);\n \t\t\tif (rcu_access_pointer(ipvs->conn_tab))\n \t\t\t\tmod_delayed_work(system_unbound_wq,\n \t\t\t\t\t\t &ipvs->conn_resize_work, 0);\n@@ -2496,10 +2496,16 @@ static int ipvs_proc_svc_lfactor(const struct ctl_table *table, int write,\n \t\tif (val < -8 || val > 8) {\n \t\t\tret = -EINVAL;\n \t\t} else {\n-\t\t\t*valp = val;\n-\t\t\tif (rcu_access_pointer(ipvs->svc_table))\n+\t\t\tmutex_lock(&ipvs->service_mutex);\n+\t\t\tWRITE_ONCE(*valp, val);\n+\t\t\t/* Make sure the services are present */\n+\t\t\tif (rcu_access_pointer(ipvs->svc_table) &&\n+\t\t\t    READ_ONCE(ipvs->enable) &&\n+\t\t\t    !test_bit(IP_VS_WORK_SVC_NORESIZE,\n+\t\t\t\t      &ipvs->work_flags))\n \t\t\t\tmod_delayed_work(system_unbound_wq,\n \t\t\t\t\t\t &ipvs->svc_resize_work, 0);\n+\t\t\tmutex_unlock(&ipvs->service_mutex);\n \t\t}\n \t}\n \treturn ret;\n",
    "prefixes": [
        "PATCHv3",
        "net",
        "2/3"
    ]
}