Commit 93c534ae authored by Alasdair G Kergon's avatar Alasdair G Kergon Committed by Linus Torvalds

[PATCH] device-mapper: Fix dm_swap_table error cases

Fix dm_swap_table() __bind error cases: a missing unlock, and EINVAL
preferable to EPERM.
Signed-off-by: default avatarAlasdair G Kergon <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent c3cd4f6b
......@@ -966,23 +966,20 @@ static void __flush_deferred_io(struct mapped_device *md, struct bio *c)
int dm_swap_table(struct mapped_device *md, struct dm_table *table)
int r;
int r = -EINVAL;
/* device must be suspended */
if (!test_bit(DMF_SUSPENDED, &md->flags)) {
return -EPERM;
if (!test_bit(DMF_SUSPENDED, &md->flags))
goto out;
r = __bind(md, table);
if (r)
return r;
return 0;
return r;
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