Skip to content

Commit e8819e7

Browse files
bmarzinsMikulas Patocka
authored andcommitted
dm: free table mempools if not used in __bind
With request-based dm, the mempools don't need reloading when switching tables, but the unused table mempools are not freed until the active table is finally freed. Free them immediately if they are not needed. Fixes: 29dec90 ("dm: fix bio_set allocation") Reviewed-by: Damien Le Moal <[email protected]> Tested-by: Damien Le Moal <[email protected]> Signed-off-by: Benjamin Marzinski <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]>
1 parent 9eb7109 commit e8819e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/md/dm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,10 +2461,10 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
24612461
* requests in the queue may refer to bio from the old bioset,
24622462
* so you must walk through the queue to unprep.
24632463
*/
2464-
if (!md->mempools) {
2464+
if (!md->mempools)
24652465
md->mempools = t->mempools;
2466-
t->mempools = NULL;
2467-
}
2466+
else
2467+
dm_free_md_mempools(t->mempools);
24682468
} else {
24692469
/*
24702470
* The md may already have mempools that need changing.
@@ -2473,8 +2473,8 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
24732473
*/
24742474
dm_free_md_mempools(md->mempools);
24752475
md->mempools = t->mempools;
2476-
t->mempools = NULL;
24772476
}
2477+
t->mempools = NULL;
24782478

24792479
old_map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock));
24802480
rcu_assign_pointer(md->map, (void *)t);

0 commit comments

Comments
 (0)