summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2025-04-10 15:49:39 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-19 15:32:04 +0200
commit48e0b54be49d25198ca3886ccfa5909eac0ef184 (patch)
treedc688dc880611870ce22401655526ed9f7eb40b3 /drivers/md
parent2eeb181e76d4ef43ab884e6a67454003cec81dbb (diff)
downloadlinux-48e0b54be49d25198ca3886ccfa5909eac0ef184.tar.gz
linux-48e0b54be49d25198ca3886ccfa5909eac0ef184.tar.bz2
linux-48e0b54be49d25198ca3886ccfa5909eac0ef184.zip
dm: free table mempools if not used in __bind
[ Upstream commit e8819e7f03470c5b468720630d9e4e1d5b99159e ] 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: 29dec90a0f1d9 ("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: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 12d5f414a678..92e5a233f516 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2450,10 +2450,10 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
* requests in the queue may refer to bio from the old bioset,
* so you must walk through the queue to unprep.
*/
- if (!md->mempools) {
+ if (!md->mempools)
md->mempools = t->mempools;
- t->mempools = NULL;
- }
+ else
+ dm_free_md_mempools(t->mempools);
} else {
/*
* The md may already have mempools that need changing.
@@ -2462,8 +2462,8 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
*/
dm_free_md_mempools(md->mempools);
md->mempools = t->mempools;
- t->mempools = NULL;
}
+ t->mempools = NULL;
old_map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock));
rcu_assign_pointer(md->map, (void *)t);