From 9c91b3013955ca061fb1388ad4c6f816b08cb894 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Wed, 27 Nov 2024 11:11:12 +0100 Subject: [PATCH] MINOR: server: remove prev_deleted server list This patch is a direct follow-up to the previous one. Thanks to watcher type, it is not safe to assume that servers manipulated via stats dump were not targetted by a "delete server" CLI command. As such, prev_deleted list server member is now unneeded. This patch thus removes any reference to it. --- include/haproxy/server-t.h | 1 - src/server.c | 29 ----------------------------- 2 files changed, 30 deletions(-) diff --git a/include/haproxy/server-t.h b/include/haproxy/server-t.h index 11103bf7e563..17ddb7a4c170 100644 --- a/include/haproxy/server-t.h +++ b/include/haproxy/server-t.h @@ -303,7 +303,6 @@ struct server { unsigned int pp_opts; /* proxy protocol options (SRV_PP_*) */ struct mt_list global_list; /* attach point in the global servers_list */ struct server *next; - struct mt_list prev_deleted; /* deleted servers with 'next' ptr pointing to us */ int cklen; /* the len of the cookie, to speed up checks */ int rdr_len; /* the length of the redirection prefix */ char *cookie; /* the id set in the cookie */ diff --git a/src/server.c b/src/server.c index 96561992da61..e18a07cbe0a5 100644 --- a/src/server.c +++ b/src/server.c @@ -2966,7 +2966,6 @@ struct server *new_server(struct proxy *proxy) LIST_INIT(&srv->srv_rec_item); LIST_INIT(&srv->ip_rec_item); LIST_INIT(&srv->pp_tlvs); - MT_LIST_INIT(&srv->prev_deleted); event_hdl_sub_list_init(&srv->e_subs); srv->rid = 0; /* rid defaults to 0 */ @@ -3074,13 +3073,6 @@ struct server *srv_drop(struct server *srv) guid_remove(&srv->guid); - /* make sure we are removed from our 'next->prev_deleted' list - * This doesn't require full thread isolation as we're using mt lists - * However this could easily be turned into regular list if required - * (with the proper use of thread isolation) - */ - MT_LIST_DELETE(&srv->prev_deleted); - task_destroy(srv->warmup); task_destroy(srv->srvrq_check); @@ -6073,7 +6065,6 @@ static int cli_parse_delete_server(char **args, char *payload, struct appctx *ap { struct proxy *be; struct server *srv; - struct server *prev_del; struct ist be_name, sv_name; struct mt_list back; struct sess_priv_conns *sess_conns = NULL; @@ -6191,26 +6182,6 @@ static int cli_parse_delete_server(char **args, char *payload, struct appctx *ap */ _srv_detach(srv); - /* Some deleted servers could still point to us using their 'next', - * migrate them as needed - */ - MT_LIST_FOR_EACH_ENTRY_LOCKED(prev_del, &srv->prev_deleted, prev_deleted, back) { - /* update its 'next' ptr */ - prev_del->next = srv->next; - if (srv->next) { - /* now it is our 'next' responsibility */ - MT_LIST_APPEND(&srv->next->prev_deleted, &prev_del->prev_deleted); - } - else - mt_list_unlock_self(&prev_del->prev_deleted); - /* unlink from our list */ - prev_del = NULL; - } - - /* we ourselves need to inform our 'next' that we will still point it */ - if (srv->next) - MT_LIST_APPEND(&srv->next->prev_deleted, &srv->prev_deleted); - /* remove srv from addr_node tree */ eb32_delete(&srv->conf.id); ebpt_delete(&srv->conf.name);