Skip to content

Commit 16c731f

Browse files
damien-lemoalaxboe
authored andcommitted
null_blk: Fix zone write handling
null_zone_write() only allows writing empty and implicitly opened zones. Writing to closed and explicitly opened zones must also be allowed and the zone condition must be transitioned to implicit open if the zone is not explicitly opened already. 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 4a2f704 commit 16c731f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/block/null_blk_zoned.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,13 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
129129
return BLK_STS_IOERR;
130130
case BLK_ZONE_COND_EMPTY:
131131
case BLK_ZONE_COND_IMP_OPEN:
132+
case BLK_ZONE_COND_EXP_OPEN:
133+
case BLK_ZONE_COND_CLOSED:
132134
/* Writes must be at the write pointer position */
133135
if (sector != zone->wp)
134136
return BLK_STS_IOERR;
135137

136-
if (zone->cond == BLK_ZONE_COND_EMPTY)
138+
if (zone->cond != BLK_ZONE_COND_EXP_OPEN)
137139
zone->cond = BLK_ZONE_COND_IMP_OPEN;
138140

139141
zone->wp += nr_sectors;

0 commit comments

Comments
 (0)