Commit bf74a108 authored by Minfei Huang's avatar Minfei Huang Committed by Greg Kroah-Hartman

dm: return correct error code in dm_resume()'s retry loop

commit 8dc23658 upstream.

dm_resume() will return success (0) rather than -EINVAL if
!dm_suspended_md() upon retry within dm_resume().

Reset the error code at the start of dm_resume()'s retry loop.
Also, remove a useless assignment at the end of dm_resume().

Fixes: ffcc3936 ("dm: enhance internal suspend and resume interface")
Signed-off-by: default avatarMinfei Huang <mnghuan@gmail.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 90be7f15
...@@ -3250,10 +3250,11 @@ static int __dm_resume(struct mapped_device *md, struct dm_table *map) ...@@ -3250,10 +3250,11 @@ static int __dm_resume(struct mapped_device *md, struct dm_table *map)
int dm_resume(struct mapped_device *md) int dm_resume(struct mapped_device *md)
{ {
int r = -EINVAL; int r;
struct dm_table *map = NULL; struct dm_table *map = NULL;
retry: retry:
r = -EINVAL;
mutex_lock_nested(&md->suspend_lock, SINGLE_DEPTH_NESTING); mutex_lock_nested(&md->suspend_lock, SINGLE_DEPTH_NESTING);
if (!dm_suspended_md(md)) if (!dm_suspended_md(md))
...@@ -3277,8 +3278,6 @@ int dm_resume(struct mapped_device *md) ...@@ -3277,8 +3278,6 @@ int dm_resume(struct mapped_device *md)
goto out; goto out;
clear_bit(DMF_SUSPENDED, &md->flags); clear_bit(DMF_SUSPENDED, &md->flags);
r = 0;
out: out:
mutex_unlock(&md->suspend_lock); mutex_unlock(&md->suspend_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment