Skip to content

ublk: fix maple tree lockdep warning and cleanup

Ming Lei linux-block 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3ublk: fix maple tree lockdep warning in ublk_buf_cleanupdrivers/block/ublk_drv.c+4 -00 replies
2/3ublk: refactor common helper ublk_shmem_remove_ranges()drivers/block/ublk_drv.c+29 -400 replies
3/3ublk: avoid unpinning pages under maple tree spinlockdrivers/block/ublk_drv.c+46 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] ublk: fix maple tree lockdep warning and cleanup

Hello Jens,

Fix the lockdep warning reported by Jens when running ublk selftests with CONFIG_PROVE_RCU=y:

lib/maple_tree.c:759 suspicious rcu_dereference_check() usage!

ublk_buf_cleanup() was iterating the maple tree without holding mas_lock, triggering the splat from mas_find()'s internal rcu_dereference_check().

Patch 1 fixes the warning by adding mas_lock around the iteration. Patch 2 refactors the duplicated walk+erase+unpin loop into a shared ublk_shmem_remove_ranges() helper. Patch 3 avoids holding the maple tree spinlock across page unpinning by batching erased ranges into a temporary xarray.

Thanks,

Ming Lei (3):
ublk: fix maple tree lockdep warning in ublk_buf_cleanup
ublk: refactor common helper ublk_shmem_remove_ranges()
ublk: avoid unpinning pages under maple tree spinlock

 drivers/block/ublk_drv.c | 111 ++++++++++++++++++++++++---------------
 1 file changed, 70 insertions(+), 41 deletions(-)
Signature · 1 line
2.53.0