From 14d0d4d55ed579c471ec24c03cb3808d4d721a79 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 24 Mar 2021 13:59:12 +0100 Subject: Fix block processor queue accounting Dequeuing won't work if we have a backlog of 1 or 2 and the blocks are used for internal buffering. Take that into account, similar to the sync code. Also bump the minimum backlog to 3, just to make absolutely sure we cannot run into a dequeue loop trying to allocate a block. Signed-off-by: David Oberhollenzer --- lib/sqfs/block_processor/backend.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/sqfs/block_processor/backend.c') diff --git a/lib/sqfs/block_processor/backend.c b/lib/sqfs/block_processor/backend.c index f81304b..35e5b4c 100644 --- a/lib/sqfs/block_processor/backend.c +++ b/lib/sqfs/block_processor/backend.c @@ -298,6 +298,16 @@ int dequeue_block(sqfs_block_processor_t *proc) if (proc->backlog < backlog_old) break; + if ((proc->backlog == 1) && + (proc->frag_block != NULL || proc->blk_current != NULL)) { + break; + } + + if ((proc->backlog == 2) && + proc->frag_block != NULL && proc->blk_current != NULL) { + break; + } + blk = proc->pool->dequeue(proc->pool); if (blk == NULL) { -- cgit v1.2.3