In the Linux kernel, the following vulnerability has been resolved: dm zoned: do not reclaim a random zone into another random zone dmz_reclaim_rnd_data() falls back to a random destination zone when no free sequential zone is available and the target has cache zones. When the target is idle and the cache zone list is empty, dmz_get_rnd_zone_for_reclaim() selects random zones of the zoned device as well, so a random zone is then copied into another random zone. That frees nothing: the next pass picks the next random zone and copies it again, for as long as the target stays idle. Seen on a two-device target (256 GiB regular cache device plus a 27 TB host-managed drive) used as an md RAID5 member: after a full rebuild every chunk was mapped and no sequential zone was free, and the idle drive kept reading and writing while the free zone counters in "dmsetup status" did not change. Only switch to a random destination zone when the zone being reclaimed is a cache zone: moving it to the zoned device still frees cache space. This depends on "dm zoned: back off when reclaim cannot make progress": without it, dmz_reclaim_work() would retry the resulting -ENOSPC at once, and run dmz_check_dev(), for as long as the target stays idle. Tested on 7.4-rc1 together with the previous patch, on a two-device target (a 512 MiB RAM-backed regular cache device plus a 1 GiB scsi_debug host-managed drive) filled until no sequential zone was free, then idle for 60 seconds: the stock module made 877 random-to-random copies; with this series it made none, and each pass failed with -ENOSPC once per DMZ_IDLE_PERIOD without a device check.
https://git.kernel.org/stable/c/fb49cab7623693db1652f1dc9ba7a8321b414f5e
https://git.kernel.org/stable/c/dab527d83462a618d99bfc96370ce45ae3428706
https://git.kernel.org/stable/c/d5434e57b9dda8dbb9a8151fbcf8822f72afde26
https://git.kernel.org/stable/c/bde66db4cb6acf7a5327896c6cca1d36e132ab5a
https://git.kernel.org/stable/c/4f035aceb6dc9c8704b9e5da1758cbe0f457199c
https://git.kernel.org/stable/c/2d15a7484f36605d1d9e4519ddf2877de7f39d53