From 03b661b97fcaf0f5c0bef94dbac6c44f23990415 Mon Sep 17 00:00:00 2001 From: Coly Li Date: Apr 13 2024 06:52:20 +0000 Subject: dm cache policy smq: ensure IO doesn't prevent cleaner policy progress (git-fixes). --- diff --git a/patches.suse/dm-cache-policy-smq-ensure-IO-doesn-t-prevent-cleane-1e4a.patch b/patches.suse/dm-cache-policy-smq-ensure-IO-doesn-t-prevent-cleane-1e4a.patch new file mode 100644 index 0000000..306720e --- /dev/null +++ b/patches.suse/dm-cache-policy-smq-ensure-IO-doesn-t-prevent-cleane-1e4a.patch @@ -0,0 +1,107 @@ +From 1e4ab7b4c881cf26c1c72b3f56519e03475486fb Mon Sep 17 00:00:00 2001 +From: Joe Thornber +Date: Tue, 25 Jul 2023 11:44:41 -0400 +Subject: [PATCH] dm cache policy smq: ensure IO doesn't prevent cleaner policy + progress +Git-commit: 1e4ab7b4c881cf26c1c72b3f56519e03475486fb +Patch-mainline: v6.5-rc4 +References: git-fixes + +When using the cleaner policy to decommission the cache, there is +never any writeback started from the cache as it is constantly delayed +due to normal I/O keeping the device busy. Meaning @idle=false was +always being passed to clean_target_met() + +Fix this by adding a specific 'cleaner' flag that is set when the +cleaner policy is configured. This flag serves to always allow the +cleaner's writeback work to be queued until the cache is +decommissioned (even if the cache isn't idle). + +Reported-by: David Jeffery +Fixes: b29d4986d0da ("dm cache: significant rework to leverage dm-bio-prison-v2") +Cc: stable@vger.kernel.org +Signed-off-by: Joe Thornber +Signed-off-by: Mike Snitzer +Signed-off-by: Coly Li + +--- + drivers/md/dm-cache-policy-smq.c | 28 ++++++++++++++++++---------- + 1 file changed, 18 insertions(+), 10 deletions(-) + +--- a/drivers/md/dm-cache-policy-smq.c ++++ b/drivers/md/dm-cache-policy-smq.c +@@ -854,7 +854,13 @@ struct smq_policy { + + struct background_tracker *bg_work; + +- bool migrations_allowed; ++ bool migrations_allowed:1; ++ ++ /* ++ * If this is set the policy will try and clean the whole cache ++ * even if the device is not idle. ++ */ ++ bool cleaner:1; + }; + + /*----------------------------------------------------------------*/ +@@ -1135,7 +1141,7 @@ static bool clean_target_met(struct smq_ + * Cache entries may not be populated. So we cannot rely on the + * size of the clean queue. + */ +- if (idle) { ++ if (idle || mq->cleaner) { + /* + * We'd like to clean everything. + */ +@@ -1718,11 +1724,9 @@ static void calc_hotspot_params(sector_t + *hotspot_block_size /= 2u; + } + +-static struct dm_cache_policy *__smq_create(dm_cblock_t cache_size, +- sector_t origin_size, +- sector_t cache_block_size, +- bool mimic_mq, +- bool migrations_allowed) ++static struct dm_cache_policy * ++__smq_create(dm_cblock_t cache_size, sector_t origin_size, sector_t cache_block_size, ++ bool mimic_mq, bool migrations_allowed, bool cleaner) + { + unsigned i; + unsigned nr_sentinels_per_queue = 2u * NR_CACHE_LEVELS; +@@ -1809,6 +1813,7 @@ static struct dm_cache_policy *__smq_cre + goto bad_btracker; + + mq->migrations_allowed = migrations_allowed; ++ mq->cleaner = cleaner; + + return &mq->policy; + +@@ -1832,21 +1837,24 @@ static struct dm_cache_policy *smq_creat + sector_t origin_size, + sector_t cache_block_size) + { +- return __smq_create(cache_size, origin_size, cache_block_size, false, true); ++ return __smq_create(cache_size, origin_size, cache_block_size, ++ false, true, false); + } + + static struct dm_cache_policy *mq_create(dm_cblock_t cache_size, + sector_t origin_size, + sector_t cache_block_size) + { +- return __smq_create(cache_size, origin_size, cache_block_size, true, true); ++ return __smq_create(cache_size, origin_size, cache_block_size, ++ true, true, false); + } + + static struct dm_cache_policy *cleaner_create(dm_cblock_t cache_size, + sector_t origin_size, + sector_t cache_block_size) + { +- return __smq_create(cache_size, origin_size, cache_block_size, false, false); ++ return __smq_create(cache_size, origin_size, cache_block_size, ++ false, false, true); + } + + /*----------------------------------------------------------------*/ diff --git a/series.conf b/series.conf index 4c86900..9841a65 100644 --- a/series.conf +++ b/series.conf @@ -43201,6 +43201,7 @@ patches.suse/ASoC-atmel-Fix-the-8K-sample-parameter-in-I2SC-maste.patch patches.suse/dm-raid-fix-missing-reconfig_mutex-unlock-in-raid_ct-bae3.patch patches.suse/dm-raid-clean-up-four-equivalent-goto-tags-in-raid_c-e74c.patch + patches.suse/dm-cache-policy-smq-ensure-IO-doesn-t-prevent-cleane-1e4a.patch patches.suse/s390-dasd-fix-hanging-device-after-quiesce-resume.patch patches.suse/s390-dasd-use-correct-number-of-retries-for-ERP-requests.patch patches.suse/s390-dasd-fix-hanging-device-after-request-requeue.patch