[dm-devel] dm: fix AB-BA deadlock in __dm_destroy()
Mike Snitzer
snitzer at redhat.com
Thu Oct 1 20:45:00 UTC 2015
On Thu, Oct 01 2015 at 4:31am -0400,
Junichi Nomura <j-nomura at ce.jp.nec.com> wrote:
> __dm_destroy() takes io_barrier SRCU lock (dm_get_live_table) and
> suspend_lock in reverse order. That can cause AB-BA deadlock:
>
> Example:
>
> __dm_destroy dm_swap_table
> ---------------------------------------------------
> mutex_lock(suspend_lock)
> dm_get_live_table()
> srcu_read_lock(io_barrier)
> dm_sync_table()
> synchronize_srcu(io_barrier)
> .. waiting for dm_put_live_table()
> mutex_lock(suspend_lock)
> .. waiting for suspend_lock
>
> This patch fixes the lock ordering.
>
> Signed-off-by: Jun'ichi Nomura <j-nomura at ce.jp.nec.com>
> Fixes: ab7c7bb6f4ab ("dm: hold suspend_lock while suspending device during device deletion")
> Cc: Mikulas Patocka <mpatocka at redhat.com>
> ---
> The problem could be reproduced with this script but it might take long.
> (In my environment, it took more than 10 minutes)
Hi,
Thanks for fixing this. What prompted you to chase this down? Was it
the work you were doing to reproduce Bart's blk-mq mpath failure that
exposed this issue?
FYI, interestingly, your fix looks to be applicable to this issue too:
https://bugzilla.redhat.com/show_bug.cgi?id=1267650
Thanks again,
Mike
More information about the dm-devel
mailing list