diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h index 6e0c35bc7..22949e145 100644 --- a/include/haproxy/channel.h +++ b/include/haproxy/channel.h @@ -915,7 +915,14 @@ static inline int ci_space_for_replace(const struct channel *chn) */ static inline int channel_alloc_buffer(struct channel *chn, struct buffer_wait *wait) { - if (b_alloc(&chn->buf, DB_CHANNEL) != NULL) + int force_noqueue; + + /* If the producer has been notified of recent availability, we must + * not check the queue again. + */ + force_noqueue = !!(chn_prod(chn)->flags & SC_FL_HAVE_BUFF); + + if (b_alloc(&chn->buf, DB_CHANNEL | (force_noqueue ? DB_F_NOQUEUE : 0)) != NULL) return 1; b_requeue(DB_CHANNEL, wait);