Skip to content

Commit

Permalink
dm: return correct error code in dm_resume()'s retry loop
Browse files Browse the repository at this point in the history
commit 8dc2365 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: ffcc393 ("dm: enhance internal suspend and resume interface")
Signed-off-by: Minfei Huang <mnghuan@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Minfei Huang authored and gregkh committed Oct 28, 2016
1 parent 90be7f1 commit bf74a10
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3250,10 +3250,11 @@ static int __dm_resume(struct mapped_device *md, struct dm_table *map)

int dm_resume(struct mapped_device *md)
{
int r = -EINVAL;
int r;
struct dm_table *map = NULL;

retry:
r = -EINVAL;
mutex_lock_nested(&md->suspend_lock, SINGLE_DEPTH_NESTING);

if (!dm_suspended_md(md))
Expand All @@ -3277,8 +3278,6 @@ int dm_resume(struct mapped_device *md)
goto out;

clear_bit(DMF_SUSPENDED, &md->flags);

r = 0;
out:
mutex_unlock(&md->suspend_lock);

Expand Down

0 comments on commit bf74a10

Please sign in to comment.