aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2005-07-12 18:53:05 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-12 19:19:11 -0400
commit93c534aefb906824d71ea779ed0c7f1573843f4e (patch)
tree9deaabe380491885f7a312648e222f266cdf064f /drivers/md
parentc3cd4f6b275da0f594797b73f721a4185335478f (diff)
[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: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index bb3ad79c14d7..54fabbf06678 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -966,23 +966,20 @@ static void __flush_deferred_io(struct mapped_device *md, struct bio *c)
966 */ 966 */
967int dm_swap_table(struct mapped_device *md, struct dm_table *table) 967int dm_swap_table(struct mapped_device *md, struct dm_table *table)
968{ 968{
969 int r; 969 int r = -EINVAL;
970 970
971 down_write(&md->lock); 971 down_write(&md->lock);
972 972
973 /* device must be suspended */ 973 /* device must be suspended */
974 if (!test_bit(DMF_SUSPENDED, &md->flags)) { 974 if (!test_bit(DMF_SUSPENDED, &md->flags))
975 up_write(&md->lock); 975 goto out;
976 return -EPERM;
977 }
978 976
979 __unbind(md); 977 __unbind(md);
980 r = __bind(md, table); 978 r = __bind(md, table);
981 if (r)
982 return r;
983 979
980out:
984 up_write(&md->lock); 981 up_write(&md->lock);
985 return 0; 982 return r;
986} 983}
987 984
988/* 985/*