Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2196529/?format=api
{ "id": 2196529, "url": "http://patchwork.ozlabs.org/api/patches/2196529/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260214151230.18970-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": "<20260214151230.18970-3-ja@ssi.bg>", "list_archive_url": null, "date": "2026-02-14T15:12:26", "name": "[nf-next,2/6] ipvs: some service readers can use RCU", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3b0396175e1ad62bbf2781ed385f0d5601db2b28", "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/20260214151230.18970-3-ja@ssi.bg/mbox/", "series": [ { "id": 492179, "url": "http://patchwork.ozlabs.org/api/series/492179/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=492179", "date": "2026-02-14T15:12:24", "name": "IPVS changes, part 2 of 4 - optimizations", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/492179/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2196529/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2196529/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <netfilter-devel+bounces-10777-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=Z/nmAHzp;\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-10777-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=\"Z/nmAHzp\"", "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)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fCt2j2z6pz1xr1\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 15 Feb 2026 02:18:05 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 68323301FD6B\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 14 Feb 2026 15:18:00 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 4F58725F96B;\n\tSat, 14 Feb 2026 15:17:59 +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 43347189F43;\n\tSat, 14 Feb 2026 15:17:56 +0000 (UTC)", "from mx.ssi.bg (localhost [127.0.0.1])\n\tby mx.ssi.bg (Potsfix) with ESMTP id 689A621D6D;\n\tSat, 14 Feb 2026 17:17:48 +0200 (EET)", "from box.ssi.bg (box.ssi.bg [193.238.174.46])\n\tby mx.ssi.bg (Potsfix) with ESMTPS;\n\tSat, 14 Feb 2026 17:17:46 +0200 (EET)", "from ja.ssi.bg (unknown [213.16.62.126])\n\tby box.ssi.bg (Potsfix) with ESMTPSA id 39DAC61B7A;\n\tSat, 14 Feb 2026 17:17:46 +0200 (EET)", "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 61EFCvDt019350;\n\tSat, 14 Feb 2026 17:12:57 +0200", "(from root@localhost)\n\tby ja.home.ssi.bg (8.18.1/8.18.1/Submit) id 61EFCvmI019349;\n\tSat, 14 Feb 2026 17:12:57 +0200" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1771082278; cv=none;\n b=taeMfAvgQEiSbKyj3iu7F56TvVbnzH/rA2H3QMu3NYTNLOmCO8xEsAou5GlMLnjsdHy1FQaDGR7YAcg6wJBvWE8NxXJFyeUSQzze/7XdJ3MmXj1YYUjy0JdKZNwLew1QV7n+u/Lxy4Z5JSOxzyL3xBP7kBQF9K2iJrJ9kJ3WIzc=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1771082278; c=relaxed/simple;\n\tbh=BxyoGBXLKGdmtN9ri17uOhBVH5ThPhTsEnqBkCisJuI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=MGWri5DcbapoBvau7GD/rLNkU+KO/FwXBR3K1bVwUvy3lUsKrpE02VNHdMwMISju4BMAzPqBgLGaGju2FahWAaS3ZYB8aZJrW6ZnQ2xt2dmVUvthGydNTEqnRXclAxHMKG5LpS1HA1Fldnmgy8Dn5riufCElY01aL7cQh58m/uM=", "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=Z/nmAHzp;\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=XhIyr/dv1oRX8rqqq9SfJV+/BRMIGevUcG+ALFFgjuE=; b=Z/nmAHzprgjI\n\tYt4ivkljj21dbmXXdpbMaMmRUslWPcYU1qSPtUY9lDoWWJoOFzzrNuovOpEVU19t\n\tEAfu/QiN5tCnnYN4LBXnquTflgxfoYnfZx/5gjgIi8x1h7MoFKPTMiKWvhKpJEqR\n\t+gg919oHJ1/pLrGC0w+/zvnZKCtg5x1xCtg8As3W/sM5b+9E15BtrUJpbMEiQAYS\n\tM7u1Yt/NucN4BIRG8TN7gvJAkBZkzZVJ9sJ8LbYGPhY9cQNdfaT5xXlDf2Rdq4J9\n\tkaBJa6BlVazRaqzvKnM7LM0GdBaYtuxCV0nqpG6bJDEGuh4swXKneYo6xYAff9+C\n\twmCodoJV5Ktb98KajpDebCHYC++pkn/ncFgzQHNI0nxVPOVcWCLZUHzTv6K6vc+o\n\tuK99qxuLoNNbWzgPxM1HVLFtNw136YCS8xEqg/52lQ31/gYZmvNCvn0GqRlbqdqb\n\tHJ+e7tSwc7R/nb1nz6H/yh8lkU0A7PHRYFtx4NPWaPP3FbDLQCndmPIHuBcV7jCz\n\toCm9cD60WdKbP2lkt6lfvBITDrDd/Fc0w3hACBkJza8R2yqbxze6ulAiHD/KxUqk\n\t8ewv4FjL8jvQJkO/qFNTDuCLpUqoj4/yujzryUuRbmE7NNIRmfwxtft7C+W3mI5H\n\t1Y1HO9qJBA2qFkyKFIqOS79/GbfomHA=", "From": "Julian Anastasov <ja@ssi.bg>", "To": "Simon Horman <horms@verge.net.au>", "Cc": "Pablo Neira Ayuso <pablo@netfilter.org>, lvs-devel@vger.kernel.org,\n netfilter-devel@vger.kernel.org, Dust Li <dust.li@linux.alibaba.com>,\n Jiejian Wu <jiejian@linux.alibaba.com>", "Subject": "[PATCH nf-next 2/6] ipvs: some service readers can use RCU", "Date": "Sat, 14 Feb 2026 17:12:26 +0200", "Message-ID": "<20260214151230.18970-3-ja@ssi.bg>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260214151230.18970-1-ja@ssi.bg>", "References": "<20260214151230.18970-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": "Some places walk the services under mutex but they can just use RCU:\n\n* ip_vs_dst_event() uses ip_vs_forget_dev() which uses its own lock\n to modify dest\n* ip_vs_genl_dump_services(): ip_vs_genl_fill_service() just fills skb\n* ip_vs_genl_parse_service(): move RCU lock to callers\n ip_vs_genl_set_cmd(), ip_vs_genl_dump_dests() and ip_vs_genl_get_cmd()\n* ip_vs_genl_dump_dests(): just fill skb\n\nSigned-off-by: Julian Anastasov <ja@ssi.bg>\nReviewed-by: Dust Li <dust.li@linux.alibaba.com>\n---\n net/netfilter/ipvs/ip_vs_ctl.c | 47 +++++++++++++++++-----------------\n 1 file changed, 23 insertions(+), 24 deletions(-)", "diff": "diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c\nindex d871273ce917..b9eaf048a29f 100644\n--- a/net/netfilter/ipvs/ip_vs_ctl.c\n+++ b/net/netfilter/ipvs/ip_vs_ctl.c\n@@ -1758,23 +1758,21 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,\n \tif (event != NETDEV_DOWN || !ipvs)\n \t\treturn NOTIFY_DONE;\n \tIP_VS_DBG(3, \"%s() dev=%s\\n\", __func__, dev->name);\n-\tmutex_lock(&ipvs->service_mutex);\n+\trcu_read_lock();\n \tfor (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {\n-\t\thlist_for_each_entry(svc, &ipvs->svc_table[idx], s_list) {\n-\t\t\tlist_for_each_entry(dest, &svc->destinations,\n-\t\t\t\t\t n_list) {\n+\t\thlist_for_each_entry_rcu(svc, &ipvs->svc_table[idx], s_list)\n+\t\t\tlist_for_each_entry_rcu(dest, &svc->destinations,\n+\t\t\t\t\t\tn_list)\n \t\t\t\tip_vs_forget_dev(dest, dev);\n-\t\t\t}\n-\t\t}\n \n-\t\thlist_for_each_entry(svc, &ipvs->svc_fwm_table[idx], f_list) {\n-\t\t\tlist_for_each_entry(dest, &svc->destinations,\n-\t\t\t\t\t n_list) {\n+\t\thlist_for_each_entry_rcu(svc, &ipvs->svc_fwm_table[idx], f_list)\n+\t\t\tlist_for_each_entry_rcu(dest, &svc->destinations,\n+\t\t\t\t\t\tn_list)\n \t\t\t\tip_vs_forget_dev(dest, dev);\n-\t\t\t}\n-\t\t}\n \t}\n+\trcu_read_unlock();\n \n+\tmutex_lock(&ipvs->service_mutex);\n \tspin_lock_bh(&ipvs->dest_trash_lock);\n \tlist_for_each_entry(dest, &ipvs->dest_trash, t_list) {\n \t\tip_vs_forget_dev(dest, dev);\n@@ -3317,9 +3315,9 @@ static int ip_vs_genl_fill_service(struct sk_buff *skb,\n \t\t\tgoto nla_put_failure;\n \t}\n \n-\tsched = rcu_dereference_protected(svc->scheduler, 1);\n+\tsched = rcu_dereference(svc->scheduler);\n \tsched_name = sched ? sched->name : \"none\";\n-\tpe = rcu_dereference_protected(svc->pe, 1);\n+\tpe = rcu_dereference(svc->pe);\n \tif (nla_put_string(skb, IPVS_SVC_ATTR_SCHED_NAME, sched_name) ||\n \t (pe && nla_put_string(skb, IPVS_SVC_ATTR_PE_NAME, pe->name)) ||\n \t nla_put(skb, IPVS_SVC_ATTR_FLAGS, sizeof(flags), &flags) ||\n@@ -3373,9 +3371,9 @@ static int ip_vs_genl_dump_services(struct sk_buff *skb,\n \tstruct net *net = sock_net(skb->sk);\n \tstruct netns_ipvs *ipvs = net_ipvs(net);\n \n-\tmutex_lock(&ipvs->service_mutex);\n+\trcu_read_lock();\n \tfor (i = 0; i < IP_VS_SVC_TAB_SIZE; i++) {\n-\t\thlist_for_each_entry(svc, &ipvs->svc_table[i], s_list) {\n+\t\thlist_for_each_entry_rcu(svc, &ipvs->svc_table[i], s_list) {\n \t\t\tif (++idx <= start)\n \t\t\t\tcontinue;\n \t\t\tif (ip_vs_genl_dump_service(skb, svc, cb) < 0) {\n@@ -3386,7 +3384,7 @@ static int ip_vs_genl_dump_services(struct sk_buff *skb,\n \t}\n \n \tfor (i = 0; i < IP_VS_SVC_TAB_SIZE; i++) {\n-\t\thlist_for_each_entry(svc, &ipvs->svc_fwm_table[i], f_list) {\n+\t\thlist_for_each_entry_rcu(svc, &ipvs->svc_fwm_table[i], f_list) {\n \t\t\tif (++idx <= start)\n \t\t\t\tcontinue;\n \t\t\tif (ip_vs_genl_dump_service(skb, svc, cb) < 0) {\n@@ -3397,7 +3395,7 @@ static int ip_vs_genl_dump_services(struct sk_buff *skb,\n \t}\n \n nla_put_failure:\n-\tmutex_unlock(&ipvs->service_mutex);\n+\trcu_read_unlock();\n \tcb->args[0] = idx;\n \n \treturn skb->len;\n@@ -3453,13 +3451,11 @@ static int ip_vs_genl_parse_service(struct netns_ipvs *ipvs,\n \t\tusvc->fwmark = 0;\n \t}\n \n-\trcu_read_lock();\n \tif (usvc->fwmark)\n \t\tsvc = __ip_vs_svc_fwm_find(ipvs, usvc->af, usvc->fwmark);\n \telse\n \t\tsvc = __ip_vs_service_find(ipvs, usvc->af, usvc->protocol,\n \t\t\t\t\t &usvc->addr, usvc->port);\n-\trcu_read_unlock();\n \t*ret_svc = svc;\n \n \t/* If a full entry was requested, check for the additional fields */\n@@ -3586,7 +3582,7 @@ static int ip_vs_genl_dump_dests(struct sk_buff *skb,\n \tstruct net *net = sock_net(skb->sk);\n \tstruct netns_ipvs *ipvs = net_ipvs(net);\n \n-\tmutex_lock(&ipvs->service_mutex);\n+\trcu_read_lock();\n \n \t/* Try to find the service for which to dump destinations */\n \tif (nlmsg_parse_deprecated(cb->nlh, GENL_HDRLEN, attrs, IPVS_CMD_ATTR_MAX, ip_vs_cmd_policy, cb->extack))\n@@ -3598,7 +3594,7 @@ static int ip_vs_genl_dump_dests(struct sk_buff *skb,\n \t\tgoto out_err;\n \n \t/* Dump the destinations */\n-\tlist_for_each_entry(dest, &svc->destinations, n_list) {\n+\tlist_for_each_entry_rcu(dest, &svc->destinations, n_list) {\n \t\tif (++idx <= start)\n \t\t\tcontinue;\n \t\tif (ip_vs_genl_dump_dest(skb, dest, cb) < 0) {\n@@ -3611,7 +3607,7 @@ static int ip_vs_genl_dump_dests(struct sk_buff *skb,\n \tcb->args[0] = idx;\n \n out_err:\n-\tmutex_unlock(&ipvs->service_mutex);\n+\trcu_read_unlock();\n \n \treturn skb->len;\n }\n@@ -3914,9 +3910,12 @@ static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info)\n \tif (cmd == IPVS_CMD_NEW_SERVICE || cmd == IPVS_CMD_SET_SERVICE)\n \t\tneed_full_svc = true;\n \n+\t/* We use function that requires RCU lock (hlist_bl) */\n+\trcu_read_lock();\n \tret = ip_vs_genl_parse_service(ipvs, &usvc,\n \t\t\t\t info->attrs[IPVS_CMD_ATTR_SERVICE],\n \t\t\t\t need_full_svc, &svc);\n+\trcu_read_unlock();\n \tif (ret)\n \t\tgoto out;\n \n@@ -4036,7 +4035,7 @@ static int ip_vs_genl_get_cmd(struct sk_buff *skb, struct genl_info *info)\n \tif (!msg)\n \t\treturn -ENOMEM;\n \n-\tmutex_lock(&ipvs->service_mutex);\n+\trcu_read_lock();\n \n \treply = genlmsg_put_reply(msg, info, &ip_vs_genl_family, 0, reply_cmd);\n \tif (reply == NULL)\n@@ -4104,7 +4103,7 @@ static int ip_vs_genl_get_cmd(struct sk_buff *skb, struct genl_info *info)\n out_err:\n \tnlmsg_free(msg);\n out:\n-\tmutex_unlock(&ipvs->service_mutex);\n+\trcu_read_unlock();\n \n \treturn ret;\n }\n", "prefixes": [ "nf-next", "2/6" ] }