]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: remove prev_deleted server list
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 27 Nov 2024 10:11:12 +0000 (11:11 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 10 Dec 2024 15:19:33 +0000 (16:19 +0100)
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
src/server.c

index 11103bf7e5636bc512a3a6a62ed266e1ad6ac5c5..17ddb7a4c170d075832bd939f3d453077468cbd7 100644 (file)
@@ -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 */
index 96561992da61608b71419be37d6fd2d89589c718..e18a07cbe0a5613589a54e3c6bc22f8dc06b91f3 100644 (file)
@@ -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);