Commit 87eb5b21 authored by Mike Christie's avatar Mike Christie Committed by Alasdair G Kergon

dm: fix limits initialization when there are no data devices

dm_calculate_queue_limits will first reset the provided limits to
defaults using blk_set_stacking_limits; whereby defeating the purpose of
retaining the original live table's limits -- as was intended via commit
3ae70656 ("dm: retain table limits when
swapping to new table with no devices").

Fix this improper limits initialization (in the no data devices case) by
avoiding the call to dm_calculate_queue_limits.

[patch header revised by Mike Snitzer]
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # v3.6+
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 23cb2109
...@@ -2446,7 +2446,7 @@ static void dm_queue_flush(struct mapped_device *md) ...@@ -2446,7 +2446,7 @@ static void dm_queue_flush(struct mapped_device *md)
*/ */
struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table)
{ {
struct dm_table *live_map, *map = ERR_PTR(-EINVAL); struct dm_table *live_map = NULL, *map = ERR_PTR(-EINVAL);
struct queue_limits limits; struct queue_limits limits;
int r; int r;
...@@ -2469,10 +2469,12 @@ struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) ...@@ -2469,10 +2469,12 @@ struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table)
dm_table_put(live_map); dm_table_put(live_map);
} }
r = dm_calculate_queue_limits(table, &limits); if (!live_map) {
if (r) { r = dm_calculate_queue_limits(table, &limits);
map = ERR_PTR(r); if (r) {
goto out; map = ERR_PTR(r);
goto out;
}
} }
map = __bind(md, table, &limits); map = __bind(md, table, &limits);
......
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