Re: [PATCH v2 0/3] dm thin: stop waiting for grace periods when activating and removing thins

From: Qiliang Yuan

Date: Thu Nov 19 2026 - 01:25:55 EST


On Thu, Nov 19, 2026 at 12:24:21AM -0500, Benjamin Marzinski wrote:
> I posted an alternate version of your [PATCH 2/2] that fixes the issue
> I mentioned. Can you verify that it works for you?
>
> I squashed it with your patch, since it your original patch did most of
> the work of fixing the issue, and it seemed easier to just have one
> patch to backport to fix it. I could refactor it into two patches: one
> the fixes the bug, and a second that just swaps the synchronize_rcu()
> for kfree_rcu(), if people would rather not mix the bug fix and feature.

Ben, this v2 crossed with your patch [1], and its 2/3 carries the wrong
Fixes tag. I'll send a v3 built on your version, still as three patches,
so that the fix can go to stable without the kfree_rcu() change:

- 1/3 "dm thin: drop the grace period from thin_ctr()": unchanged, and
it keeps your Reviewed-by.
- 2/3: the fix, taken from your patch. thin_dtr() marks the thin dying,
the walkers take references with refcount_inc_not_zero() and skip
dying thins, requeue_bios() and error_retry_list_with_code() skip
them too, and the thin leaves active_thins only after its refcount
drops to zero, followed by synchronize_rcu() before it is freed.
Fixes: 17181fb7a0c3, Cc: stable, with your Co-developed-by and
Signed-off-by.
- 3/3: replace that synchronize_rcu() with kfree_rcu().

Before sending it I'll rerun the KASAN reproducer on 2/3 alone and
remeasure each patch.

[1] https://lore.kernel.org/r/20261119051620.507189-1-bmarzins@xxxxxxxxxx

Thanks,
Qiliang