[PATCH] dm: suspend: fix error path
authorAlasdair G Kergon <agk@redhat.com>
Thu, 9 Nov 2006 01:44:43 +0000 (17:44 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 9 Nov 2006 02:29:23 +0000 (18:29 -0800)
If the device is already suspended, just return the error and skip the code
that would incorrectly wipe md->suspended_bdev.

(This isn't currently a problem because existing code avoids calling this
function if the device is already suspended.)

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: <dm-devel@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm.c

index b5764a86c8b56f3f44b8ca2ebc38d30af8389a44..fc4f743f3b531e72bdb9c937d6cb2bf09d9ede1d 100644 (file)
@@ -1285,7 +1285,7 @@ int dm_suspend(struct mapped_device *md, int do_lockfs)
        down(&md->suspend_lock);
 
        if (dm_suspended(md))
-               goto out;
+               goto out_unlock;
 
        map = dm_get_table(md);
 
@@ -1361,6 +1361,8 @@ out:
        }
 
        dm_table_put(map);
+
+out_unlock:
        up(&md->suspend_lock);
        return r;
 }