All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@wdc.com>
To: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH v3 2/9] null_blk: Fail zone append to conventional zones
Date: Wed, 11 Nov 2020 22:00:42 +0900	[thread overview]
Message-ID: <20201111130049.967902-3-damien.lemoal@wdc.com> (raw)
In-Reply-To: <20201111130049.967902-1-damien.lemoal@wdc.com>

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: e0489ed5daeb ("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>
---
 drivers/block/null_blk_zoned.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c
index 1d0370d91fe7..172f720b8d63 100644
--- a/drivers/block/null_blk_zoned.c
+++ b/drivers/block/null_blk_zoned.c
@@ -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);
 
-- 
2.26.2


  parent reply	other threads:[~2020-11-11 13:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 13:00 [PATCH v3 0/9] null_blk fixes, improvements and cleanup Damien Le Moal
2020-11-11 13:00 ` [PATCH v3 1/9] null_blk: Fix zone size initialization Damien Le Moal
2020-11-11 13:00 ` Damien Le Moal [this message]
2020-11-11 13:00 ` [PATCH v3 3/9] block: Align max_hw_sectors to logical blocksize Damien Le Moal
2020-11-11 15:20   ` Johannes Thumshirn
2020-11-16 16:58   ` Christoph Hellwig
2020-11-11 13:00 ` [PATCH v3 4/9] null_blk: improve zone locking Damien Le Moal
2020-11-16 17:00   ` Christoph Hellwig
2020-11-17  0:03     ` Damien Le Moal
2020-11-11 13:00 ` [PATCH v3 5/9] null_blk: Improve implicit zone close Damien Le Moal
2020-11-11 18:23   ` Johannes Thumshirn
2020-11-11 13:00 ` [PATCH v3 6/9] null_blk: cleanup discard handling Damien Le Moal
2020-11-11 15:13   ` Johannes Thumshirn
2020-11-11 13:00 ` [PATCH v3 7/9] null_blk: discard zones on reset Damien Le Moal
2020-11-11 13:00 ` [PATCH v3 8/9] null_blk: Allow controlling max_hw_sectors limit Damien Le Moal
2020-11-11 15:19   ` Johannes Thumshirn
2020-11-16 17:00   ` Christoph Hellwig
2020-11-11 13:00 ` [PATCH v3 9/9] null_blk: Move driver into its own directory Damien Le Moal
2020-11-11 15:13   ` Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201111130049.967902-3-damien.lemoal@wdc.com \
    --to=damien.lemoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.