diff mbox series

null_blk: Fix REQ_OP_ZONE_CLOSE handling

Message ID 20191226065425.490122-1-damien.lemoal@wdc.com (mailing list archive)
State New, archived
Headers show
Series null_blk: Fix REQ_OP_ZONE_CLOSE handling | expand

Commit Message

Damien Le Moal Dec. 26, 2019, 6:54 a.m. UTC
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>
---
 drivers/block/null_blk_zoned.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jens Axboe Dec. 29, 2019, 4:12 p.m. UTC | #1
On 12/25/19 11:54 PM, Damien Le Moal wrote:
> In order to match ZBC defined behavior, closing an empty zone must
> result in the "empty" zone condition instead of the "closed" condition.

Applied, thanks.
diff mbox series

Patch

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)