[Devel] [PATCH hci-8.1 v7 8/8] block/blk-cbt: account a write request also when dm starts it

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 3 21:02:10 MSK 2026


Not applying v7 yet: please pick one of the two options for REQ_NOWAIT
below.

On 10/28/26 11:11, Pavel Tikhomirov wrote:
> @@ -275,6 +359,8 @@ static bool blk_cbt_add(struct cbt_info *cbt, blkcnt_t start, blkcnt_t len,
>  		__blk_cbt_set(cbt, start, len, 1, NULL, NULL);
>  		return false;
>  	}
> +	/* Queue the allocation early, so blk_cbt_rq_start() finds the pages */
> +	cbt_queue_alloc_pages(cbt, start, len);

- A REQ_NOWAIT write that finds a bitmap page missing never queues its
  allocation. Either:
  1. send v8 with cbt_queue_alloc_pages() moved above the nowait
     branch, or
  2. I apply v7 with the Fixes: tags added on my side, and you send
     the nowait fix as a separate series.

The nowait branch of blk_cbt_add() returns before this call, so the bio
fails with BLK_STS_AGAIN and nothing allocates the page. A submitter
that retries only with RWF_NOWAIT gets EAGAIN until some blocking write
to the same range allocates it. io_uring is not affected, it retries
from io-wq without REQ_NOWAIT, and ploop devices never get here:
dm-ploop and dm-qcow2 lack DM_TARGET_NOWAIT, so submit_bio_noacct()
rejects such bios before CBT. cbt_queue_alloc_pages() doesn't sleep,
so option 1 is a one-line move.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list