diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2015-02-26 11:41:28 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-13 14:03:55 +0200 |
commit | 13027463097742b5901b1fb4a0a458a2f6dc467d (patch) | |
tree | e3105947d9760e9c283c3b8ed803bc4565c060be /include | |
parent | 3d9f57bb1c694d1cf6ba998cb960ed045b02726e (diff) |
dm snapshot: suspend merging snapshot when doing exception handover
commit 09ee96b21456883e108c3b00597bb37ec512151b upstream.
The "dm snapshot: suspend origin when doing exception handover" commit
fixed a exception store handover bug associated with pending exceptions
to the "snapshot-origin" target.
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 its associated
mapped_device.
To avoid lockdep warnings, the target must be suspended and resumed
without holding _origins_lock.
Introduce a dm_hold() function that grabs a reference on a
mapped_device, but unlike dm_get(), it doesn't crash if the device has
the DMF_FREEING flag set, it returns an 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.
NOTE to stable@ people:
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.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device-mapper.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index ca6d2acc5eb7..f39722b2836c 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -368,6 +368,7 @@ int dm_create(int minor, struct mapped_device **md); */ struct mapped_device *dm_get_md(dev_t dev); void dm_get(struct mapped_device *md); +int dm_hold(struct mapped_device *md); void dm_put(struct mapped_device *md); /* |