[dm-devel] [PATCH 2/2] dm-snapshot: suspend merging snapshot when doing exception handover

Mikulas Patocka mpatocka at redhat.com
Fri Feb 27 19:23:12 UTC 2015



On Thu, 26 Feb 2015, Mikulas Patocka wrote:

> There was a bug when that resulted in a crash when there were pending
> exceptions and snapshot exception store handover was performed at the
> same time - and there was a patch that fixed it.
> 
> However, a similar problem exists in snapshot merging. When snapshot
> merging is in progress, we use the target "snapshot-merge" instead of
> "snapshot-origin". Consequently, during exception store handover, we must
> find the snapshot-merge target and suspend it's associated md.
> 
> To avoid lockdep warnings, the target must be suspended and resumed
> without holding _origins_lock.
> 
> This patch introduces a function dm_hold that grabs a reference on
> mapped_device, but unlike dm_get, it doesn't crash if the devices has the
> flag DMF_FREEING, it returns and error in this case.
> 
> In snapshot_resume we grab the reference to the origin device using
> dm_hold while holding _origins_lock (_origins_lock guarantees that the
> device won't disappear). Then we release _origins_lock, suspend the
> device and grab _origins_lock again.
> 
> Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>

I forgot to add

Cc: stable at vger.kernel.org

When backporting to kernels 3.18 and older, use dm_internal_suspend and 
dm_internal_resume instead of dm_internal_suspend_fast and 
dm_internal_resume_fast.

Mikulas




More information about the dm-devel mailing list