Commit f2cd9a5e authored by Shin'ichiro Kawasaki's avatar Shin'ichiro Kawasaki Committed by Mike Snitzer
Browse files

dm zoned: Fix reclaim zone selection

When dm zoned has multiple devices, random zones are never selected for
reclaim if all reserved sequential write zones are in use and no
sequential write required zones can be selected for reclaim. This can
lead to deadlocks as selecting a cache zone allows reclaiming a
sequential zone, ensuring forward progress.

Fix this by always defaulting to selecting a random zone when no
sequential write required zone can be selected.

[Damien: fix commit message]
Signed-off-by: default avatarShin'ichiro Kawasaki <>
Signed-off-by: default avatarDamien Le Moal <>
Reviewed-by: default avatarHannes Reinecke <>
Signed-off-by: default avatarMike Snitzer <>
parent 3ee39573
......@@ -2026,7 +2026,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd,
struct dm_zone *dmz_get_zone_for_reclaim(struct dmz_metadata *zmd,
unsigned int dev_idx, bool idle)
struct dm_zone *zone;
struct dm_zone *zone = NULL;
* Search for a zone candidate to reclaim: 2 cases are possible.
......@@ -2039,7 +2039,7 @@ struct dm_zone *dmz_get_zone_for_reclaim(struct dmz_metadata *zmd,
if (list_empty(&zmd->reserved_seq_zones_list))
zone = dmz_get_seq_zone_for_reclaim(zmd, dev_idx);
if (!zone)
zone = dmz_get_rnd_zone_for_reclaim(zmd, dev_idx, idle);
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