Skip to content

Commit

Permalink
null_blk: Fail zone append to conventional zones
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/1910111

commit 2e896d8 upstream.

Conventional zones do not have a write pointer and so cannot accept zone
append writes. Make sure to fail any zone append write command issued to
a conventional zone.

Reported-by: Naohiro Aota <naohiro.aota@wdc.com>
Fixes: e0489ed ("null_blk: Support REQ_OP_ZONE_APPEND")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
  • Loading branch information
Damien Le Moal authored and Paolo Pisati committed Jan 4, 2021
1 parent 59470ca commit 1749be1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/block/null_blk_zoned.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,11 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,

trace_nullb_zone_op(cmd, zno, zone->cond);

if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL) {
if (append)
return BLK_STS_IOERR;
return null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors);
}

null_lock_zone(dev, zno);

Expand Down

0 comments on commit 1749be1

Please sign in to comment.