Skip to contentSkip to conversation

zloop: fix zone append check in zloop_rw()

PATCH Applied Damien Le Moal 4 participants 4 messages Nov 19, 2025

Subsystems (2)
lore
Share & tools
lore

Damien Le Moal

author maintainer
#0 lore raw

PATCH 1/1 zloop: fix zone append check in zloop_rw()

While commit cf28f6f923cb ("zloop: fail zone append operations that are targeting full zones") added a check in zloop_rw() that a zone append is not issued to a full zone, commit e3a96ca90462 ("zloop: simplify checks for writes to sequential zones") inadvertently removed the check to verify that there is enough unwritten space in a zone for an incoming zone append opration.

Re-add this check in zloop_rw() to make sure we do not write beyond the end of a zone. Of note is that this same check is already present in the function zloop_set_zone_append_sector() when ordered zone append is in use.

Fixes e3a96ca90462 ("zloop: simplify checks for writes to sequential zones")
---
 drivers/block/zloop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/zloop.c +2 -1
index c4da3116f7a9..1273bbca7843 100644
@@ -448,7 +448,8 @@ static void zloop_rw(struct zloop_cmd *cmd)
 			 * and set the target sector in zloop_queue_rq().
 			 */
 			if (!zlo->ordered_zone_append) {
-				if (zone->cond == BLK_ZONE_COND_FULL) {
+				if (zone->cond == BLK_ZONE_COND_FULL ||
+				    zone->wp + nr_sectors > zone_end) {
 					spin_unlock_irqrestore(&zone->wp_lock,
 							       flags);
 					ret = -EIO;
Signature · 1 line
2.51.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Damien Le Moal

While commit cf28f6f923cb ("zloop: fail zone append operations that are targeting full zones") added a check in zloop_rw() that a zone append is not issued to a full zone, commit e3a96ca90462 ("zloop: simplify checks for writes to sequential zones") inadvertently removed the check to verify that there is enough unwritten space in a zone for an incoming zone append opration.

Re-add this check in zloop_rw() to make sure we do not write beyond the end of a zone. Of note is that this same check is already present in the function zloop_set_zone_append_sector() when ordered zone append is in use.

Looks good:

Reviewed-by on v1 1/1
#2 lore raw
In reply to Damien Le Moal
Quoted 24 lines · Damien Le Moal

While commit cf28f6f923cb ("zloop: fail zone append operations that are targeting full zones") added a check in zloop_rw() that a zone append is not issued to a full zone, commit e3a96ca90462 ("zloop: simplify checks for writes to sequential zones") inadvertently removed the check to verify that there is enough unwritten space in a zone for an incoming zone append opration.

Re-add this check in zloop_rw() to make sure we do not write beyond the end of a zone. Of note is that this same check is already present in the function zloop_set_zone_append_sector() when ordered zone append is in use.

Fixes e3a96ca90462 ("zloop: simplify checks for writes to sequential zones")
---
 drivers/block/zloop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/zloop.c +0 -0
index c4da3116f7a9..1273bbca7843 100644

drivers/block/zloop.c static void zloop_rw(struct zloop_cmd *cmd) · line 455

Quoted 9 lines
drivers/block/zloop.c +2 -1
@@ -448,7 +448,8 @@ static void zloop_rw(struct zloop_cmd *cmd)
 			 * and set the target sector in zloop_queue_rq().
 			 */
 			if (!zlo->ordered_zone_append) {
-				if (zone->cond == BLK_ZONE_COND_FULL) {
+				if (zone->cond == BLK_ZONE_COND_FULL ||
+				    zone->wp + nr_sectors > zone_end) {
 					spin_unlock_irqrestore(&zone->wp_lock,
 							       flags);
 					ret = -EIO;

Looks good,

maintainer Applied
#3 lore raw
In reply to Damien Le Moal
Quoted 8 lines · Damien Le Moal

While commit cf28f6f923cb ("zloop: fail zone append operations that are targeting full zones") added a check in zloop_rw() that a zone append is not issued to a full zone, commit e3a96ca90462 ("zloop: simplify checks for writes to sequential zones") inadvertently removed the check to verify that there is enough unwritten space in a zone for an incoming zone append opration.

[...]

Applied, thanks!

[1/1] zloop: fix zone append check in zloop_rw()

      commit: a9637ab93c6cfdf7a80a299b7de691dea6a7d7ba

Best regards,

Signature · 1 line
Jens Axboe