Skip to content

Commit 9351e47

Browse files
committed
dm: free table mempools if not used in __bind
JIRA: https://issues.redhat.com/browse/RHEL-119009 Upstream Status: kernel/git/torvalds/linux.git commit e8819e7 Author: Benjamin Marzinski <bmarzins@redhat.com> Date: Thu Apr 10 15:49:39 2025 -0400 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 <dlemoal@kernel.org> Tested-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 parent b7d3411 commit 9351e47

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
@@ -2485,10 +2485,10 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
24852485
* requests in the queue may refer to bio from the old bioset,
24862486
* so you must walk through the queue to unprep.
24872487
*/
2488-
if (!md->mempools) {
2488+
if (!md->mempools)
24892489
md->mempools = t->mempools;
2490-
t->mempools = NULL;
2491-
}
2490+
else
2491+
dm_free_md_mempools(t->mempools);
24922492
} else {
24932493
/*
24942494
* The md may already have mempools that need changing.
@@ -2497,8 +2497,8 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
24972497
*/
24982498
dm_free_md_mempools(md->mempools);
24992499
md->mempools = t->mempools;
2500-
t->mempools = NULL;
25012500
}
2501+
t->mempools = NULL;
25022502

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

0 commit comments

Comments
 (0)