From: Ming Lei <tom.leiming@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Cc: Ming Lei <tom.leiming@gmail.com>,
Caleb Sander Mateos <csander@purestorage.com>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org
Subject: [PATCH v3 4/5] ublk: fail a short zone append
Date: Wed, 2 Dec 2026 01:27:02 -0600 [thread overview]
Message-ID: <20261202072705.1288588-5-tom.leiming@gmail.com> (raw)
In-Reply-To: <20261202072705.1288588-1-tom.leiming@gmail.com>
A zone append that the server completes short is ended in full, so the
caller is told that the whole bio was written while its tail never was.
Requeueing the rest, as is done for a short write, doesn't work either:
the rest is sent as a new zone append and written again at the moved
write pointer.
blk_update_request() fails a partial zone append, but only if it is
given the short byte count. A zone append is ended by
blk_mq_end_request(), which always passes blk_rq_bytes(), so that check
never sees the short result.
Fail a short zone append with BLK_STS_IOERR.
Fixes: 29802d7ca33b ("ublk: enable zoned storage support")
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
---
drivers/block/ublk_drv.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 61da50dcc298..ce4a5fe67b34 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -1602,10 +1602,16 @@ static inline void __ublk_complete_rq(struct request *req, struct ublk_io *io,
* - the reply of report zones (DRV_IN) can be shorter than the buffer,
* and a requeued rest would rerun the report
* - a requeued rest of zone append would be appended again at a moved
- * write pointer
+ * write pointer, so fail a short one here: blk_update_request()
+ * fails a partial zone append only if it is given the short byte
+ * count, but the request is ended in full from here
*/
- if (req_op(req) != REQ_OP_READ && req_op(req) != REQ_OP_WRITE)
+ if (req_op(req) != REQ_OP_READ && req_op(req) != REQ_OP_WRITE) {
+ if (req_op(req) == REQ_OP_ZONE_APPEND &&
+ (unsigned int)io->res < blk_rq_bytes(req))
+ res = BLK_STS_IOERR;
goto exit;
+ }
/*
* Only a READ on a device without user copy, zero copy, auto buffer
--
2.56.1
next prev parent reply other threads:[~2026-12-02 7:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 7:26 [PATCH v3 0/5] ublk: fix completion of short READ/WRITE Ming Lei
2026-12-02 7:26 ` [PATCH v3 1/5] selftests: ublk: complete a striped request with its full length Ming Lei
2026-12-02 7:27 ` [PATCH v3 2/5] ublk: fail READ/WRITE if the result from the server is invalid Ming Lei
2026-12-02 7:27 ` [PATCH v3 3/5] ublk: don't complete a short request in full Ming Lei
2026-12-02 7:27 ` Ming Lei [this message]
2026-12-02 7:27 ` [PATCH v3 5/5] selftests: ublk: test that a short request isn't completed " Ming Lei
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=20261202072705.1288588-5-tom.leiming@gmail.com \
--to=tom.leiming@gmail.com \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox