Skip to content

Commit

Permalink
MINOR: server: remove prev_deleted server list
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
a-denoyelle committed Dec 10, 2024
1 parent 071ae8c commit 9c91b30
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
1 change: 0 additions & 1 deletion include/haproxy/server-t.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
29 changes: 0 additions & 29 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9c91b30

Please sign in to comment.