]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cache: disable cache if shctx_row_data_append fail
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 14 Nov 2017 13:39:24 +0000 (14:39 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 14 Nov 2017 14:20:44 +0000 (15:20 +0100)
Disable the cache if the append of data failed, it should never happen
because the allocated row size is at least equal to the size of the
object to allocate.

src/cache.c

index c27ed8a5570841d0a853228c2f720c6f262e4e0e..9272a6fbe34402d66047022837616ced335def53 100644 (file)
@@ -171,6 +171,7 @@ cache_store_http_forward_data(struct stream *s, struct filter *filter,
                if (filter->ctx && st->first_block) {
                        /* disable buffering if too much data (never greater than a buffer size */
                        if (len - st->hdrs_len > global.tune.bufsize - global.tune.maxrewrite - st->first_block->len) {
+                         disable_cache:
                                filter->ctx = NULL; /* disable cache  */
                                shctx_lock(shctx);
                                shctx_row_dec_hot(shctx, st->first_block);
@@ -185,6 +186,8 @@ cache_store_http_forward_data(struct stream *s, struct filter *filter,
                                                            MIN(bi_contig_data(msg->chn->buf), len - st->hdrs_len));
                                /* Rewind the buffer to forward all data */
                                b_rew(msg->chn->buf, st->hdrs_len);
+                               if (ret)
+                                       goto disable_cache;
                        }
                }
                ret = len;