summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2019-12-26 15:54:25 +0900
committerJens Axboe <axboe@kernel.dk>2019-12-30 08:51:46 -0700
commitc7d776f85dfe5159ebf621ee1e50e555237b1a25 (patch)
treebffb16dc77f6859517110ec4dc41ddbd1a1b869e /drivers/block
parent429120f3df2dba2bf3a4a19f4212a53ecefc7102 (diff)
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: da644b2cc1a4 ("null_blk: add zone open, close, and finish support") Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/null_blk_zoned.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c
index d4d88b581822..5cf49d9db95e 100644
--- a/drivers/block/null_blk_zoned.c
+++ b/drivers/block/null_blk_zoned.c
@@ -186,7 +186,10 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op,
if (zone->cond == BLK_ZONE_COND_FULL)
return BLK_STS_IOERR;
- zone->cond = BLK_ZONE_COND_CLOSED;
+ if (zone->wp == zone->start)
+ zone->cond = BLK_ZONE_COND_EMPTY;
+ else
+ zone->cond = BLK_ZONE_COND_CLOSED;
break;
case REQ_OP_ZONE_FINISH:
if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)