]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: backend: fix incorrect comments on locking conditions for lb functions
authorWilly Tarreau <w@1wt.eu>
Tue, 1 Jun 2021 14:58:31 +0000 (16:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 4 Jun 2021 13:40:50 +0000 (15:40 +0200)
The leastconn and roundrobin functions mention that the server's lock
must be held while this is not true at all and it is not used either.
The "first" algo doesn't mention anything about the need for locking,
so let's mention that it uses the lbprm lock.

src/lb_chash.c
src/lb_fas.c
src/lb_fwlc.c
src/lb_fwrr.c

index 469da71f5f6c1ba831d0a77d054b0fbdae61b144..23b2b12722a5e346aaf592ed62c9132fc19b9539 100644 (file)
@@ -316,6 +316,8 @@ int chash_server_is_eligible(struct server *s)
  * will still both receive traffic. If any server is found, it will be returned.
  * It will also skip server <avoid> if the hash result ends on this one.
  * If no valid server is found, NULL is returned.
+ *
+ * The lbprm's lock will be used in R/O mode. The server's lock is not used.
  */
 struct server *chash_get_server_hash(struct proxy *p, unsigned int hash, const struct server *avoid)
 {
@@ -386,6 +388,8 @@ struct server *chash_get_server_hash(struct proxy *p, unsigned int hash, const s
 
 /* Return next server from the CHASH tree in backend <p>. If the tree is empty,
  * return NULL. Saturated servers are skipped.
+ *
+ * The lbprm's lock will be used in R/W mode. The server's lock is not used.
  */
 struct server *chash_get_next_server(struct proxy *p, struct server *srvtoavoid)
 {
index 9f6dc24b910fee3785134a111fda24bec129beed..fb581eb52b0badd475bc2d722a972398e02263db 100644 (file)
@@ -292,7 +292,7 @@ void fas_init_server_tree(struct proxy *p)
 /* Return next server from the FS tree in backend <p>. If the tree is empty,
  * return NULL. Saturated servers are skipped.
  *
- * The server's lock must be held. The lbprm's lock will be used.
+ * The lbprm's lock will be used. The server's lock is not used.
  */
 struct server *fas_get_next_server(struct proxy *p, struct server *srvtoavoid)
 {
index 4e1b7307f90d1fc49235db89bf89848d6b79a213..6434896909872bfe6da00ded7bccc30483c93279 100644 (file)
@@ -317,7 +317,7 @@ void fwlc_init_server_tree(struct proxy *p)
 /* Return next server from the FWLC tree in backend <p>. If the tree is empty,
  * return NULL. Saturated servers are skipped.
  *
- * The server's lock must be held. The lbprm's lock will be used.
+ * The lbprm's lock will be used in R/O mode. The server's lock is not used.
  */
 struct server *fwlc_get_next_server(struct proxy *p, struct server *srvtoavoid)
 {
index e2cdd9f0dadac7b83310fdb46e9fcbde5d52011c..d7f618faf6b3ee35f364020ad4091a6fa0600502 100644 (file)
@@ -506,7 +506,7 @@ static inline void fwrr_update_position(struct fwrr_group *grp, struct server *s
  * the init tree if appropriate. If both trees are empty, return NULL.
  * Saturated servers are skipped and requeued.
  *
- * The lbprm's lock will be used. The server's lock is not used.
+ * The lbprm's lock will be used in R/W mode. The server's lock is not used.
  */
 struct server *fwrr_get_next_server(struct proxy *p, struct server *srvtoavoid)
 {