Skip to content

Commit c7d776f

Browse files
damien-lemoalaxboe
authored andcommitted
null_blk: Fix REQ_OP_ZONE_CLOSE handling
In order to match ZBC defined behavior, closing an empty zone must result in the "empty" zone condition instead of the "closed" condition. Fixes: da644b2 ("null_blk: add zone open, close, and finish support") Signed-off-by: Damien Le Moal <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 429120f commit c7d776f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/block/null_blk_zoned.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op,
186186
if (zone->cond == BLK_ZONE_COND_FULL)
187187
return BLK_STS_IOERR;
188188

189-
zone->cond = BLK_ZONE_COND_CLOSED;
189+
if (zone->wp == zone->start)
190+
zone->cond = BLK_ZONE_COND_EMPTY;
191+
else
192+
zone->cond = BLK_ZONE_COND_CLOSED;
190193
break;
191194
case REQ_OP_ZONE_FINISH:
192195
if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)

0 commit comments

Comments
 (0)