[Devel] [RFC PATCH vz9 v6 47/62] dm-ploop: disable metadata writeback delay

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Fri Dec 20 17:02:23 MSK 2024


Here you are also disabling immediate metadata publish. Then you should 
also call ploop_attach_end_action() for all requests in 
ploop_locate_new_cluster_and_attach_pio(). Otherwise there we may have 
completed write() syscall without metadata changes (they are not delayed 
now but still executed in-parallel)

On 12/5/24 22:56, Alexander Atanasov wrote:
> Delayed metadata writeback results in a hang, disable
> it until it is fixed. Pios end in the waiting list of
> md and get stuck there never to complete.
> 
> Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
> ---
>   drivers/md/dm-ploop-map.c | 14 +++++++++++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
> index c88359677ea4..6e4d6f862135 100644
> --- a/drivers/md/dm-ploop-map.c
> +++ b/drivers/md/dm-ploop-map.c
> @@ -817,9 +817,10 @@ static void ploop_advance_local_after_bat_wb(struct ploop *ploop,
>   	/* holes bit map requires bat_lock */
>   	spin_lock_irqsave(&ploop->bat_lock, flags);
>   	spin_lock(&md->md_lock);
> +#ifdef PLOOP_DELAYWB
>   	if (piwb->type == PIWB_TYPE_ALLOC)
>   		goto skip_apply;
> -
> +#endif
>   	for (; i < last; i++) {
>   		if (piwb->type == PIWB_TYPE_DISCARD) {
>   			ploop_piwb_discard_completed(ploop, success, i + off, dst_clu[i]);
> @@ -836,7 +837,9 @@ static void ploop_advance_local_after_bat_wb(struct ploop *ploop,
>   			ploop_hole_set_bit(i + off, ploop);
>   		}
>   	}
> +#ifdef PLOOP_DELAYWB
>   skip_apply:
> +#endif
>   
>   	WARN_ON_ONCE(!test_bit(MD_WRITEBACK, &md->status));
>   	clear_bit(MD_WRITEBACK, &md->status);
> @@ -1187,8 +1190,10 @@ static int ploop_alloc_cluster(struct ploop *ploop, struct ploop_index_wb *piwb,
>   
>   	to = piwb->kmpage;
>   	WRITE_ONCE(to[clu], *dst_clu);
> +#ifdef PLOOP_DELAYWB
>   	to = piwb->md->kmpage;
>   	WRITE_ONCE(to[clu], *dst_clu);
> +#endif
>   out:
>   	return ret;
>   }
> @@ -1481,6 +1486,7 @@ static void ploop_submit_cow_index_wb(struct ploop_cow *cow)
>   	WARN_ON(to[clu]);
>   	WRITE_ONCE(to[clu], cow->dst_clu);
>   
> +#ifdef PLOOP_DELAYWB
>   	spin_lock_irqsave(&md->md_lock, flags);
>   	to = md->kmpage;
>   	WRITE_ONCE(to[clu], cow->dst_clu);
> @@ -1488,7 +1494,7 @@ static void ploop_submit_cow_index_wb(struct ploop_cow *cow)
>   	spin_unlock_irqrestore(&md->md_lock, flags);
>   
>   	ploop_md_up_prio(ploop, md);
> -
> +#endif
>   	/* Prevent double clearing of holes_bitmap bit on complete_cow() */
>   	cow->dst_clu = BAT_ENTRY_NONE;
>   	spin_lock_irq(&ploop->deferred_lock);
> @@ -1918,7 +1924,9 @@ static inline int ploop_submit_metadata_writeback(struct ploop *ploop, int force
>   	 */
>   	llist_for_each_safe(pos, t, ll_wb_batch) {
>   		md = list_entry((struct list_head *)pos, typeof(*md), wb_link);
> -		if (!llist_empty(&md->wait_llist) || force || test_bit(MD_HIGHPRIO, &md->status) ||
> +		/* XXX: fixme delay results in a hang - TBD */
> +		if (1 || !llist_empty(&md->wait_llist) || force ||
> +			test_bit(MD_HIGHPRIO, &md->status) ||
>   			time_before(md->dirty_timeout, timeout)) {
>   			/* L1L2 mustn't be redirtyed, when wb in-flight! */
>   			WARN_ON_ONCE(!test_bit(MD_DIRTY, &md->status));


More information about the Devel mailing list