[6.0] ff4e69265 Fix WS_ReserveSize calls when bytes is equal to free workspace

Martin Blix Grydeland martin at varnish-software.com
Tue Feb 4 10:02:09 UTC 2020


commit ff4e69265f2cbedf6c7a002e71ced8f255a6a0b3
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Mon Dec 16 16:37:27 2019 +0100

    Fix WS_ReserveSize calls when bytes is equal to free workspace
    
    Currently, with the 505b7bd9643006fa8e3977f920564ce12a2b24a2 patch, when
    calling WS_ReserveSize with bytes equal to the amount of workspace that is
    currently available, it will return zero and mark overflow.
    
    This patch redoes the patch, and changes it to return zero and overflow
    only when the requested number of bytes is larger than what is available.

diff --git a/bin/varnishd/cache/cache_ws.c b/bin/varnishd/cache/cache_ws.c
index de04e896d..5de7a6830 100644
--- a/bin/varnishd/cache/cache_ws.c
+++ b/bin/varnishd/cache/cache_ws.c
@@ -263,7 +263,7 @@ WS_ReserveSize(struct ws *ws, unsigned bytes)
 	if (bytes < b2)
 		b2 = PRNDUP(bytes);
 
-	if (ws->f + b2 >= ws->e) {
+	if (bytes > b2) {
 		WS_MarkOverflow(ws);
 		return (0);
 	}


More information about the varnish-commit mailing list