Skip to content

Commit 053887c

Browse files
committed
MINOR: proxy: prevent backend deletion if server still exists in it
Ensure a backend instance cannot be removed if there is still server in it. This is checked via be_check_for_deletion() to ensure "del backend" cannot be executed. The only solution is to use "del server" to remove on the servers instances. This check only covers servers not yet targetted via "del server". For deleted servers not yet purged (due to their refcount), the proxy refcount is incremented but this does not block "del backend" invokation.
1 parent 7f725f0 commit 053887c

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

doc/management.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,8 @@ del backend <name>
21282128
Removes the backend proxy with the name <name>.
21292129

21302130
This operation is only possible for TCP or HTTP proxies. To succeed, the
2131-
backend instance must have been first unpublished.
2131+
backend instance must have been first unpublished. Also, all of its servers
2132+
must first be removed (via "del server" CLI).
21322133

21332134
There is additional restrictions which prevent backend removal. First, a
21342135
backend cannot be removed if it is explicitely referenced by config elements,

src/proxy.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5048,6 +5048,11 @@ int be_check_for_deletion(const char *bename, struct proxy **pb, const char **pm
50485048
goto out;
50495049
}
50505050

5051+
if (be->srv) {
5052+
msg = "Only a backend without server can be deleted.";
5053+
goto out;
5054+
}
5055+
50515056
/* Second, conditions that may change over time */
50525057
ret = 0;
50535058

0 commit comments

Comments
 (0)