]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: lb/api: remove the locked argument from take_conn/drop_conn
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Jun 2021 16:29:25 +0000 (18:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Jun 2021 16:43:12 +0000 (18:43 +0200)
This essentially reverts commit 2b4370078 ("MINOR: lb/api: let callers
of take_conn/drop_conn tell if they have the lock") that was merged
during 2.4 before the various locks could be eliminated at the lower
layers. Passing that information complicates the cleanup of the queuing
code and it's become useless.

include/haproxy/backend-t.h
src/backend.c
src/lb_fas.c
src/lb_fwlc.c
src/queue.c
src/stream.c

index 8bee110fef19628195100367777dc4bd5b1fa469..126528400ce01c6696eec137b83d1201dcd93707 100644 (file)
@@ -162,13 +162,13 @@ struct lbprm {
 
        /* Call backs for some actions. Any of them may be NULL (thus should be ignored).
         * Those marked "srvlock" will need to be called with the server lock held.
-        * The other ones might take it themselves if needed, based on indications.
+        * The other ones might take it themselves if needed.
         */
        void (*update_server_eweight)(struct server *);  /* to be called after eweight change // srvlock */
        void (*set_server_status_up)(struct server *);   /* to be called after status changes to UP // srvlock */
        void (*set_server_status_down)(struct server *); /* to be called after status changes to DOWN // srvlock */
-       void (*server_take_conn)(struct server *, int locked); /* to be called when connection is assigned */
-       void (*server_drop_conn)(struct server *, int locked); /* to be called when connection is dropped */
+       void (*server_take_conn)(struct server *);       /* to be called when connection is assigned */
+       void (*server_drop_conn)(struct server *);       /* to be called when connection is dropped */
 };
 
 #endif /* _HAPROXY_BACKEND_T_H */
index 9307bac8f9491d401b4f7766b1a6d524600ceb52..7b14df752d472c8e800b06f48d0b38ce1db42c18 100644 (file)
@@ -1702,7 +1702,7 @@ skip_reuse:
                count = _HA_ATOMIC_ADD_FETCH(&srv->cur_sess, 1);
                HA_ATOMIC_UPDATE_MAX(&srv->counters.cur_sess_max, count);
                if (s->be->lbprm.server_take_conn)
-                       s->be->lbprm.server_take_conn(srv, 0);
+                       s->be->lbprm.server_take_conn(srv);
        }
 
        /* Now handle synchronously connected sockets. We know the stream-int
index fb581eb52b0badd475bc2d722a972398e02263db..53bd0392d4123b97f931fc7b614e17c7c2ec9870 100644 (file)
@@ -60,11 +60,9 @@ static inline void fas_queue_srv(struct server *s)
 /* Re-position the server in the FS tree after it has been assigned one
  * connection or after it has released one. Note that it is possible that
  * the server has been moved out of the tree due to failed health-checks.
- *
- * <locked> must reflect the server's lock ownership. The lbprm's lock will
- * be used.
+ * The lbprm's lock will be used.
  */
-static void fas_srv_reposition(struct server *s, int locked)
+static void fas_srv_reposition(struct server *s)
 {
        HA_RWLOCK_WRLOCK(LBPRM_LOCK, &s->proxy->lbprm.lock);
        if (s->lb_tree) {
index 6434896909872bfe6da00ded7bccc30483c93279..ba1ca95ae8f5b2d84bbf316790c1a297ba9601fe 100644 (file)
@@ -66,11 +66,9 @@ static inline void fwlc_queue_srv(struct server *s, unsigned int eweight)
 /* Re-position the server in the FWLC tree after it has been assigned one
  * connection or after it has released one. Note that it is possible that
  * the server has been moved out of the tree due to failed health-checks.
- *
- * <locked> must reflect the server's lock ownership. The lbprm's lock will
- * be used.
+ * The lbprm's lock will be used.
  */
-static void fwlc_srv_reposition(struct server *s, int locked)
+static void fwlc_srv_reposition(struct server *s)
 {
        unsigned int inflight = _HA_ATOMIC_LOAD(&s->served) + _HA_ATOMIC_LOAD(&s->nbpend);
        unsigned int new_key = inflight ? (inflight + 1) * SRV_EWGHT_MAX / s->cur_eweight : 0;
index be11227fe25055126fc3f6d127d553d5d74e6357..c45db0db2199deb872bcd4313c793386109fb148 100644 (file)
@@ -367,7 +367,7 @@ void process_srv_queue(struct server *s, int server_locked)
        _HA_ATOMIC_ADD(&p->served, done);
 
        if (done && p->lbprm.server_take_conn)
-               p->lbprm.server_take_conn(s, server_locked);
+               p->lbprm.server_take_conn(s);
 }
 
 /* Adds the stream <strm> to the pending connection queue of server <strm>->srv
index bb5a93e8d622c1b58ad6bae4841e671b5f53cc03..b8da9356413774cf7240392259e9bfc2b82e7af2 100644 (file)
@@ -2619,7 +2619,7 @@ void sess_change_server(struct stream *strm, struct server *newsrv)
                _HA_ATOMIC_DEC(&oldsrv->proxy->served);
                __ha_barrier_atomic_store();
                if (oldsrv->proxy->lbprm.server_drop_conn)
-                       oldsrv->proxy->lbprm.server_drop_conn(oldsrv, 0);
+                       oldsrv->proxy->lbprm.server_drop_conn(oldsrv);
                stream_del_srv_conn(strm);
        }
 
@@ -2628,7 +2628,7 @@ void sess_change_server(struct stream *strm, struct server *newsrv)
                _HA_ATOMIC_INC(&newsrv->proxy->served);
                __ha_barrier_atomic_store();
                if (newsrv->proxy->lbprm.server_take_conn)
-                       newsrv->proxy->lbprm.server_take_conn(newsrv, 0);
+                       newsrv->proxy->lbprm.server_take_conn(newsrv);
                stream_add_srv_conn(strm, newsrv);
        }
 }